Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / asl / asl_intern.h
blob155e1c875255cec135fffed52064b16c13a91341
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English.
7 */
9 #ifndef ASL_INTERN_H
10 #define ASL_INTERN_H
14 #ifndef EXEC_TYPES_H
15 # include <exec/types.h>
16 #endif
18 #ifndef EXEC_LIBRARIES_H
19 # include <exec/libraries.h>
20 #endif
22 #ifndef INTUITION_INTUITIONBASE_H
23 # include <intuition/intuitionbase.h>
24 #endif
26 #ifndef INTUITION_CLASSES_H
27 # include <intuition/classes.h>
28 #endif
30 #ifndef INTUITION_SGHOOKS_H
31 # include <intuition/sghooks.h>
32 #endif
34 #ifndef LIBRARIES_ASL_H
35 # include <libraries/asl.h>
36 #endif
38 #ifndef LIBRARIES_LOCALE_H
39 # include <libraries/locale.h>
40 #endif
42 #ifndef UTILITY_HOOKS_H
43 # include <utility/hooks.h>
44 #endif
46 #ifndef LAYOUT_H
47 # include "layout.h"
48 #endif
50 #include <dos/dos.h>
52 #ifndef AROS_ASMCALL_H
53 # include <aros/asmcall.h>
54 #endif
55 #include <aros/libcall.h>
57 /*****************************************************************************************/
59 #ifdef __MORPHOS__
60 #define USE_SHARED_COOLIMAGES 0
61 #else
62 #define USE_SHARED_COOLIMAGES 1
63 #endif
65 #define AVOID_FLICKER 1
67 /*****************************************************************************************/
69 // #define TURN_OFF_DEBUG
71 /* Predeclaration */
72 struct AslBase_intern;
75 /* Internal requester structure */
76 struct IntReq
78 UWORD ir_ReqType;
79 struct Window *ir_Window;
80 struct Screen *ir_Screen;
81 STRPTR ir_PubScreenName;
82 struct Hook *ir_IntuiMsgFunc;
83 struct TextAttr *ir_TextAttr;
84 struct Locale *ir_Locale;
85 struct Catalog *ir_Catalog;
86 APTR ir_MemPool;
87 ULONG ir_MemPoolPuddle; /* if 0, no pool is created */
88 ULONG ir_MemPoolThresh;
89 LONG ir_TitleID;
90 STRPTR ir_TitleText;
91 STRPTR ir_PositiveText;
92 STRPTR ir_NegativeText;
93 WORD ir_LeftEdge;
94 WORD ir_TopEdge;
95 WORD ir_Width;
96 WORD ir_Height;
97 UBYTE ir_Flags;
99 APTR ir_BasePtr; /* Compatability: Saved copy of REG_A4 */
102 /* Nodes in the ReqList */
103 struct ReqNode
105 struct MinNode rn_Node;
106 APTR rn_Req;
107 struct IntReq *rn_IntReq;
108 struct Window *rn_ReqWindow;
111 /*****************************************************************************************/
113 /* Internal filerequester struct */
115 struct IntFileReq
117 struct IntReq ifr_IntReq;
119 STRPTR ifr_File;
120 STRPTR ifr_Drawer;
121 STRPTR ifr_Pattern;
122 STRPTR ifr_AcceptPattern;
123 STRPTR ifr_RejectPattern;
124 UBYTE ifr_Flags1;
125 UBYTE ifr_Flags2;
126 struct Hook *ifr_FilterFunc;
128 #ifdef __MORPHOS__
129 APTR ifr_HookFunc;
130 #else
131 ULONG (*ifr_HookFunc)(ULONG mask, APTR object, struct FileRequester *fr);
132 #endif
133 /* ASLFR_HookFunc = Combined callback function */
135 ULONG *ifr_GetSortBy;
136 ULONG *ifr_GetSortOrder;
137 ULONG *ifr_GetSortDrawers;
138 UWORD ifr_SortBy;
139 UWORD ifr_SortOrder;
140 UWORD ifr_SortDrawers;
141 BOOL ifr_InitialShowVolumes;
144 /*****************************************************************************************/
146 struct IntFontReq
148 struct IntReq ifo_IntReq;
149 struct TextAttr ifo_TextAttr;
150 UBYTE ifo_FrontPen;
151 UBYTE ifo_BackPen;
152 UBYTE ifo_DrawMode;
154 UBYTE ifo_Flags;
155 UWORD ifo_MinHeight;
156 UWORD ifo_MaxHeight;
157 struct Hook *ifo_FilterFunc;
159 #ifdef __MORPHOS__
160 APTR ifo_HookFunc;
161 #else
162 ULONG (*ifo_HookFunc)(ULONG, APTR, struct FontRequester *);
163 #endif
165 UWORD ifo_MaxFrontPen;
166 UWORD ifo_MaxBackPen;
168 STRPTR *ifo_ModeList;
169 STRPTR ifo_SampleText;
170 UBYTE *ifo_FrontPens;
171 UBYTE *ifo_BackPens;
173 STRPTR ifo_DrawModeJAM1Text;
174 STRPTR ifo_DrawModeJAM2Text;
175 STRPTR ifo_DrawModeCOMPText;
176 STRPTR ifo_DrawMode0Text;
179 /*****************************************************************************************/
181 #define ISMF_DOAUTOSCROLL 1
182 #define ISMF_DODEPTH 2
183 #define ISMF_DOHEIGHT 4
184 #define ISMF_DOWIDTH 8
185 #define ISMF_DOOVERSCAN 16
187 /*****************************************************************************************/
189 struct IntSMReq
191 struct IntReq ism_IntReq;
192 struct List *ism_CustomSMList;
193 struct Hook *ism_FilterFunc;
194 ULONG ism_Flags;
195 ULONG ism_DisplayID;
196 ULONG ism_DisplayWidth;
197 ULONG ism_DisplayHeight;
198 ULONG ism_BitMapWidth;
199 ULONG ism_BitMapHeight;
200 UWORD ism_DisplayDepth;
201 UWORD ism_OverscanType;
202 BOOL ism_AutoScroll;
203 ULONG ism_PropertyFlags;
204 ULONG ism_PropertyMask;
205 LONG ism_MinDepth;
206 LONG ism_MaxDepth;
207 LONG ism_MinWidth;
208 LONG ism_MaxWidth;
209 LONG ism_MinHeight;
210 LONG ism_MaxHeight;
211 LONG ism_InfoLeftEdge;
212 LONG ism_InfoTopEdge;
213 BOOL ism_InfoOpened;
215 STRPTR ism_Overscan1Text;
216 STRPTR ism_Overscan2Text;
217 STRPTR ism_Overscan3Text;
218 STRPTR ism_Overscan4Text;
219 STRPTR ism_OverscanNullText;
220 STRPTR ism_AutoScrollOFFText;
221 STRPTR ism_AutoScrollONText;
222 STRPTR ism_AutoScroll0Text;
224 STRPTR ism_PropertyList_Title;
225 STRPTR ism_PropertyList_NotWB;
226 STRPTR ism_PropertyList_NotGenlock;
227 STRPTR ism_PropertyList_NotDraggable;
228 STRPTR ism_PropertyList_HAM;
229 STRPTR ism_PropertyList_EHB;
230 STRPTR ism_PropertyList_Interlace;
231 STRPTR ism_PropertyList_ECS;
232 STRPTR ism_PropertyList_WB;
233 STRPTR ism_PropertyList_Genlock;
234 STRPTR ism_PropertyList_Draggable;
235 STRPTR ism_PropertyList_DPFPri2;
236 STRPTR ism_PropertyList_RefreshRate;
239 #define SREQ_FIRST_PROPERTY_ITEM(x) ((x)->ism_PropertyList_NotWB)
240 #define SREQ_LAST_PROPERTY_ITEM(x) ((x)->ism_PropertyList_RefreshRate)
242 /*****************************************************************************************/
244 /* structure for passing arguments to tag parsing hooks */
245 struct ParseTagArgs
247 struct IntReq *pta_IntReq;
248 APTR pta_Req;
249 struct TagItem *pta_Tags;
252 struct AslReqInfo
254 ULONG IntReqSize;
255 ULONG ReqSize;
256 APTR DefaultReq;
257 /* Size of userdata for GadgetryHook and EventHook */
258 ULONG UserDataSize;
259 struct Hook ParseTagsHook;
260 struct Hook GadgetryHook;
263 /*****************************************************************************************/
265 /* Flags */
267 #define IF_PRIVATEIDCMP (1 << 0)
268 #define IF_SLEEPWINDOW (1 << 1)
269 #define IF_USER_POSTEXT (1 << 2)
270 #define IF_USER_NEGTEXT (1 << 3)
271 #define IF_POPTOFRONT (1 << 4)
272 #define IF_POPPEDTOFRONT (1 << 5)
273 #define IF_OPENINACTIVE (1 << 6)
275 #define GetIR(ir) ((struct IntReq *)ir)
277 struct AslBase_intern
279 struct Library Lib;
280 struct MinList ReqList;
281 struct SignalSemaphore ReqListSem;
282 struct AslReqInfo ReqInfo[3];
283 Class *aslpropclass;
284 Class *aslarrowclass;
285 Class *asllistviewclass;
286 Class *aslbuttonclass;
287 Class *aslstringclass;
288 Class *aslcycleclass;
289 Class *aslfontpreviewclass;
290 Class *aslfontstyleclass;
291 Class *aslcolorpickerclass;
292 Class *asleraserclass;
295 /*****************************************************************************************/
297 /* Prototypes */
299 /* basicfuncs.c */
301 struct ReqNode *FindReqNode(APTR, struct AslBase_intern *);
302 VOID ParseCommonTags(struct IntReq *, struct TagItem *, struct AslBase_intern *);
303 UWORD BiggestTextLength(STRPTR *, UWORD, struct RastPort *, struct AslBase_intern *);
304 VOID StripRequester(APTR, UWORD, struct AslBase_intern *AslBase);
306 WORD CountNodes(struct List *list, WORD flag);
307 struct Node *FindListNode(struct List *list, WORD which);
308 void SortInNode(APTR req, struct List *list, struct Node *node,
309 WORD (*compare)(APTR, APTR, APTR, struct AslBase_intern *),
310 struct AslBase_intern *AslBase);
312 APTR MyAllocVecPooled(APTR pool, IPTR size, struct AslBase_intern *AslBase);
313 void MyFreeVecPooled(APTR mem, struct AslBase_intern *AslBase);
314 char *PooledCloneString(const char *name1, const char *name2, APTR pool,
315 struct AslBase_intern *AslBase);
316 char *PooledCloneStringLen(const char *name1, ULONG len1, const char *name2, ULONG len2, APTR pool,
317 struct AslBase_intern *AslBase);
318 char *VecCloneString(const char *name1, const char *name2, struct AslBase_intern *AslBase);
319 char *VecPooledCloneString(const char *name1, const char *name2, APTR pool,
320 struct AslBase_intern *AslBase);
321 char *PooledUIntegerToString(IPTR value, APTR pool, struct AslBase_intern *AslBase);
322 void CloseWindowSafely(struct Window *window, struct AslBase_intern *AslBase);
324 AROS_UFP3(ULONG, StringEditFunc,
325 AROS_UFPA(struct Hook *, hook, A0),
326 AROS_UFPA(struct SGWork *, sgw, A2),
327 AROS_UFPA(ULONG *, command, A1));
329 void PaintInnerFrame(struct RastPort *rp, struct DrawInfo *dri, Object *frameobj,
330 struct IBox *framebox, struct IBox *innerbox, ULONG pen,
331 struct AslBase_intern *AslBase);
332 void PaintBoxFrame(struct RastPort *rp, struct IBox *outerbox, struct IBox *innerbox,
333 ULONG pen, struct AslBase_intern *AslBase);
335 /* gadgets.c */
337 BOOL makescrollergadget(struct ScrollerGadget *scrollergad, struct LayoutData *ld,
338 struct TagItem *tags, struct AslBase_intern *AslBase);
339 void killscrollergadget(struct ScrollerGadget *scrollergad, struct AslBase_intern *AslBase);
340 void getgadgetcoords(struct Gadget *gad, struct GadgetInfo *gi, WORD *x, WORD *y, WORD *w, WORD *h);
341 void getgadgetbounds(struct Gadget *gad, struct GadgetInfo *gi, WORD *x, WORD *y, WORD *w, WORD *h);
343 void connectscrollerandlistview(struct ScrollerGadget *scrollergad, Object *listview,
344 struct AslBase_intern *AslBase);
345 void FreeObjects(Object **first, Object **last, struct AslBase_intern *AslBase);
347 /* locale.c */
349 STRPTR GetString(LONG id, struct Catalog *catalog, struct AslBase_intern *AslBase);
350 void LocalizeMenus(struct NewMenu *nm, struct Catalog *catalog, struct AslBase_intern *AslBase);
352 /*****************************************************************************************/
355 AROS_UFP3(VOID, FRTagHook,
356 AROS_UFPA(struct Hook *, hook, A0),
357 AROS_UFPA(struct ParseTagArgs *, pta, A2),
358 AROS_UFPA(struct AslBase_intern *, AslBase, A1)
361 AROS_UFP3(ULONG, FRGadgetryHook,
362 AROS_UFPA(struct Hook *, hook, A0),
363 AROS_UFPA(struct LayoutData *, ld, A2),
364 AROS_UFPA(struct AslBase_intern *, AslBase, A1)
367 AROS_UFP3(VOID, FOTagHook,
368 AROS_UFPA(struct Hook *, hook, A0),
369 AROS_UFPA(struct ParseTagArgs *, pta, A2),
370 AROS_UFPA(struct AslBase_intern *, AslBase, A1)
373 AROS_UFP3(ULONG, FOGadgetryHook,
374 AROS_UFPA(struct Hook *, hook, A0),
375 AROS_UFPA(struct LayoutData *, ld, A2),
376 AROS_UFPA(struct AslBase_intern *, AslBase, A1)
379 AROS_UFP3(VOID, SMTagHook,
380 AROS_UFPA(struct Hook *, hook, A0),
381 AROS_UFPA(struct ParseTagArgs *, pta, A2),
382 AROS_UFPA(struct AslBase_intern *, AslBase, A1)
385 AROS_UFP3(ULONG, SMGadgetryHook,
386 AROS_UFPA(struct Hook *, hook, A0),
387 AROS_UFPA(struct LayoutData *, ld, A2),
388 AROS_UFPA(struct AslBase_intern *, AslBase, A1)
391 /*****************************************************************************************/
393 /* Return values for the gadgetry hooks */
394 #define GHRET_FINISHED_OK 2
395 #define GHRET_OK 1
396 #define GHRET_FAIL 0
398 /* Handy macros */
399 #define SETFLAG(flagvar, boolvar, flag) \
400 if (boolvar) \
401 flagvar |= flag; \
402 else \
403 flagvar &= ~flag;
406 /*****************************************************************************************/
408 #undef ASLB
409 #define ASLB(b) ((struct AslBase_intern *)b)
411 /*****************************************************************************************/
413 /* Private for asl internal classes */
415 /* AslProp class */
416 struct AslPropData
418 Object *frame;
419 LONG deltafactor;
422 /* AslArrow class */
423 struct AslArrowData
425 WORD scrollticker;
428 /* AslListView class */
429 struct AslListViewData
431 Object *frame;
432 struct LayoutData *ld;
433 struct List *labels;
434 struct Node **nodetable;
435 struct List emptylist;
436 struct Hook default_renderhook;
437 struct Hook *renderhook;
438 struct TextFont *font;
439 struct Rectangle *renderrect;
440 ULONG clicksec;
441 ULONG clickmicro;
442 WORD minx;
443 WORD miny;
444 WORD maxx;
445 WORD maxy;
446 WORD width;
447 WORD height;
448 WORD itemheight;
449 WORD spacing;
450 LONG lineheight;
451 LONG visible;
452 LONG top;
453 LONG total;
454 LONG active;
455 LONG visiblepixels;
456 LONG toppixel;
457 LONG totalpixels;
458 WORD rendersingleitem;
459 WORD scroll;
460 BYTE layouted;
461 BYTE doubleclicked;
462 BYTE dosavemode;
463 BYTE domultiselect;
464 BYTE multiselecting;
465 BYTE readonly;
468 /* AslButton class */
469 struct AslButtonData
471 Object *frame;
472 struct LayoutData *ld;
473 struct CoolImage *coolimage;
474 ULONG *coolimagepal;
477 #define BUTTON_OWN_INPUT_HANDLING 1
478 #if BUTTON_OWN_INPUT_HANDLING
479 #define BUTTONSUPERCLASS GADGETCLASS
480 #else
481 #define BUTTONSUPERCLASS BUTTONGCLASS
482 #endif
484 /* AslString class */
485 struct AslStringData
487 Object *frame;
490 /* AslCycle class */
491 struct CycleItem
493 char *string;
494 WORD charlen;
495 WORD pixellen;
498 struct AslCycleData
500 Object *frame;
501 struct CycleItem *itemmemory;
502 struct RastPort *rp;
503 struct RastPort clonerp;
504 struct DrawInfo *dri;
505 struct TextFont *font;
506 struct Window *popupwindow;
507 char **labels;
508 WORD itemheight;
509 WORD itemwidth;
510 WORD menuleft;
511 WORD menutop;
512 WORD menuwidth;
513 WORD menuheight;
514 WORD numitems;
515 WORD active;
516 WORD visible;
517 WORD top;
518 WORD selected;
519 WORD menux1;
520 WORD menuy1;
521 WORD menux2;
522 WORD menuy2;
523 WORD layerx1;
524 WORD layery1;
525 WORD layerx2;
526 WORD layery2;
527 BYTE borderleft;
528 BYTE borderright;
529 BYTE bordertop;
530 BYTE borderbottom;
531 BYTE maypopup;
532 BYTE popup;
533 BYTE popupwindowtype;
534 BYTE uparrowblack;
535 BYTE downarrowblack;
536 BYTE sentgadgetup;
537 BYTE turbocountdown;
540 /* AslFontPreview class */
541 struct AslFontPreviewData
543 Object *frame;
544 struct TextFont *font;
545 STRPTR previewtext;
546 UBYTE apen, bpen, drawstyle;
549 /* ASlFontStyle class */
550 struct AslFontStyleData
552 Object *frame;
553 STRPTR text[3];
554 UBYTE style;
557 /* AslColorPicker class */
558 struct AslColorPickerData
560 Object *frame;
561 struct Window *popupwindow;
562 struct RastPort *rp;
563 UBYTE *colortable;
564 WORD numcolors;
565 WORD color;
566 WORD selected;
567 WORD menuwidth;
568 WORD menuheight;
569 WORD menux1;
570 WORD menuy1;
571 WORD menux2;
572 WORD menuy2;
573 WORD layerx1;
574 WORD layery1;
575 WORD layerx2;
576 WORD layery2;
577 WORD columns;
578 WORD rows;
579 WORD cellwidth;
580 WORD cellheight;
581 WORD cellspacex;
582 WORD cellspacey;
583 WORD borderleft;
584 WORD bordertop;
585 WORD borderright;
586 WORD borderbottom;
587 BYTE sentgadgetup;
591 #endif /* ASL_INTERN_H */