Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / gadtools / gadtools_intern.h
blob0d72fc98a0d08eb3224aab2bf15caad305737dd4
1 #ifndef GADTOOLS_INTERN_H
2 #define GADTOOLS_INTERN_H
4 /*
5 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: Internal definitions for gadtools.library.
9 Lang: english
12 #ifndef EXEC_LIBRARIES_H
13 # include <exec/libraries.h>
14 #endif
15 #ifndef EXEC_SEMAPHORES_H
16 # include <exec/semaphores.h>
17 #endif
18 #ifndef DOS_DOS_H
19 # include <dos/dos.h>
20 #endif
21 #ifndef PROTO_GRAPHICS_H
22 # include <proto/graphics.h>
23 #endif
24 #ifndef GRAPHICS_GFXBASE_H
25 # include <graphics/gfxbase.h>
26 #endif
27 #ifndef PROTO_INTUITION_H
28 # include <proto/intuition.h>
29 #endif
30 #ifndef INTUITION_CLASSES_H
31 # include <intuition/classes.h>
32 #endif
33 #ifndef INTUITION_INTUITIONBASE_H
34 # include <intuition/intuitionbase.h>
35 #endif
36 #ifndef INTUITION_SCREENS_H
37 # include <intuition/screens.h>
38 #endif
39 #ifndef PROTO_UTILITY_H
40 # include <proto/utility.h>
41 #endif
42 #ifndef LIBRARIES_GADTOOLS_H
43 # include <libraries/gadtools.h>
44 #endif
45 #ifndef GADGETS_AROSMX_H
46 # include <gadgets/arosmx.h>
47 #endif
49 /* Needed for aros_print_not_implemented macro */
50 #include <aros/debug.h>
51 #include <aros/libcall.h>
52 #include <aros/asmcall.h>
54 /****************************************************************************************/
56 struct VisualInfo;
58 /* Some external stuff (gadtools_init.c) */
59 struct GadToolsBase_intern; /* prerefrence */
61 /* Internal prototypes */
62 struct IntuiText *makeitext(struct GadToolsBase_intern *GadToolsBase,
63 struct NewGadget *ng,
64 struct TagItem *taglist);
65 void freeitext(struct GadToolsBase_intern *GadToolsBase,
66 struct IntuiText *itext);
68 BOOL renderlabel(struct GadToolsBase_intern *GadToolsBase,
69 struct Gadget *gad, struct RastPort *rport, LONG labelplace);
70 void DoDisabledPattern(struct RastPort *rp, WORD x1, WORD y1, WORD x2, WORD y2,
71 WORD pen, struct GadToolsBase_intern *GadToolsBase);
73 /****************************************************************************************/
75 struct Gadget *makebutton(struct GadToolsBase_intern *GadToolsBase,
76 struct TagItem stdgadtags[],
77 struct VisualInfo *vi,
78 struct TagItem *taglist);
80 struct Gadget *makecheckbox(struct GadToolsBase_intern *GadToolsBase,
81 struct TagItem stdgadtags[],
82 struct VisualInfo *vi,
83 struct TagItem *taglist);
85 struct Gadget *makecycle(struct GadToolsBase_intern *GadToolsBase,
86 struct TagItem stdgadtags[],
87 struct VisualInfo *vi,
88 struct TextAttr *tattr,
89 struct TagItem *taglist);
91 struct Gadget *makemx(struct GadToolsBase_intern *GadToolsBase,
92 struct TagItem stdgadtags[],
93 struct VisualInfo *vi,
94 struct TextAttr *tattr,
95 struct TagItem *taglist);
97 struct Gadget *makepalette(struct GadToolsBase_intern *GadToolsBase,
98 struct TagItem stdgadtags[],
99 struct VisualInfo *vi,
100 const struct TagItem *taglist);
102 struct Gadget *maketext(struct GadToolsBase_intern *GadToolsBase,
103 struct TagItem stdgadtags[],
104 struct VisualInfo *vi,
105 struct TextAttr *tattr,
106 const struct TagItem *taglist);
108 struct Gadget *makenumber(struct GadToolsBase_intern *GadToolsBase,
109 struct TagItem stdgadtags[],
110 struct VisualInfo *vi,
111 struct TextAttr *tattr,
112 const struct TagItem *taglist);
115 struct Gadget *makeslider(struct GadToolsBase_intern *GadToolsBase,
116 struct TagItem stdgadtags[],
117 struct VisualInfo *vi,
118 struct TextAttr *tattr,
119 const struct TagItem *taglist);
121 struct Gadget *makescroller(struct GadToolsBase_intern *GadToolsBase,
122 struct TagItem stdgadtags[],
123 struct VisualInfo *vi,
124 const struct TagItem *taglist);
126 struct Gadget *makestring(struct GadToolsBase_intern *GadToolsBase,
127 struct TagItem stdgadtags[],
128 struct VisualInfo *vi,
129 struct TextAttr *tattr,
130 const struct TagItem *taglist);
132 struct Gadget *makeinteger(struct GadToolsBase_intern *GadToolsBase,
133 struct TagItem stdgadtags[],
134 struct VisualInfo *vi,
135 struct TextAttr *tattr,
136 const struct TagItem *taglist);
138 struct Gadget *makelistview(struct GadToolsBase_intern *GadToolsBase,
139 struct TagItem stdgadtags[],
140 struct VisualInfo *vi,
141 struct TextAttr *tattr,
142 const struct TagItem *taglist);
144 struct Gadget *makegeneric(struct GadToolsBase_intern *GadToolsBase,
145 struct TagItem stdgadtags[],
146 struct VisualInfo *vi,
147 struct TextAttr *tattr,
148 struct TagItem *taglist);
150 /****************************************************************************************/
152 /* Tags for the private gadtools classes */
154 #define GT_Dummy (TAG_USER)
156 #define GTA_Text_DispFunc (GT_Dummy + 1)
157 #define GTA_Text_Format (GT_Dummy + 2)
158 #define GTA_Arrow_Type (GT_Dummy + 3)
159 #define GTA_Arrow_Pulse (GT_Dummy + 4)
160 #define GTA_Arrow_Scroller (GT_Dummy + 5)
161 #define GTA_Scroller_Dec (GT_Dummy + 6)
162 #define GTA_Scroller_Inc (GT_Dummy + 7)
163 #define GTA_Listview_Scroller (GT_Dummy + 8)
164 #define GTA_GadgetKind (GT_Dummy + 9)
165 #define GTA_ChildGadgetKind (GT_Dummy + 10)
166 #define GTA_Scroller_ScrollerKind (GT_Dummy + 11)
167 #define GTA_Scroller_ArrowKind (GT_Dummy + 12)
168 #define GTA_Scroller_Arrow1 (GT_Dummy + 13)
169 #define GTA_Scroller_Arrow2 (GT_Dummy + 14)
171 /****************************************************************************************/
173 /* private gadget kinds */
175 #define _ARROW_KIND 100
177 /****************************************************************************************/
179 /* Some listview specific constants */
180 #define LV_BORDER_X 4
181 #define LV_BORDER_Y 3
183 #define LV_DEF_INTERNAL_SPACING 0
185 /****************************************************************************************/
187 /* Private MX tags */
189 #define GTMX_TickLabelPlace AROSMX_TickLabelPlace
190 #define GTMX_TickHeight AROSMX_TickHeight
192 /****************************************************************************************/
194 #define NEWMENUCODE TRUE
196 #if NEWMENUCODE
197 struct Menu * makemenutitle(struct NewMenu * newmenu,
198 UBYTE **MyMenuMemPtr,
199 struct TagItem * taglist);
201 struct MenuItem * makemenuitem(struct NewMenu * newmenu,
202 UBYTE **MyMenuMemPtr,
203 struct Image ***MyBarTablePtr,
204 BOOL is_image,
205 struct TagItem * taglist,
206 struct GadToolsBase_intern * GadToolsBase);
208 ULONG getmenutitlesize(struct NewMenu * newmenu,
209 struct TagItem * taglist);
210 ULONG getmenuitemsize(struct NewMenu * newmenu,
211 BOOL is_image,
212 struct TagItem * taglist,
213 struct GadToolsBase_intern * GadToolsBase);
215 #else
217 struct Menu * makemenutitle(struct NewMenu * newmenu,
218 struct TagItem * taglist);
220 struct MenuItem * makemenuitem(struct NewMenu * newmenu,
221 BOOL is_image,
222 struct TagItem * taglist,
223 struct GadToolsBase_intern * GadToolsBase);
224 #endif
225 void appendmenu(struct Menu * firstmenu,
226 struct Menu * lastmenu);
228 void appenditem(struct Menu * curmenu,
229 struct MenuItem * item);
231 void appendsubitem(struct MenuItem * curitem,
232 struct MenuItem * subitem);
234 void freeitems(struct MenuItem * mi, struct GadToolsBase_intern * GadToolsBase);
236 BOOL layoutmenuitems(struct MenuItem * menuitem,
237 struct VisualInfo * vi,
238 struct TagItem * taglist,
239 struct GadToolsBase_intern * GadToolsBase);
241 BOOL layoutsubitems(struct MenuItem * motheritem,
242 struct VisualInfo * vi,
243 struct TagItem * taglist,
244 struct GadToolsBase_intern * GadToolsBase);
246 BOOL is_menubarlabelclass_image(struct Image *im,
247 struct GadToolsBase_intern *GadToolsBase);
249 /****************************************************************************************/
251 struct GadToolsBase_intern
253 struct Library lib;
255 Class * buttonclass;
256 Class * textclass;
257 Class * sliderclass;
258 Class * scrollerclass;
259 Class * arrowclass;
260 Class * stringclass;
261 Class * listviewclass;
262 Class * checkboxclass;
263 Class * cycleclass;
264 Class * mxclass;
265 Class * paletteclass;
267 /* Semaphore to protect the bevel object. */
268 struct SignalSemaphore bevelsema;
269 /* Actually an Object *. The image used for bevel boxes. */
270 struct Image * bevel;
272 /* RenderHook for GTListView class */
273 struct Hook lv_RenderHook;
276 /* extended intuimsg as used by GT_GetIMsg, GT_FilterIMsg, ... */
278 struct GT_IntuiMessage
280 struct ExtIntuiMessage imsg;
281 struct IntuiMessage * origmsg;
282 BOOL wasalloced;
285 #define VI(x) ((struct VisualInfo *)x)
287 struct VisualInfo
289 struct Screen * vi_screen;
290 struct DrawInfo * vi_dri;
293 /* dummy gadget created by CreateContext */
295 struct GT_ContextGadget
297 struct ExtGadget gad;
298 IPTR magic;
299 IPTR magic2;
300 struct GT_IntuiMessage gtmsg;
301 struct Gadget *activegadget;
302 struct Gadget *parentgadget;
303 IPTR gadget_value;
304 IPTR gadgetkind;
305 IPTR childgadgetkind;
306 IPTR childinfo;
307 ULONG getattrtag;
308 ULONG setattrtag;
309 WORD scrollticker;
312 struct GT_GenericGadget
314 struct ExtGadget gad;
315 IPTR magic;
316 IPTR magic2;
317 struct IntuiText *itext;
320 /****************************************************************************************/
322 #define CONTEXT_MAGIC ((IPTR)0x11223344)
323 #define CONTEXT_MAGIC2 ((IPTR)0x44332211)
325 #define GENERIC_MAGIC ((IPTR)0x11335577)
326 #define GENERIC_MAGIC2 ((IPTR)0x77553311)
328 /****************************************************************************************/
330 #define TAG_Left 0
331 #define TAG_Top 1
332 #define TAG_Width 2
333 #define TAG_Height 3
334 #define TAG_IText 4
335 #define TAG_LabelPlace 5
336 #define TAG_Previous 6
337 #define TAG_ID 7
338 #define TAG_DrawInfo 8
339 #define TAG_UserData 9
340 #define TAG_Num 10
343 #define TAG_Menu 0
344 #define TAG_TextAttr 1
345 #define TAG_NewLookMenus 2
346 #define TAG_CheckMark 3
347 #define TAG_AmigaKey 4
348 #define TAG_FrontPen 5
350 #define BORDERPROPSPACINGX 4
351 #ifdef __MORPHOS__
352 #define BORDERPROPSPACINGY 2
353 #else
354 #define BORDERPROPSPACINGY 4
355 #endif
357 #define BORDERSTRINGSPACINGX 4
358 #define BORDERSTRINGSPACINGY 2
360 #define LV_SHOWSELECTED_NONE ((struct Gadget *)~0)
362 /****************************************************************************************/
364 #define GTB(gtb) ((struct GadToolsBase_intern *)gtb)
366 #ifdef __MORPHOS__
367 #define DeinitRastPort(x) ((void)0)
369 #define DoMethod(MyObject, tags...) \
370 ({ULONG _tags[] = { tags }; DoMethodA((MyObject), (APTR)_tags);})
372 #define CoerceMethod(MyClass, MyObject, tags...) \
373 ({ULONG _tags[] = { tags }; CoerceMethodA((MyClass), (MyObject), (APTR)_tags);})
375 #define DoSuperMethod(MyClass, MyObject, tags...) \
376 ({ULONG _tags[] = { tags }; DoSuperMethodA((MyClass), (MyObject), (APTR)_tags);})
378 /********************************************************************************/
379 /* imageclass.h AROS extensions */
381 #define SYSIA_WithBorder IA_FGPen /* default: TRUE */
382 #define SYSIA_Style IA_BGPen /* default: SYSISTYLE_NORMAL */
384 #define SYSISTYLE_NORMAL 0
385 #define SYSISTYLE_GADTOOLS 1 /* to get arrow images in gadtools look */
387 /********************************************************************************/
388 /* gadgetclass.h AROS extenstions */
390 /* This method is invoked to learn about the sizing requirements of your class,
391 before an object is created. This is AROS specific. */
392 #define GM_DOMAIN 7
393 struct gpDomain
395 STACKED ULONG MethodID; /* GM_DOMAIN */
396 STACKED struct GadgetInfo * gpd_GInfo; /* see <intuition/cghooks.h> */
397 STACKED struct RastPort * gpd_RPort; /* RastPort to calculate dimensions for. */
398 STACKED LONG gpd_Which; /* see below */
399 STACKED struct IBox gpd_Domain; /* Resulting domain. */
400 STACKED struct TagItem * gpd_Attrs; /* Additional attributes. None defined,
401 yet. */
404 /********************************************************************************/
406 /* gpd_Which */
407 #define GDOMAIN_MINIMUM 0 /* Calculate minimum size. */
408 #define GDOMAIN_NOMINAL 1 /* Calculate nominal size. */
409 #define GDOMAIN_MAXIMUM 2 /* Calculate maximum size. */
411 /********************************************************************************/
413 /* [IS.] (struct TextAttr *) TextAttr structure (see <graphics/text.h>) to
414 use for gadget rendering. This attribute is not directly supported by
415 GadgetClass. */
416 #define GA_TextAttr (GA_Dummy + 40)
418 /* [I..] (LONG) Choose the placing of the label. GadgetClass does not support
419 this directly. Its subclasses have to take care of that. For possible
420 values see below. */
421 #define GA_LabelPlace (GA_Dummy + 100)
424 /* Placetext values for GA_LabelPlace. */
425 #define GV_LabelPlace_In 1
426 #define GV_LabelPlace_Left 2
427 #define GV_LabelPlace_Right 3
428 #define GV_LabelPlace_Above 4
429 #define GV_LabelPlace_Below 5
431 /********************************************************************************/
433 #define MENUBARLABELCLASS "menubarlabelclass"
435 #define GTYP_GADTOOLS 0x0100
437 #define CORRECT_LISTVIEWHEIGHT TRUE
439 #else /*MorphOS*/
441 #define CORRECT_LISTVIEWHEIGHT FALSE
443 #endif
445 #define DEBUG_CREATECONTEXT(x) ;
446 #define DEBUG_CREATEGADGETA(x) ;
447 #define DEBUG_CREATEMENUSA(x) ;
448 #define DEBUG_CREATELISTVIEW(x) ;
449 #define DEBUG_CREATESCROLLER(x) ;
450 #define DEBUG_FREEGADGETS(x) ;
451 #define DEBUG_DUMPMENUS(x) ;
452 #define DEBUG_ALLOCMENUS(x) ;
453 #define DEBUG_FREEMENUS(x) ;
454 #define DEBUG_REFRESHWINDOW(x) ;
456 void DumpMenu(struct Menu *menu);
458 /* Structures for the class private data */
460 /* GTButton class */
461 struct ButtonData
463 struct DrawInfo *dri;
464 struct Image *frame;
467 /* GTText class */
468 struct TextData
470 struct DrawInfo *dri;
471 Object *frame;
472 STRPTR format;
473 IPTR toprint;
474 UBYTE frontpen;
475 UBYTE backpen;
476 UBYTE justification;
477 UBYTE flags;
478 struct TextFont *font;
479 UWORD maxnumberlength;
480 WORD gadgetkind;
481 LONG (*dispfunc)(struct Gadget *, WORD);
482 UBYTE labelplace;
486 /* GTSlider class */
487 struct SliderData
489 Object *frame;
490 WORD min;
491 WORD max;
492 WORD level;
493 WORD freedom;
494 UBYTE labelplace;
497 /* GTScroller class */
498 struct ScrollerData
500 Object *frame;
501 struct Gadget *arrow1;
502 struct Gadget *arrow2;
503 WORD gadgetkind;
504 UBYTE labelplace;
507 /* GTArrow class */
508 struct ArrowData
510 Object *arrowimage;
511 Object *frame;
512 Object *scroller;
513 WORD gadgetkind;
514 WORD arrowtype;
517 /* GTString class */
518 struct StringData
520 Object *frame;
521 struct TextFont *font;
522 WORD gadgetkind;
523 UBYTE labelplace;
526 /* GTListView class */
527 struct LVData
529 struct Hook *ld_CallBack;
530 struct List *ld_Labels;
531 struct DrawInfo *ld_Dri;
532 struct TextFont *ld_Font;
533 Object *ld_Frame;
534 Object *ld_Scroller;
535 struct Gadget *ld_ShowSelected;
536 WORD ld_Top;
537 WORD ld_Selected;
538 WORD ld_Spacing;
539 WORD ld_ItemHeight;
541 /* The number of first damaged entry, counting from first visible.
542 ** A value o -1 means "nothing has to be redrawn"
544 WORD ld_FirstDamaged;
545 UWORD ld_NumDamaged;
547 /* Number of entries the listview should scroll in GM_RENDER.
548 ** Negative valu means scroll up.
550 WORD ld_ScrollEntries;
551 WORD ld_NumEntries;
553 UBYTE ld_Flags;
554 UBYTE ld_LabelPlace;
557 /* GTCheckBox class */
558 struct CheckBoxData
560 struct DrawInfo *dri;
561 LONG labelplace;
562 LONG flags;
565 /* GTCycle class */
566 struct CycleData
568 struct TextFont *font;
569 STRPTR *labels;
570 UWORD active;
571 UWORD numlabels;
572 UWORD labelplace;
575 /* GTMX class */
576 struct MXData
578 struct DrawInfo *dri;
579 struct TextAttr *tattr;
580 struct Image *mximage;
581 struct TextFont *font;
582 struct Rectangle bbox;
583 STRPTR *labels;
584 ULONG active, newactive; /* The active tick and the tick to be activated */
585 ULONG numlabels; /* The number of labels */
586 LONG labelplace, ticklabelplace;
587 UWORD fontheight;
588 UWORD spacing;
589 UWORD maxtextwidth;
592 /* GTPalette class */
593 struct PaletteData
595 UWORD pd_NumColors;
596 UBYTE *pd_ColorTable;
597 UBYTE pd_Color;
598 /* For state info, to know what selected entry to delete in GM_RENDER, GREDRAW_UPDATE */
599 UBYTE pd_OldColor;
601 UBYTE pd_ColorOffset;
602 UWORD pd_IndWidth;
603 UWORD pd_IndHeight;
605 struct IBox pd_GadgetBox; /* Box surrounding whole palette */
606 struct IBox pd_PaletteBox; /* Box surrounding palette */
607 struct IBox pd_IndicatorBox; /* Box surrounding indicator */
609 UWORD pd_ColWidth;
610 UWORD pd_RowHeight;
611 UBYTE pd_NumCols;
612 UBYTE pd_NumRows;
614 /* This one is used to backup pd_Color if left is clicked. This
615 ** way the old state can be restored if the left is released
616 ** outside the gadget.
618 UBYTE pd_ColorBackup;
619 struct TextAttr *pd_TAttr;
620 LONG pd_LabelPlace;
621 Object *pd_Frame;
625 #endif /* GADTOOLS_INTERN_H */