1 #ifndef GADTOOLS_INTERN_H
2 #define GADTOOLS_INTERN_H
5 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
8 Desc: Internal definitions for gadtools.library.
12 #ifndef EXEC_LIBRARIES_H
13 # include <exec/libraries.h>
15 #ifndef EXEC_SEMAPHORES_H
16 # include <exec/semaphores.h>
21 #ifndef PROTO_GRAPHICS_H
22 # include <proto/graphics.h>
24 #ifndef GRAPHICS_GFXBASE_H
25 # include <graphics/gfxbase.h>
27 #ifndef PROTO_INTUITION_H
28 # include <proto/intuition.h>
30 #ifndef INTUITION_CLASSES_H
31 # include <intuition/classes.h>
33 #ifndef INTUITION_INTUITIONBASE_H
34 # include <intuition/intuitionbase.h>
36 #ifndef INTUITION_SCREENS_H
37 # include <intuition/screens.h>
39 #ifndef PROTO_UTILITY_H
40 # include <proto/utility.h>
42 #ifndef LIBRARIES_GADTOOLS_H
43 # include <libraries/gadtools.h>
45 #ifndef GADGETS_AROSMX_H
46 # include <gadgets/arosmx.h>
49 /* Needed for aros_print_not_implemented macro */
50 #include <aros/debug.h>
51 #include <aros/libcall.h>
52 #include <aros/asmcall.h>
54 /****************************************************************************************/
58 /* Some external stuff (gadtools_init.c) */
59 struct GadToolsBase_intern
; /* prerefrence */
61 /* Internal prototypes */
62 struct IntuiText
*makeitext(struct GadToolsBase_intern
*GadToolsBase
,
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 struct TagItem
*taglist
);
102 struct Gadget
*maketext(struct GadToolsBase_intern
*GadToolsBase
,
103 struct TagItem stdgadtags
[],
104 struct VisualInfo
*vi
,
105 struct TextAttr
*tattr
,
106 struct TagItem
*taglist
);
108 struct Gadget
*makenumber(struct GadToolsBase_intern
*GadToolsBase
,
109 struct TagItem stdgadtags
[],
110 struct VisualInfo
*vi
,
111 struct TextAttr
*tattr
,
112 struct TagItem
*taglist
);
115 struct Gadget
*makeslider(struct GadToolsBase_intern
*GadToolsBase
,
116 struct TagItem stdgadtags
[],
117 struct VisualInfo
*vi
,
118 struct TextAttr
*tattr
,
119 struct TagItem
*taglist
);
121 struct Gadget
*makescroller(struct GadToolsBase_intern
*GadToolsBase
,
122 struct TagItem stdgadtags
[],
123 struct VisualInfo
*vi
,
124 struct TagItem
*taglist
);
126 struct Gadget
*makestring(struct GadToolsBase_intern
*GadToolsBase
,
127 struct TagItem stdgadtags
[],
128 struct VisualInfo
*vi
,
129 struct TextAttr
*tattr
,
130 struct TagItem
*taglist
);
132 struct Gadget
*makeinteger(struct GadToolsBase_intern
*GadToolsBase
,
133 struct TagItem stdgadtags
[],
134 struct VisualInfo
*vi
,
135 struct TextAttr
*tattr
,
136 struct TagItem
*taglist
);
138 struct Gadget
*makelistview(struct GadToolsBase_intern
*GadToolsBase
,
139 struct TagItem stdgadtags
[],
140 struct VisualInfo
*vi
,
141 struct TextAttr
*tattr
,
142 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
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
,
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
,
212 struct TagItem
* taglist
,
213 struct GadToolsBase_intern
* GadToolsBase
);
217 struct Menu
* makemenutitle(struct NewMenu
* newmenu
,
218 struct TagItem
* taglist
);
220 struct MenuItem
* makemenuitem(struct NewMenu
* newmenu
,
222 struct TagItem
* taglist
,
223 struct GadToolsBase_intern
* GadToolsBase
);
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
258 Class
* scrollerclass
;
261 Class
* listviewclass
;
262 Class
* checkboxclass
;
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
;
285 #define VI(x) ((struct VisualInfo *)x)
289 struct Screen
* vi_screen
;
290 struct DrawInfo
* vi_dri
;
293 /* dummy gadget created by CreateContext */
295 struct GT_ContextGadget
297 struct ExtGadget gad
;
300 struct GT_IntuiMessage gtmsg
;
301 struct Gadget
*activegadget
;
302 struct Gadget
*parentgadget
;
305 IPTR childgadgetkind
;
312 struct GT_GenericGadget
314 struct ExtGadget gad
;
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 /****************************************************************************************/
335 #define TAG_LabelPlace 5
336 #define TAG_Previous 6
338 #define TAG_DrawInfo 8
339 #define TAG_UserData 9
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
352 #define BORDERPROPSPACINGY 2
354 #define BORDERPROPSPACINGY 4
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)
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. */
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,
404 /********************************************************************************/
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
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
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
441 #define CORRECT_LISTVIEWHEIGHT FALSE
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 */
463 struct DrawInfo
*dri
;
470 struct DrawInfo
*dri
;
478 struct TextFont
*font
;
479 UWORD maxnumberlength
;
481 LONG (*dispfunc
)(struct Gadget
*, WORD
);
497 /* GTScroller class */
501 struct Gadget
*arrow1
;
502 struct Gadget
*arrow2
;
521 struct TextFont
*font
;
526 /* GTListView class */
529 struct Hook
*ld_CallBack
;
530 struct List
*ld_Labels
;
531 struct DrawInfo
*ld_Dri
;
532 struct TextFont
*ld_Font
;
535 struct Gadget
*ld_ShowSelected
;
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
;
547 /* Number of entries the listview should scroll in GM_RENDER.
548 ** Negative valu means scroll up.
550 WORD ld_ScrollEntries
;
557 /* GTCheckBox class */
560 struct DrawInfo
*dri
;
568 struct TextFont
*font
;
578 struct DrawInfo
*dri
;
579 struct TextAttr
*tattr
;
580 struct Image
*mximage
;
581 struct TextFont
*font
;
582 struct Rectangle bbox
;
584 ULONG active
, newactive
; /* The active tick and the tick to be activated */
585 ULONG numlabels
; /* The number of labels */
586 LONG labelplace
, ticklabelplace
;
592 /* GTPalette class */
596 UBYTE
*pd_ColorTable
;
598 /* For state info, to know what selected entry to delete in GM_RENDER, GREDRAW_UPDATE */
601 UBYTE pd_ColorOffset
;
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 */
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
;
625 #endif /* GADTOOLS_INTERN_H */