Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / muimaster / classes / area.h
blobe74a9cb17f764a82d88aae9b00f6ef2d2a1beaff
1 /*
2 Copyright 1999, David Le Corfec.
3 Copyright 2002, The AROS Development Team.
4 All rights reserved.
6 $Id$
7 */
9 #ifndef _MUI_CLASSES_AREA_H
10 #define _MUI_CLASSES_AREA_H
12 #ifndef INTUITION_INTUITION_H
13 #include <intuition/intuition.h>
14 #endif
16 #ifndef GRAPHICS_GRAPHICS_H
17 #include <graphics/gfx.h>
18 #endif
20 #ifndef _MUI_CLASSES_WINDOW_H
21 #include "classes/window.h" /* for MUI_EventHandlerNode, will be gone if this MUI_AreaData is moved to area.c */
22 #endif
24 /*** Name *******************************************************************/
25 #define MUIC_Area "Area.mui"
27 /*** Identifier base (for Zune extensions) **********************************/
28 #define MUIB_Area (MUIB_ZUNE | 0x00000200)
30 /*** Methods ****************************************************************/
31 #define MUIM_AskMinMax (MUIB_MUI|0x00423874) /* MUI: V4 */ /* For Custom Classes only */
32 #define MUIM_Cleanup (MUIB_MUI|0x0042d985) /* MUI: V4 */ /* For Custom Classes only */
33 #define MUIM_ContextMenuBuild (MUIB_MUI|0x00429d2e) /* MUI: V11 */
34 #define MUIM_ContextMenuChoice (MUIB_MUI|0x00420f0e) /* MUI: V11 */
35 #define MUIM_CreateBubble (MUIB_MUI|0x00421c41) /* MUI: V18 */
36 #define MUIM_CreateDragImage (MUIB_MUI|0x0042eb6f) /* MUI: V18 */ /* For Custom Classes only */ /* Undoc */
37 #define MUIM_CreateShortHelp (MUIB_MUI|0x00428e93) /* MUI: V11 */
38 #define MUIM_CustomBackfill (MUIB_MUI|0x00428d73) /* Undoc */
39 #define MUIM_DeleteBubble (MUIB_MUI|0x004211af) /* MUI: V18 */
40 #define MUIM_DeleteDragImage (MUIB_MUI|0x00423037) /* MUI: V18 */ /* For Custom Classes only */ /* Undoc */
41 #define MUIM_DeleteShortHelp (MUIB_MUI|0x0042d35a) /* MUI: V11 */
42 #define MUIM_DoDrag (MUIB_MUI|0x004216bb) /* MUI: V18 */ /* For Custom Classes only */ /* Undoc */
43 #define MUIM_DragBegin (MUIB_MUI|0x0042c03a) /* MUI: V11 */
44 #define MUIM_DragDrop (MUIB_MUI|0x0042c555) /* MUI: V11 */
45 #define MUIM_UnknownDropDestination (MUIB_MUI|0x00425550) /* ZUNE */
46 #define MUIM_DragFinish (MUIB_MUI|0x004251f0) /* MUI: V11 */
47 #define MUIM_DragQuery (MUIB_MUI|0x00420261) /* MUI: V11 */
48 #define MUIM_DragReport (MUIB_MUI|0x0042edad) /* MUI: V11 */
49 #define MUIM_Draw (MUIB_MUI|0x00426f3f) /* MUI: V4 */ /* For Custom Classes only */
50 #define MUIM_DrawBackground (MUIB_MUI|0x004238ca) /* MUI: V11 */
51 #define MUIM_GoActive (MUIB_MUI|0x0042491a) /* Undoc */
52 #define MUIM_GoInactive (MUIB_MUI|0x00422c0c) /* Undoc */
53 #define MUIM_HandleEvent (MUIB_MUI|0x00426d66) /* MUI: V16 */ /* For Custom Classes only */
54 #define MUIM_HandleInput (MUIB_MUI|0x00422a1a) /* MUI: V4 */ /* For Custom Classes only */
55 #define MUIM_Hide (MUIB_MUI|0x0042f20f) /* MUI: V4 */ /* For Custom Classes only */
56 #define MUIM_Setup (MUIB_MUI|0x00428354) /* MUI: V4 */ /* For Custom Classes only */
57 #define MUIM_Show (MUIB_MUI|0x0042cc84) /* MUI: V4 */ /* For Custom Classes only */
58 struct MUIP_AskMinMax {STACKED ULONG MethodID; STACKED struct MUI_MinMax *MinMaxInfo;};
59 struct MUIP_Cleanup {STACKED ULONG MethodID;};
60 struct MUIP_ContextMenuBuild {STACKED ULONG MethodID; STACKED LONG mx; STACKED LONG my;};
61 struct MUIP_ContextMenuChoice {STACKED ULONG MethodID; STACKED Object *item;};
62 struct MUIP_CreateBubble {STACKED ULONG MethodID; STACKED LONG x; STACKED LONG y; STACKED char *txt; STACKED ULONG flags;};
63 struct MUIP_CreateDragImage {STACKED ULONG MethodID; STACKED LONG touchx; STACKED LONG touchy; STACKED ULONG flags;};
64 struct MUIP_CreateShortHelp {STACKED ULONG MethodID; STACKED LONG mx; STACKED LONG my;};
65 struct MUIP_CustomBackfill {STACKED ULONG MethodID; STACKED LONG left; STACKED LONG top; STACKED LONG right; STACKED LONG bottom; STACKED LONG xoffset; STACKED LONG yoffset;};
66 struct MUIP_DeleteBubble {STACKED ULONG MethodID; STACKED APTR bubble;};
67 struct MUIP_DeleteDragImage {STACKED ULONG MethodID; STACKED struct MUI_DragImage *di;};
68 struct MUIP_DeleteShortHelp {STACKED ULONG MethodID; STACKED STRPTR help; };
69 struct MUIP_DoDrag {STACKED ULONG MethodID; STACKED LONG touchx; STACKED LONG touchy; STACKED ULONG flags;};
70 struct MUIP_UnknownDropDestination {STACKED ULONG MethodID; STACKED struct IntuiMessage *imsg; };
71 struct MUIP_DragBegin {STACKED ULONG MethodID; STACKED Object *obj;};
72 struct MUIP_DragDrop {STACKED ULONG MethodID; STACKED Object *obj; STACKED LONG x; STACKED LONG y;};
73 struct MUIP_DragFinish {STACKED ULONG MethodID; STACKED Object *obj;};
74 struct MUIP_DragQuery {STACKED ULONG MethodID; STACKED Object *obj;};
75 struct MUIP_DragReport {STACKED ULONG MethodID; STACKED Object *obj; STACKED LONG x; STACKED LONG y; STACKED LONG update;};
76 struct MUIP_Draw {STACKED ULONG MethodID; STACKED ULONG flags;};
77 struct MUIP_DrawBackground {STACKED ULONG MethodID; STACKED LONG left; STACKED LONG top; STACKED LONG width; STACKED LONG height; STACKED LONG xoffset; STACKED LONG yoffset; STACKED LONG flags;};
78 struct MUIP_DrawBackgroundBuffered {STACKED ULONG MethodID; STACKED struct RastPort *rp; STACKED LONG left; STACKED LONG top; STACKED LONG width; STACKED LONG height; STACKED LONG xoffset; STACKED LONG yoffset; STACKED LONG flags;};
79 struct MUIP_GoActive {STACKED ULONG MethodID;};
80 struct MUIP_GoInacrive {STACKED ULONG MethodID;};
81 struct MUIP_HandleEvent {STACKED ULONG MethodID; STACKED struct IntuiMessage *imsg; STACKED LONG muikey;};
82 struct MUIP_HandleInput {STACKED ULONG MethodID; STACKED struct IntuiMessage *imsg; STACKED LONG muikey;};
83 struct MUIP_Hide {STACKED ULONG MethodID;};
84 struct MUIP_Setup {STACKED ULONG MethodID; STACKED struct MUI_RenderInfo *RenderInfo;};
85 struct MUIP_Show {STACKED ULONG MethodID;};
87 #define MUIM_Layout (MUIB_Area | 0x00000000)
88 #define MUIM_DrawParentBackground (MUIB_Area | 0x00000001)
89 #define MUIM_DragQueryExtended (MUIB_Area | 0x00000002) /* PRIV - returns a object or NULL */
90 #define MUIM_Timer (MUIB_Area | 0x00000003) /* PRIV */
91 #define MUIM_UpdateInnerSizes (MUIB_Area | 0x00000004) /* PRIV for now */
92 #define MUIM_FindAreaObject (MUIB_Area | 0x00000005) /* PRIV */
93 #define MUIM_DrawBackgroundBuffered (MUIB_Area | 0x00000006) /* PRIV */
94 struct MUIP_Layout {STACKED ULONG MethodID;};
95 struct MUIP_DrawParentBackground {STACKED ULONG MethodID; STACKED LONG left; STACKED LONG top; STACKED LONG width; STACKED LONG height; STACKED LONG xoffset; STACKED LONG yoffset; STACKED LONG flags;};
96 struct MUIP_DragQueryExtended {STACKED ULONG MethodID; STACKED Object *obj; STACKED LONG x; STACKED LONG y;}; /* PRIV */
97 struct MUIP_Timer {STACKED ULONG MethodID; }; /* PRIV */
98 struct MUIP_UpdateInnerSizes {STACKED ULONG MethodID; }; /* PRIV */
99 struct MUIP_FindAreaObject {STACKED ULONG MethodID; STACKED Object *obj;}; /* PRIV */
101 struct MUI_DragImage
103 struct BitMap *bm;
104 WORD width; /* exact width and height of bitmap */
105 WORD height;
106 WORD touchx; /* position of pointer click relative to bitmap */
107 WORD touchy;
108 ULONG flags; /* must be set to 0 */
111 /*** Attributes *************************************************************/
112 #define MUIA_Background (MUIB_MUI|0x0042545b) /* MUI: V4 is. LONG */
113 #define MUIA_BottomEdge (MUIB_MUI|0x0042e552) /* MUI: V4 ..g LONG */
114 #define MUIA_ContextMenu (MUIB_MUI|0x0042b704) /* MUI: V11 isg Object * */
115 #define MUIA_ContextMenuTrigger (MUIB_MUI|0x0042a2c1) /* MUI: V11 ..g Object * */
116 #define MUIA_ControlChar (MUIB_MUI|0x0042120b) /* MUI: V4 isg char */
117 #define MUIA_CustomBackfill (MUIB_MUI|0x00420a63) /* undoc i.. */
118 #define MUIA_CycleChain (MUIB_MUI|0x00421ce7) /* MUI: V11 isg LONG */
119 #define MUIA_Disabled (MUIB_MUI|0x00423661) /* MUI: V4 isg BOOL */
120 #define MUIA_Draggable (MUIB_MUI|0x00420b6e) /* MUI: V11 isg BOOL */
121 #define MUIA_Dropable (MUIB_MUI|0x0042fbce) /* MUI: V11 isg BOOL */
122 #define MUIA_FillArea (MUIB_MUI|0x004294a3) /* MUI: V4 is. BOOL */
123 #define MUIA_FixHeight (MUIB_MUI|0x0042a92b) /* MUI: V4 i.. LONG */
124 #define MUIA_FixHeightTxt (MUIB_MUI|0x004276f2) /* MUI: V4 i.. STRPTR */
125 #define MUIA_FixWidth (MUIB_MUI|0x0042a3f1) /* MUI: V4 i.. LONG */
126 #define MUIA_FixWidthTxt (MUIB_MUI|0x0042d044) /* MUI: V4 i.. STRPTR */
127 #define MUIA_Font (MUIB_MUI|0x0042be50) /* MUI: V4 i.g struct TextFont * */
128 #define MUIA_Frame (MUIB_MUI|0x0042ac64) /* MUI: V4 i.. LONG */
129 #define MUIA_FramePhantomHoriz (MUIB_MUI|0x0042ed76) /* MUI: V4 i.. BOOL */
130 #define MUIA_FrameTitle (MUIB_MUI|0x0042d1c7) /* MUI: V4 i.. STRPTR */
131 #define MUIA_Height (MUIB_MUI|0x00423237) /* MUI: V4 ..g LONG */
132 #define MUIA_HorizDisappear (MUIB_MUI|0x00429615) /* MUI: V11 isg LONG */
133 #define MUIA_HorizWeight (MUIB_MUI|0x00426db9) /* MUI: V4 isg WORD */
134 #define MUIA_InnerBottom (MUIB_MUI|0x0042f2c0) /* MUI: V4 i.g LONG */
135 #define MUIA_InnerLeft (MUIB_MUI|0x004228f8) /* MUI: V4 i.g LONG */
136 #define MUIA_InnerRight (MUIB_MUI|0x004297ff) /* MUI: V4 i.g LONG */
137 #define MUIA_InnerTop (MUIB_MUI|0x00421eb6) /* MUI: V4 i.g LONG */
138 #define MUIA_InputMode (MUIB_MUI|0x0042fb04) /* MUI: V4 i.. LONG */
139 #define MUIA_LeftEdge (MUIB_MUI|0x0042bec6) /* MUI: V4 ..g LONG */
140 #define MUIA_MaxHeight (MUIB_MUI|0x004293e4) /* MUI: V11 i.. LONG */
141 #define MUIA_MaxWidth (MUIB_MUI|0x0042f112) /* MUI: V11 i.. LONG */
142 #define MUIA_Pressed (MUIB_MUI|0x00423535) /* MUI: V4 ..g BOOL */
143 #define MUIA_RightEdge (MUIB_MUI|0x0042ba82) /* MUI: V4 ..g LONG */
144 #define MUIA_Selected (MUIB_MUI|0x0042654b) /* MUI: V4 isg BOOL */
145 #define MUIA_ShortHelp (MUIB_MUI|0x00428fe3) /* MUI: V11 isg STRPTR */
146 #define MUIA_ShowMe (MUIB_MUI|0x00429ba8) /* MUI: V4 isg BOOL */
147 #define MUIA_ShowSelState (MUIB_MUI|0x0042caac) /* MUI: V4 i.. BOOL */
148 #define MUIA_Timer (MUIB_MUI|0x00426435) /* MUI: V4 ..g LONG */
149 #define MUIA_TopEdge (MUIB_MUI|0x0042509b) /* MUI: V4 ..g LONG */
150 #define MUIA_VertDisappear (MUIB_MUI|0x0042d12f) /* MUI: V11 isg LONG */
151 #define MUIA_VertWeight (MUIB_MUI|0x004298d0) /* MUI: V4 isg WORD */
152 #define MUIA_Weight (MUIB_MUI|0x00421d1f) /* MUI: V4 i.. WORD */
153 #define MUIA_Width (MUIB_MUI|0x0042b59c) /* MUI: V4 ..g LONG */
154 #define MUIA_Window (MUIB_MUI|0x00421591) /* MUI: V4 ..g struct Window * */
155 #define MUIA_WindowObject (MUIB_MUI|0x0042669e) /* MUI: V4 ..g Object * */
157 #define MUIA_NestedDisabled (MUIB_Area | 0x00000000) /* Zune 20030530 isg BOOL */
159 #ifdef MUI_OBSOLETE
160 #define MUIA_ExportID (MUIB_MUI|0x0042d76e) /* V4 isg ULONG */
161 #endif /* MUI_OBSOLETE */
163 struct MUI_ImageSpec_intern;
165 struct MUI_AreaData
167 struct MUI_RenderInfo *mad_RenderInfo; /* RenderInfo for this object */
168 struct MUI_ImageSpec_intern *mad_Background; /* bg setting - *private* ! */
169 struct TextFont *mad_Font; /* Font which is used to draw */
170 struct MUI_MinMax mad_MinMax; /* min/max/default dimensions */
171 struct IBox mad_Box; /* coordinates and dim of this object after layouted */
172 BYTE mad_addleft; /* left offset (frame & innerspacing) */
173 BYTE mad_addtop; /* top offset (frame & innerspacing) */
174 BYTE mad_subwidth; /* additional width (frame & innerspacing) */
175 BYTE mad_subheight; /* additional height (frame & innerspacing) */
176 ULONG mad_Flags; /* some flags; see below */
177 ULONG mad_Flags2;
178 // 40 bytes up to here
180 /* The following data is private */
181 /* START PRIV */
182 // offset 40
183 UWORD mad_HorizWeight; /* weight values for layout. default 100 */
184 UWORD mad_VertWeight;
185 // offset 44
186 // ?
187 // offset 48
188 ULONG mad_IDCMP; /* IDCMP flags this listens to (for HandleInput) */
189 // offset 52
190 CONST_STRPTR mad_BackgroundSpec;
191 // offset 56
192 LONG mad_FontPreset; /* MUIV_Font_xxx */
193 // offset 76
194 CONST_STRPTR mad_FrameTitle; /* for groups. Req. mad_Frame > 0 */
195 // Inner values at offset 88 in MUI:
196 BYTE mad_InnerLeft; /* frame or hardcoded */
197 BYTE mad_InnerTop;
198 BYTE mad_InnerRight;
199 BYTE mad_InnerBottom;
200 // offset 94
201 BYTE mad_FrameOBSOLETE; /* frame setting -- private */
202 // offset 95
203 BYTE mad_InputMode; /* how to react to events */
204 // offset 96
205 TEXT mad_ControlChar; /* key shortcut */
206 BYTE mad_TitleHeightAdd;/* frame title height = mad_TitleBelow + mad_TitleBaseline */
207 BYTE mad_TitleHeightBelow; /* height below frame */
208 BYTE mad_TitleHeightAbove; /* height above frame */
209 // 100
210 // ?
211 IPTR mad_Frame;
212 WORD mad_HardHeight; /* if harcoded dim (see flags) */
213 WORD mad_HardWidth; /* if harcoded dim (see flags) */
214 CONST_STRPTR mad_HardWidthTxt;
215 CONST_STRPTR mad_HardHeightTxt;
216 // TODO: move SelBack in RenderInfo as it's common for all objects
217 struct MUI_ImageSpec_intern *mad_SelBack; /* selected state background */
218 CONST_STRPTR mad_ShortHelp; /* bubble help */
219 // there's an event handler at 114
220 struct MUI_EventHandlerNode mad_ehn;
221 struct MUI_InputHandlerNode mad_Timer; /* MUIA_Timer */
222 ULONG mad_Timeval; /* just to trigger notifications */
223 struct MUI_EventHandlerNode mad_ccn; /* gross hack for control char */
224 Object *mad_ContextMenu; /* menu strip */
225 LONG mad_ClickX; /* x position of the initial SELECTDOWN click */
226 LONG mad_ClickY; /* y position of the intiial SELECTDOWN click */
227 struct ZMenu *mad_ContextZMenu;
228 struct MUI_EventHandlerNode mad_hiehn; /* Eventhandler to simulate MUIM_HandleInput */
230 LONG mad_DisableCount; /* counts number of disables */
231 /* END PRIV */
232 // only 148 bytes for the struct in MUI !
235 /* Flags during MUIM_Draw */
236 #define MADF_DRAWOBJECT (1<< 0) /* draw object completely */
237 #define MADF_DRAWUPDATE (1<< 1) /* update object */
239 #define MADF_DRAWALL (1<< 31)
242 /* mad_Flags, private one */
243 #define MADF_DRAW_XXX (1<< 2) /* PRIV - mui verified, what use ? */
244 #define MADF_DRAGGABLE (1<< 3) /* PRIV - mui verified */
245 #define MADF_MAXHEIGHT (1<< 4) /* PRIV - share bit 6 in mui */
246 #define MADF_CYCLECHAIN (1<< 5) /* PRIV - mui verified */
247 #define MADF_MAXWIDTH (1<< 6) /* PRIV - share bit 6 in mui */
248 #define MADF_DRAGGING (1<< 7) /* PRIV - zune-specific ? */
249 #define MADF_OWNBG (1<< 8) /* PRIV - zune-specific ? */
250 #define MADF_SHOWME (1<< 9) /* PRIV - mui verified */
251 #define MADF_BORDERGADGET (1<< 10) /* PRIV - is a border gadget; zune-specific ? */
252 #define MADF_DRAWFRAME (1<< 11) /* PRIV - nearly mui verified */
253 #define MADF_DRAW_XXX_2 (1<< 12) /* PRIV - mui verified, what use ? */
254 #define MADF_DROPABLE (1<< 13) /* PRIV - mui verified */
255 #define MADF_CANDRAW (1<< 14) /* PRIV - roughly mui equivalent */
256 #define MADF_DISABLED (1<< 15) /* PRIV - mui verified */
257 #define MADF_SHOWSELSTATE (1<< 16) /* PRIV - mui verified */
258 #define MADF_PRESSED (1<< 17) /* PRIV - nearly mui verified */
259 #define MADF_SELECTED (1<< 18) /* PRIV - mui verified */
260 #define MADF_FIXHEIGHT (1<< 19) /* PRIV - zune-specific */
261 #define MADF_FILLAREA (1<< 20) /* PRIV - mui verified */
262 #define MADF_FIXWIDTH (1<< 22) /* PRIV - zune-specific */
263 #define MADF_FIXHEIGHTTXT (1<< 22) /* PRIV - mui verified (unused in zune) */
264 #define MADF_INNERLEFT (1<< 23) /* PRIV - mui verified */
265 #define MADF_INNERTOP (1<< 24) /* PRIV - mui verified */
266 #define MADF_INNERRIGHT (1<< 25) /* PRIV - mui verified */
267 #define MADF_INNERBOTTOM (1<< 26) /* PRIV - mui verified */
268 #define MADF_FRAMEPHANTOM (1<< 27) /* PRIV - mui verified */
269 #define MADF_SETUP (1<< 28) /* PRIV - zune-specific */
271 #define MADF_INVIRTUALGROUP (1<<29) /* PRIV UNDOC: The object is inside a virtual group */
272 #define MADF_ISVIRTUALGROUP (1<<30) /* PRIV UNDOC: The object is a virtual group */
274 #define MADF_DRAWFLAGS (MADF_DRAWOBJECT | MADF_DRAWUPDATE | MADF_DRAW_XXX \
275 | MADF_DRAWFRAME | MADF_DRAW_XXX_2 | MADF_DRAWALL)
278 // offset 94 (byte) (frame << 1) (lsb is SETUP_DONE flag)
279 enum {
280 MUIV_Frame_None = 0,
281 MUIV_Frame_Button,
282 MUIV_Frame_ImageButton,
283 MUIV_Frame_Text,
284 MUIV_Frame_String,
285 MUIV_Frame_ReadList,
286 MUIV_Frame_InputList,
287 MUIV_Frame_Prop,
288 MUIV_Frame_Gauge,
289 MUIV_Frame_Group,
290 MUIV_Frame_PopUp,
291 MUIV_Frame_Virtual,
292 MUIV_Frame_Slider,
293 MUIV_Frame_Knob,
294 MUIV_Frame_Drag,
295 MUIV_Frame_Count,
298 // offset 95
299 enum {
300 MUIV_InputMode_None = 0, // 0x00
301 MUIV_InputMode_RelVerify, // 0x40 (1<<6)
302 MUIV_InputMode_Immediate, // 0x80 (1<<7)
303 MUIV_InputMode_Toggle, // 0xc0 (1<<7 | 1<<6)
308 enum {
309 MUIV_DragQuery_Refuse = 0,
310 MUIV_DragQuery_Accept,
313 enum {
314 MUIV_DragReport_Abort = 0,
315 MUIV_DragReport_Continue,
316 MUIV_DragReport_Lock,
317 MUIV_DragReport_Refresh,
320 #define MUIV_CreateBubble_DontHidePointer (1<<0)
322 /* A private functions and macros */
323 void __area_finish_minmax(Object *obj, struct MUI_MinMax *MinMaxInfo);
325 /*#define DRAW_BG_RECURSIVE (1<<1)*/
326 #define _vweight(obj) (muiAreaData(obj)->mad_VertWeight) /* accesses private members PRIV */
327 #define _hweight(obj) (muiAreaData(obj)->mad_HorizWeight) /* accesses private members PRIV */
329 extern const struct __MUIBuiltinClass _MUI_Area_desc; /* PRIV */
331 #endif /* _MUI_CLASSES_AREA_H */