Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / muimaster / classes / window.h
blob510fccb84e1d89d90e27991a8f576eaad1b5cb91
1 #ifndef _MUI_CLASSES_WINDOW_H
2 #define _MUI_CLASSES_WINDOW_H
4 /*
5 Copyright 1999, David Le Corfec.
6 Copyright 2002-2003, The AROS Development Team.
7 All rights reserved.
9 $Id$
12 /*** Name *******************************************************************/
13 #define MUIC_Window "Window.mui"
15 /*** Identifier base (for Zune extensions) **********************************/
16 #define MUIB_Window (MUIB_ZUNE | 0x00003600)
18 /*** Methods ****************************************************************/
19 #define MUIM_Window_ActionIconify (MUIB_MUI|0x00422cc0) /* MUI: V18 undoc*/
20 #define MUIM_Window_AddEventHandler (MUIB_MUI|0x004203b7) /* MUI: V16 */
21 #define MUIM_Window_Cleanup (MUIB_MUI|0x0042ab26) /* MUI: V18 undoc */ /* For custom classes only */
22 #define MUIM_Window_RemEventHandler (MUIB_MUI|0x0042679e) /* MUI: V16 */
23 #define MUIM_Window_ScreenToBack (MUIB_MUI|0x0042913d) /* MUI: V4 */
24 #define MUIM_Window_ScreenToFront (MUIB_MUI|0x004227a4) /* MUI: V4 */
25 #define MUIM_Window_Setup (MUIB_MUI|0x0042c34c) /* MUI: V18 undoc */ /* For custom Classes only */
26 #define MUIM_Window_Snapshot (MUIB_MUI|0x0042945e) /* MUI: V11 */
27 #define MUIM_Window_ToBack (MUIB_MUI|0x0042152e) /* MUI: V4 */
28 #define MUIM_Window_ToFront (MUIB_MUI|0x0042554f) /* MUI: V4 */
29 struct MUIP_Window_ActionIconify {STACKED ULONG MethodID;};
30 struct MUIP_Window_AddEventHandler {STACKED ULONG MethodID; STACKED struct MUI_EventHandlerNode *ehnode;};
31 struct MUIP_Window_Cleanup {STACKED ULONG MethodID;};
32 struct MUIP_Window_RemEventHandler {STACKED ULONG MethodID; STACKED struct MUI_EventHandlerNode *ehnode;};
33 struct MUIP_Window_ScreenToBack {STACKED ULONG MethodID;};
34 struct MUIP_Window_ScreenToFront {STACKED ULONG MethodID;};
35 struct MUIP_Window_Setup {STACKED ULONG MethodID;};
36 struct MUIP_Window_Snapshot {STACKED ULONG MethodID; STACKED LONG flags;};
37 struct MUIP_Window_ToBack {STACKED ULONG MethodID;};
38 struct MUIP_Window_ToFront {STACKED ULONG MethodID;};
40 #define MUIM_Window_AddControlCharHandler (MUIB_Window | 0x00000000) /* Zune: V1, PRIV don't use it! */
41 #define MUIM_Window_AllocGadgetID (MUIB_Window | 0x00000001) /* Zune: V1 - allocate a GadgetID for BOOPSI gadgets */
42 #define MUIM_Window_DrawBackground (MUIB_Window | 0x00000002) /* Zune: V1 - like MUIM_DrawBackground but PRIV */
43 #define MUIM_Window_DragObject (MUIB_Window | 0x00000003) /* Zune: V1, PRIV don't use it! */
44 #define MUIM_Window_FreeGadgetID (MUIB_Window | 0x00000004) /* Zune: V1 - free the GadgetID for BOOPSI gadgets */
45 #define MUIM_Window_RecalcDisplay (MUIB_Window | 0x00000005) /* Zune: V1, PRIV don't use it! */
46 #define MUIM_Window_RemControlCharHandler (MUIB_Window | 0x00000006) /* Zune: V1, PRIV don't use it! */
47 #define MUIM_Window_UpdateMenu (MUIB_Window | 0x00000007) /* Zune: V1, PRIV dont' use it! */
48 struct MUIP_Window_AddControlCharHandler { STACKED ULONG MethodID; STACKED struct MUI_EventHandlerNode *ccnode; };
49 struct MUIP_Window_AllocGadgetID { STACKED ULONG MethodID; }; /* Custom Class - returns the Gadget ID */
50 struct MUIP_Window_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;};
51 struct MUIP_Window_DragObject { STACKED ULONG MethodID; STACKED Object *obj; STACKED LONG touchx; STACKED LONG touchy; STACKED ULONG flags; };
52 struct MUIP_Window_FreeGadgetID { STACKED ULONG MethodID; STACKED LONG gadgetid; }; /* Custom Class */
53 struct MUIP_Window_RecalcDisplay { STACKED ULONG MethodID; STACKED Object *originator; };
54 struct MUIP_Window_RemControlCharHandler { STACKED ULONG MethodID; STACKED struct MUI_EventHandlerNode *ccnode; };
55 struct MUIP_Window_UpdateMenu { STACKED ULONG MethodID; };
57 #ifdef MUI_OBSOLETE
58 #define MUIM_Window_GetMenuCheck (MUIB_MUI|0x00420414) /* MUI: V4 */
59 #define MUIM_Window_GetMenuState (MUIB_MUI|0x00420d2f) /* MUI: V4 */
60 #define MUIM_Window_SetCycleChain (MUIB_MUI|0x00426510) /* MUI: V4 */
61 #define MUIM_Window_SetMenuCheck (MUIB_MUI|0x00422243) /* MUI: V4 */
62 #define MUIM_Window_SetMenuState (MUIB_MUI|0x00422b5e) /* MUI: V4 */
63 struct MUIP_Window_GetMenuCheck {STACKULONG MethodID; STACKED ULONG MenuID;};
64 struct MUIP_Window_GetMenuState {STACKULONG MethodID; STACKED ULONG MenuID;};
65 struct MUIP_Window_SetCycleChain {STACKULONG MethodID; STACKED Object *obj[1];};
66 struct MUIP_Window_SetMenuCheck {STACKULONG MethodID; STACKED ULONG MenuID; STACKED LONG stat;};
67 struct MUIP_Window_SetMenuState {STACKULONG MethodID; STACKED ULONG MenuID; STACKED LONG stat;};
68 #endif /* MUI_OBSOLETE */
70 /*** Attributes *************************************************************/
71 #define MUIA_Window_Activate (MUIB_MUI|0x00428d2f) /* MUI: V4 isg BOOL */
72 #define MUIA_Window_ActiveObject (MUIB_MUI|0x00427925) /* MUI: V4 .sg Object * */
73 #define MUIA_Window_AltHeight (MUIB_MUI|0x0042cce3) /* MUI: V4 i.g LONG */
74 #define MUIA_Window_AltLeftEdge (MUIB_MUI|0x00422d65) /* MUI: V4 i.g LONG */
75 #define MUIA_Window_AltTopEdge (MUIB_MUI|0x0042e99b) /* MUI: V4 i.g LONG */
76 #define MUIA_Window_AltWidth (MUIB_MUI|0x004260f4) /* MUI: V4 i.g LONG */
77 #define MUIA_Window_AppWindow (MUIB_MUI|0x004280cf) /* MUI: V5 i.. BOOL */
78 #define MUIA_Window_Backdrop (MUIB_MUI|0x0042c0bb) /* MUI: V4 i.. BOOL */
79 #define MUIA_Window_Borderless (MUIB_MUI|0x00429b79) /* MUI: V4 i.. BOOL */
80 #define MUIA_Window_CloseGadget (MUIB_MUI|0x0042a110) /* MUI: V4 i.. BOOL */
81 #define MUIA_Window_CloseRequest (MUIB_MUI|0x0042e86e) /* MUI: V4 ..g BOOL */
82 #define MUIA_Window_DefaultObject (MUIB_MUI|0x004294d7) /* MUI: V4 isg Object * */
83 #define MUIA_Window_DepthGadget (MUIB_MUI|0x00421923) /* MUI: V4 i.. BOOL */
84 #define MUIA_Window_DisableKeys (MUIB_MUI|0x00424c36) /* MUI: V15 isg ULONG */ /* undoc */
85 #define MUIA_Window_DragBar (MUIB_MUI|0x0042045d) /* MUI: V4 i.. BOOL */
86 #define MUIA_Window_FancyDrawing (MUIB_MUI|0x0042bd0e) /* MUI: V8 isg BOOL */
87 #define MUIA_Window_Height (MUIB_MUI|0x00425846) /* MUI: V4 i.g LONG */
88 #define MUIA_Window_ID (MUIB_MUI|0x004201bd) /* MUI: V4 isg ULONG */
89 #define MUIA_Window_InputEvent (MUIB_MUI|0x004247d8) /* MUI: V4 ..g struct InputEvent * */
90 #define MUIA_Window_IsSubWindow (MUIB_MUI|0x0042b5aa) /* MUI: V4 isg BOOL */
91 #define MUIA_Window_LeftEdge (MUIB_MUI|0x00426c65) /* MUI: V4 i.g LONG */
92 #define MUIA_Window_MenuAction (MUIB_MUI|0x00427521) /* MUI: V8 isg ULONG */
93 #define MUIA_Window_Menustrip (MUIB_MUI|0x0042855e) /* MUI: V8 i.g Object * */
94 #define MUIA_Window_MouseObject (MUIB_MUI|0x0042bf9b) /* MUI: V10 ..g Object * */
95 #define MUIA_Window_NeedsMouseObject (MUIB_MUI|0x0042372a) /* MUI: V10 i.. BOOL */
96 #define MUIA_Window_NoMenus (MUIB_MUI|0x00429df5) /* MUI: V4 is. BOOL */
97 #define MUIA_Window_Open (MUIB_MUI|0x00428aa0) /* MUI: V4 .sg BOOL */
98 #define MUIA_Window_PublicScreen (MUIB_MUI|0x004278e4) /* MUI: V6 isg STRPTR */
99 #define MUIA_Window_RefWindow (MUIB_MUI|0x004201f4) /* MUI: V4 is. Object * */
100 #define MUIA_Window_RootObject (MUIB_MUI|0x0042cba5) /* MUI: V4 isg Object * */
101 #define MUIA_Window_Screen (MUIB_MUI|0x0042df4f) /* MUI: V4 isg struct Screen * */
102 #define MUIA_Window_ScreenTitle (MUIB_MUI|0x004234b0) /* MUI: V5 isg STRPTR */
103 #define MUIA_Window_SizeGadget (MUIB_MUI|0x0042e33d) /* MUI: V4 i.. BOOL */
104 #define MUIA_Window_SizeRight (MUIB_MUI|0x00424780) /* MUI: V4 i.. BOOL */
105 #define MUIA_Window_Sleep (MUIB_MUI|0x0042e7db) /* MUI: V4 .sg BOOL */
106 #define MUIA_Window_Title (MUIB_MUI|0x0042ad3d) /* MUI: V4 isg STRPTR */
107 #define MUIA_Window_TopEdge (MUIB_MUI|0x00427c66) /* MUI: V4 i.g LONG */
108 #define MUIA_Window_UseBottomBorderScroller (MUIB_MUI|0x00424e79) /* MUI: V13 isg BOOL */
109 #define MUIA_Window_UseLeftBorderScroller (MUIB_MUI|0x0042433e) /* MUI: V13 isg BOOL */
110 #define MUIA_Window_UseRightBorderScroller (MUIB_MUI|0x0042c05e) /* MUI: V13 isg BOOL */
111 #define MUIA_Window_Width (MUIB_MUI|0x0042dcae) /* MUI: V4 i.g LONG */
112 #define MUIA_Window_Window (MUIB_MUI|0x00426a42) /* MUI: V4 ..g struct Window * */
114 #define MUIA_Window_EraseArea (MUIB_Window | 0x00000000) /* Zune only i.. BOOL (default: TRUE) */
115 #define MUIA_Window_ZoomGadget (MUIB_Window | 0x00000002)
116 #define MUIA_Window_ToolBox (MUIB_Window | 0x00000003)
118 #define MUIV_Window_ActiveObject_None 0
119 #define MUIV_Window_ActiveObject_Next (-1)
120 #define MUIV_Window_ActiveObject_Prev (-2)
121 #define MUIV_Window_AltHeight_MinMax(p) (0-(p))
122 #define MUIV_Window_AltHeight_Visible(p) (-100-(p))
123 #define MUIV_Window_AltHeight_Screen(p) (-200-(p))
124 #define MUIV_Window_AltHeight_Scaled (-1000)
125 #define MUIV_Window_AltLeftEdge_Centered (-1)
126 #define MUIV_Window_AltLeftEdge_Moused (-2)
127 #define MUIV_Window_AltLeftEdge_NoChange (-1000)
128 #define MUIV_Window_AltTopEdge_Centered (-1)
129 #define MUIV_Window_AltTopEdge_Moused (-2)
130 #define MUIV_Window_AltTopEdge_Delta(p) (-3-(p))
131 #define MUIV_Window_AltTopEdge_NoChange (-1000)
132 #define MUIV_Window_AltWidth_MinMax(p) (0-(p))
133 #define MUIV_Window_AltWidth_Visible(p) (-100-(p))
134 #define MUIV_Window_AltWidth_Screen(p) (-200-(p))
135 #define MUIV_Window_AltWidth_Scaled (-1000)
136 #define MUIV_Window_Height_MinMax(p) (0-(p))
137 #define MUIV_Window_Height_Visible(p) (-100-(p))
138 #define MUIV_Window_Height_Screen(p) (-200-(p))
139 #define MUIV_Window_Height_Scaled (-1000)
140 #define MUIV_Window_Height_Default (-1001)
141 #define MUIV_Window_LeftEdge_Centered (-1)
142 #define MUIV_Window_LeftEdge_Moused (-2)
143 #define MUIV_Window_TopEdge_Centered (-1)
144 #define MUIV_Window_TopEdge_Moused (-2)
145 #define MUIV_Window_TopEdge_Delta(p) (-3-(p))
146 #define MUIV_Window_Width_MinMax(p) (0-(p))
147 #define MUIV_Window_Width_Visible(p) (-100-(p))
148 #define MUIV_Window_Width_Screen(p) (-200-(p))
149 #define MUIV_Window_Width_Scaled (-1000)
150 #define MUIV_Window_Width_Default (-1001)
152 #define MUIV_Window_Button_MUI 1
153 #define MUIV_Window_Button_Snapshot 2
154 #define MUIV_Window_Button_Iconify 4
155 #define MUIV_Window_Button_Popup 8
158 #ifdef MUI_OBSOLETE
159 #define MUIA_Window_Menu (MUIB_MUI|0x0042db94) /* MUI: V4 i.. struct NewMenu * */
160 #define MUIV_Window_Menu_NoMenu (-1)
161 #endif /* MUI_OBSOLETE */
163 /* Forward declaration for application opaque custom frame specification */
164 struct dt_frame_image;
166 /**************************************************************************
167 Info about the display environment on which all Area Objects have a
168 reference to it.
169 **************************************************************************/
171 #define MRI_RARRAY_SIZE 20
173 struct MUI_RenderInfo
175 Object *mri_WindowObject; /* accessable inbetween MUIM_Setup/MUIM_Cleanup */
176 struct Screen *mri_Screen; /* accessable inbetween MUIM_Setup/MUIM_Cleanup */
177 struct DrawInfo *mri_DrawInfo; /* accessable inbetween MUIM_Setup/MUIM_Cleanup */
178 UWORD *mri_Pens; /* accessable inbetween MUIM_Setup/MUIM_Cleanup */
179 struct Window *mri_Window; /* accessable inbetween MUIM_Show/MUIM_Hide */
180 struct RastPort *mri_RastPort; /* accessable inbetween MUIM_Show/MUIM_Hide */
181 ULONG mri_Flags; /* accessable inbetween MUIM_Setup/MUIM_Cleanup */
183 /* the following stuff is private */
184 struct ColorMap *mri_Colormap;
185 UWORD mri_ScreenWidth;
186 UWORD mri_ScreenHeight;
187 UWORD mri_PensStorage[MPEN_COUNT]; /* storage for pens, mri_Pens point to here */
189 struct TextFont *mri_Fonts[-MUIV_Font_NegCount]; /* Opened text fonts, done by zune_get_font() */
191 /* this is for AddClipping/AddClipRegion */
192 struct Region *mri_rArray[MRI_RARRAY_SIZE];
193 int mri_rCount;
195 struct Rectangle mri_ClipRect;
197 UWORD mri_BorderTop; /* The height of the windows top border (the title) */
198 UWORD mri_BorderBottom; /* The height of the windows bottom bodder */
199 UWORD mri_BorderLeft; /* The width of the windows left border */
200 UWORD mri_BorderRight; /* The width of the windows right border */
202 /* Stuff for Borderscrollers */
203 Object *mri_LeftImage; /* Valid between MUIM_Setup/MUIM_Cleanup */
204 Object *mri_RightImage;
205 Object *mri_UpImage;
206 Object *mri_DownImage;
207 Object *mri_SizeImage;
209 Object *mri_VertProp; /* Valid between MUIM_Show/MUIM_Hide */
210 Object *mri_HorizProp;
212 /* buffering */
213 struct RastPort mri_BufferRP;
214 struct BitMap *mri_BufferBM;
216 struct dt_frame_image *mri_FrameImage[16];
219 #define MUIMRI_RECTFILL (1<<0)
220 #define MUIMRI_TRUECOLOR (1<<1)
221 #define MUIMRI_THINFRAMES (1<<2)
222 #define MUIMRI_REFRESHMODE (1<<3)
224 /**************************************************************************
225 MUI_EventHandlerNode as used by
226 MUIM_Window_AddEventHandler/RemoveEventHandler
227 **************************************************************************/
228 #ifdef __AROS__
229 #if !(AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT)
230 /* AROS Nodes are not necessarily binary compatible with AOS ones, so
231 * the (MUI_EventHandlerNode *) -> (Node *) cast hack doesnt work.
233 struct MUI_EventHandlerNode
235 struct Node ehn_Node; /* embedded node structure, private! */
236 UWORD ehn_Flags; /* some flags, see below */
237 Object *ehn_Object; /* object which should receive MUIM_HandleEvent. */
238 struct IClass *ehn_Class; /* Class for CoerceMethod(). If NULL DoMethod() is used */
239 ULONG ehn_Events; /* the IDCMP flags the handler should be invoked. */
240 BYTE ehn_Priority; /* sorted by priority. */
242 #define MUI_EVENTHANDLERNODE_DEFINED
243 #endif
244 #endif
246 #ifndef MUI_EVENTHANDLERNODE_DEFINED
247 struct MUI_EventHandlerNode
249 struct MinNode ehn_Node; /* embedded node structure, private! */
250 BYTE ehn_Reserved; /* private! */
251 BYTE ehn_Priority; /* sorted by priority. */
252 UWORD ehn_Flags; /* some flags, see below */
253 Object *ehn_Object; /* object which should receive MUIM_HandleEvent. */
254 struct IClass *ehn_Class; /* Class for CoerceMethod(). If NULL DoMethod() is used */
255 ULONG ehn_Events; /* the IDCMP flags the handler should be invoked. */
257 #endif
259 #undef MUI_EVENTHANDLERNODE_DEFINED
261 /* here are the flags for ehn_Flags */
262 #define MUI_EHF_ALWAYSKEYS (1<<0)
263 #define MUI_EHF_GUIMODE (1<<1) /* handler will not be called if object is not visible or disabled */
264 #define MUI_EHF_HANDLEINPUT (1<<15) /* ZUNEPRIV: Send MUIM_HandleInput instead of MUIM_HandleEvent */
266 /* MUIM_HandleEvent must return a bitmask where following bit's can be set (all other must be 0) */
267 #define MUI_EventHandlerRC_Eat (1<<0) /* do not invoke more handlers ers */
270 extern const struct __MUIBuiltinClass _MUI_Window_desc; /* PRIV */
272 #endif /* _MUI_CLASSES_WINDOW_H */