Fix typo causing incorrect desktop sorting
[AROS.git] / workbench / system / Wanderer / portable_macros.h
blob10cd34c57d3139679fb5d1f32e2696e52c0d8321
1 #ifndef __PORTABLE_MACROS__
2 #define __PORTABLE_MACROS__
4 #ifdef __AROS__
5 #define TAGITEM const struct TagItem **
6 #else
7 #define TAGITEM struct TagItem **
8 #endif
10 #ifndef __AROS__
12 #if !defined(__AROS__) || !defined(__MORPHOS__)
13 #ifdef __amigaos4__
14 #define IPTR uint32
15 #else
16 #define IPTR ULONG
17 #endif
18 #endif
20 #ifndef __AROS__
21 #define STACKED
22 #endif
24 #ifndef __AROS__
25 #include <proto/exec.h>
26 #include <proto/utility.h>
27 #endif
30 #ifndef __AROS__
31 #include <proto/wb.h>
32 #endif
35 #ifndef __AROS__
36 #define AROS_BIG_ENDIAN 1
37 #endif
40 #ifndef __AROS__
41 #include <exec_AROS/lists.h>
42 #endif
45 #ifndef __AROS__
46 #include <workbench/icon.h>
47 #endif
49 #if defined (__MORPHOS__) || (defined (__AMIGA__) && !defined(__PPC__))
50 #include <dos/dostags.h>
51 #endif
53 #ifndef __AROS__
54 #include <SDI_compiler.h>
55 #include <SDI_hook.h>
56 #include <SDI_stdarg.h>
57 #endif
60 #ifndef __AROS__
62 #ifdef __amigaos4__
63 #define UQUAD uint64
64 #define QUAD int64
65 #else
66 #define UQUAD ULONG
67 #define QUAD LONG
68 #endif
70 extern struct Library *MUIMasterBase;
71 #ifdef __amigaos4__
72 extern struct MUIMasterIFace *IMUIMaster;
73 #endif
76 #define AROS_UFHA(type,name,reg) type name
79 #define AROS_UFH0(rettype,name) rettype name()
81 #define AROS_UFH1(rettype,name,a1) rettype name(a1)
83 #define AROS_UFH2(rettype,name,a1,a2) rettype name (a1, a2)
85 #define AROS_UFH3(rettype,name,a1,a2,a3) rettype name (a1, a2, a3)
88 #define AROS_USERFUNC_INIT
89 #define AROS_USERFUNC_EXIT
91 #define MUIB_MUI (TAG_USER) /* Base for legacy MUI identifiers */
92 #define MUIB_RSVD (MUIB_MUI | 0x10400000) /* Base for AROS reserved range */
93 #define MUIB_ZUNE (MUIB_RSVD | 0x00020000) /* Base for Zune core reserved range */
94 #define MUIB_AROS (MUIB_RSVD | 0x00070000) /* Base for AROS core reserved range */
99 #define MAX(a,b) (((a) > (b))?(a):(b))
100 #define MIN(a,b) (((a) > (b))?(b):(a))
102 #define _AndRectRect(rect1, rect2, intersect) \
103 ({ \
104 BOOL res; \
106 if (overlap(*(rect1), *(rect2))) \
108 (intersect)->MinX = MAX((rect1)->MinX, (rect2)->MinX); \
109 (intersect)->MinY = MAX((rect1)->MinY, (rect2)->MinY); \
110 (intersect)->MaxX = MIN((rect1)->MaxX, (rect2)->MaxX); \
111 (intersect)->MaxY = MIN((rect1)->MaxY, (rect2)->MaxY); \
113 res = TRUE; \
115 else \
116 res = FALSE; \
118 res; \
122 #define _DoRectsOverlap(Rect, x1, y1, x2, y2) \
124 y1 <= (Rect)->MaxY && \
125 y2 >= (Rect)->MinY && \
126 x1 <= (Rect)->MaxX && \
127 x2 >= (Rect)->MinX \
130 #define overlap(a,b) _DoRectsOverlap(&(a), (b).MinX, (b).MinY, (b).MaxX, (b).MaxY)
135 #define GET(obj,attr,store) get(obj,attr,store)
136 #define SET(obj,attr,value) set(obj,attr,value)
138 #define XGET(object, attribute) \
139 ({ \
140 IPTR __storage = 0; \
141 GetAttr((attribute), (object), &__storage); \
142 __storage; \
145 #define NNSET(obj,attr,value) nnset(obj,attr,value)
149 #if !defined(__amigaos4__)
151 #define GetHead(_l) \
152 ({ struct List *l = (struct List *)(_l); \
153 l->lh_Head->ln_Succ ? l->lh_Head : (struct Node *)0; \
156 #define GetSucc(_n) \
157 ({ struct Node *n = (struct Node *)(_n); \
158 n->ln_Succ->ln_Succ ? n->ln_Succ : (struct Node *)0; \
161 #define GetTail(_l) \
162 ({ struct List *l = (struct List *)(_l); \
163 l->lh_TailPred->ln_Pred ? l->lh_TailPred : (struct Node *)0; \
166 #define GetPred(_n) \
167 ({ struct Node *n = (struct Node *)(_n); \
168 n->ln_Pred->ln_Pred ? n->ln_Pred : (struct Node *)0; \
170 #endif
173 #define ImageButton(label, imagePath) MUI_MakeObject(MUIO_Button, (IPTR) (label))
175 #define BOOPSI_DISPATCHER(ret, nameDsp, cls, obj, msg) DISPATCHER(nameDsp)
176 #define BOOPSI_DISPATCHER_END
180 #define SendAppWindowMessage(...) sizeof(NULL)
181 #define RegisterWorkbench(...) sizeof(NULL)
182 #define UnregisterWorkbench(...) sizeof(NULL)
183 #define ArosInquire(...) sizeof(NULL)
184 #define AROS_LE2LONG(...) sizeof(NULL)
185 #define ADD2INIT(...)
186 #define ADD2EXIT(...)
187 #define Detach()
188 #define __showerror
190 #define DeinitRastPort FreeRastPort
193 extern struct RastPort *CreateRastPort(void);
194 extern struct RastPort *CloneRastPort(struct RastPort *rp);
195 extern void FreeRastPort(struct RastPort *rp);
196 extern BOOL AndRectRect(struct Rectangle *rect1, struct Rectangle *rect2, struct Rectangle *intersect);
200 #if defined (__AMIGA__) && !defined(__PPC__)
201 #define NP_UserData (NP_Dummy + 26)
202 /* optional value to install into task->tc_UserData. */
203 #endif
206 struct MUIP_CreateDragImage {STACKED ULONG MethodID; STACKED LONG touchx; STACKED LONG touchy; STACKED ULONG flags;};
208 struct MUI_DragImage
210 struct BitMap *bm;
211 WORD width; /* exact width and height of bitmap */
212 WORD height;
213 WORD touchx; /* position of pointer click relative to bitmap */
214 WORD touchy;
215 ULONG flags; /* must be set to 0 */
218 struct MUIP_DeleteDragImage {STACKED ULONG MethodID; STACKED struct MUI_DragImage *di;};
220 struct MUIP_Layout {STACKED ULONG MethodID;};
222 #define MUIA_Prop_DeltaFactor (MUIB_MUI|0x00427c5e) /* MUI: is. LONG */
223 #define MUIM_CreateDragImage (MUIB_MUI|0x0042eb6f) /* MUI: V18 */ /* For Custom Classes only */ /* Undoc */
224 #define MUIM_DeleteDragImage (MUIB_MUI|0x00423037) /* MUI: V18 */ /* For Custom Classes only */ /* Undoc */
226 #ifndef __AROS__
227 #define MUIM_Application_Execute (MUIB_Wanderer | 0x000000011)
228 #endif
230 extern STRPTR StrDup (CONST_STRPTR str);
232 extern int IconWindowIconDrawerList_Initialize(void);
233 extern int IconWindowIconVolumeList_Initialize(void);
234 extern int WandererPrefs_Initialize(void);
235 extern int Wanderer_Initialize(void);
236 extern int IconWindow_Initialize(void);
239 extern void IconWindowIconDrawerList_Deinitialize(void);
240 extern void IconWindowIconVolumeList_Deinitialize(void);
241 extern void WandererPrefs_Deinitialize(void);
242 extern void Wanderer_Deinitialize(void);
243 extern void IconWindow_Deinitialize(void);
247 extern struct MUI_CustomClass *IconWindowIconVolumeList_CLASS;
248 extern struct MUI_CustomClass *IconWindowIconDrawerList_CLASS;
249 extern struct MUI_CustomClass *WandererPrefs_CLASS;
250 extern struct MUI_CustomClass *IconWindow_CLASS;
253 extern int initIconWindowClass(void);
254 //extern struct MUI_CustomClass *initIconWindowClass(void);
255 extern struct MUI_CustomClass * initIconListClass(void);
256 extern struct MUI_CustomClass * initIconDrawerListClass(void);
257 extern struct MUI_CustomClass *initIconListviewClass(void);
258 extern struct MUI_CustomClass * initIconVolumeListClass(void);
261 extern struct MUI_CustomClass *IconWindow_Class;
262 extern struct MUI_CustomClass *IconList_Class;
263 extern struct MUI_CustomClass *IconDrawerList_Class;
264 extern struct MUI_CustomClass *IconListview_Class;
265 extern struct MUI_CustomClass *IconVolumeList_Class ;
268 #endif
270 #endif
272 #endif