1 #ifndef GADTOOLS_INTERN_H
2 #define GADTOOLS_INTERN_H
5 Copyright © 1995-2011, 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 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)
170 #define GTA_Text_ParentGadget (GT_Dummy + 15)
172 /****************************************************************************************/
174 /* private gadget kinds */
176 #define _ARROW_KIND 100
178 /****************************************************************************************/
180 /* Some listview specific constants */
181 #define LV_BORDER_X 4
182 #define LV_BORDER_Y 3
184 #define LV_DEF_INTERNAL_SPACING 0
186 /****************************************************************************************/
188 /* Private MX tags */
190 #define GTMX_TickLabelPlace AROSMX_TickLabelPlace
191 #define GTMX_TickHeight AROSMX_TickHeight
193 /****************************************************************************************/
195 #define NEWMENUCODE TRUE
198 struct Menu
* makemenutitle(struct NewMenu
* newmenu
,
199 UBYTE
**MyMenuMemPtr
,
200 struct TagItem
* taglist
);
202 struct MenuItem
* makemenuitem(struct NewMenu
* newmenu
,
203 UBYTE
**MyMenuMemPtr
,
204 struct Image
***MyBarTablePtr
,
206 struct TagItem
* taglist
,
207 struct GadToolsBase_intern
* GadToolsBase
);
209 ULONG
getmenutitlesize(struct NewMenu
* newmenu
,
210 struct TagItem
* taglist
);
211 ULONG
getmenuitemsize(struct NewMenu
* newmenu
,
213 struct TagItem
* taglist
,
214 struct GadToolsBase_intern
* GadToolsBase
);
218 struct Menu
* makemenutitle(struct NewMenu
* newmenu
,
219 struct TagItem
* taglist
);
221 struct MenuItem
* makemenuitem(struct NewMenu
* newmenu
,
223 struct TagItem
* taglist
,
224 struct GadToolsBase_intern
* GadToolsBase
);
226 void appendmenu(struct Menu
* firstmenu
,
227 struct Menu
* lastmenu
);
229 void appenditem(struct Menu
* curmenu
,
230 struct MenuItem
* item
);
232 void appendsubitem(struct MenuItem
* curitem
,
233 struct MenuItem
* subitem
);
235 void freeitems(struct MenuItem
* mi
, struct GadToolsBase_intern
* GadToolsBase
);
237 BOOL
layoutmenuitems(struct MenuItem
* menuitem
,
238 struct VisualInfo
* vi
,
239 struct TagItem
* taglist
,
240 struct GadToolsBase_intern
* GadToolsBase
);
242 BOOL
layoutsubitems(struct MenuItem
* motheritem
,
243 struct VisualInfo
* vi
,
244 struct TagItem
* taglist
,
245 struct GadToolsBase_intern
* GadToolsBase
);
247 BOOL
is_menubarlabelclass_image(struct Image
*im
,
248 struct GadToolsBase_intern
*GadToolsBase
);
250 /****************************************************************************************/
252 struct GadToolsBase_intern
259 Class
* scrollerclass
;
262 Class
* listviewclass
;
263 Class
* checkboxclass
;
266 Class
* paletteclass
;
268 /* Semaphore to protect the bevel object. */
269 struct SignalSemaphore bevelsema
;
270 /* Actually an Object *. The image used for bevel boxes. */
271 struct Image
* bevel
;
273 /* RenderHook for GTListView class */
274 struct Hook lv_RenderHook
;
276 /* Seglist pointer */
279 /* Required libraies */
280 APTR gt_IntuitionBase
;
286 /* extended intuimsg as used by GT_GetIMsg, GT_FilterIMsg, ... */
288 struct GT_ContextGadget
;
290 struct GT_IntuiMessage
292 struct ExtIntuiMessage imsg
;
293 struct IntuiMessage
* origmsg
;
294 struct GT_ContextGadget
* contextgad
;
298 #define VI(x) ((struct VisualInfo *)x)
302 struct Screen
* vi_screen
;
303 struct DrawInfo
* vi_dri
;
306 /* dummy gadget created by CreateContext */
308 struct GT_ContextGadget
310 struct ExtGadget gad
;
313 struct GT_IntuiMessage gtmsg
;
314 struct Gadget
*activegadget
;
315 struct Gadget
*parentgadget
;
318 IPTR childgadgetkind
;
327 struct GT_GenericGadget
329 struct ExtGadget gad
;
332 struct IntuiText
*itext
;
335 /****************************************************************************************/
337 #define CONTEXT_MAGIC ((IPTR)0x11223344)
338 #define CONTEXT_MAGIC2 ((IPTR)0x44332211)
340 #define GENERIC_MAGIC ((IPTR)0x11335577)
341 #define GENERIC_MAGIC2 ((IPTR)0x77553311)
343 /****************************************************************************************/
350 #define TAG_LabelPlace 5
351 #define TAG_Previous 6
353 #define TAG_DrawInfo 8
354 #define TAG_UserData 9
359 #define TAG_TextAttr 1
360 #define TAG_NewLookMenus 2
361 #define TAG_CheckMark 3
362 #define TAG_AmigaKey 4
363 #define TAG_FrontPen 5
365 #define BORDERPROPSPACINGX 2
366 #define BORDERPROPSPACINGY 2
368 #define BORDERSTRINGSPACINGX 4
369 #define BORDERSTRINGSPACINGY 2
371 #define LV_SHOWSELECTED_NONE ((struct Gadget *)~0)
373 /****************************************************************************************/
375 #define GTB(gtb) ((struct GadToolsBase_intern *)gtb)
377 extern struct ExecBase
*SysBase
;
378 /* FIXME: Remove these #define xxxBase hacks
379 Do not use this in new code !
381 #define IntuitionBase (GTB(GadToolsBase)->gt_IntuitionBase)
382 #define UtilityBase (GTB(GadToolsBase)->gt_UtilityBase)
383 #define GfxBase (GTB(GadToolsBase)->gt_GfxBase)
384 #define LayersBase (GTB(GadToolsBase)->gt_LayersBase)
388 #define DeinitRastPort(x) ((void)0)
390 #define DoMethod(MyObject, tags...) \
391 ({ULONG _tags[] = { tags }; DoMethodA((MyObject), (APTR)_tags);})
393 #define CoerceMethod(MyClass, MyObject, tags...) \
394 ({ULONG _tags[] = { tags }; CoerceMethodA((MyClass), (MyObject), (APTR)_tags);})
396 #define DoSuperMethod(MyClass, MyObject, tags...) \
397 ({ULONG _tags[] = { tags }; DoSuperMethodA((MyClass), (MyObject), (APTR)_tags);})
399 /********************************************************************************/
400 /* imageclass.h AROS extensions */
402 #define SYSIA_WithBorder IA_FGPen /* default: TRUE */
403 #define SYSIA_Style IA_BGPen /* default: SYSISTYLE_NORMAL */
405 #define SYSISTYLE_NORMAL 0
406 #define SYSISTYLE_GADTOOLS 1 /* to get arrow images in gadtools look */
408 /********************************************************************************/
409 /* gadgetclass.h AROS extenstions */
411 /* This method is invoked to learn about the sizing requirements of your class,
412 before an object is created. This is AROS specific. */
416 STACKED ULONG MethodID
; /* GM_DOMAIN */
417 STACKED
struct GadgetInfo
* gpd_GInfo
; /* see <intuition/cghooks.h> */
418 STACKED
struct RastPort
* gpd_RPort
; /* RastPort to calculate dimensions for. */
419 STACKED LONG gpd_Which
; /* see below */
420 STACKED
struct IBox gpd_Domain
; /* Resulting domain. */
421 STACKED
struct TagItem
* gpd_Attrs
; /* Additional attributes. None defined,
425 /********************************************************************************/
428 #define GDOMAIN_MINIMUM 0 /* Calculate minimum size. */
429 #define GDOMAIN_NOMINAL 1 /* Calculate nominal size. */
430 #define GDOMAIN_MAXIMUM 2 /* Calculate maximum size. */
432 /********************************************************************************/
434 /* [IS.] (struct TextAttr *) TextAttr structure (see <graphics/text.h>) to
435 use for gadget rendering. This attribute is not directly supported by
437 #define GA_TextAttr (GA_Dummy + 40)
439 /* [I..] (LONG) Choose the placing of the label. GadgetClass does not support
440 this directly. Its subclasses have to take care of that. For possible
442 #define GA_LabelPlace (GA_Dummy + 100)
445 /* Placetext values for GA_LabelPlace. */
446 #define GV_LabelPlace_In 1
447 #define GV_LabelPlace_Left 2
448 #define GV_LabelPlace_Right 3
449 #define GV_LabelPlace_Above 4
450 #define GV_LabelPlace_Below 5
452 /********************************************************************************/
454 #define MENUBARLABELCLASS "menubarlabelclass"
456 #define GTYP_GADTOOLS 0x0100
458 #define CORRECT_LISTVIEWHEIGHT TRUE
462 #define CORRECT_LISTVIEWHEIGHT FALSE
466 #define DEBUG_CREATECONTEXT(x) ;
467 #define DEBUG_CREATEGADGETA(x) ;
468 #define DEBUG_CREATEMENUSA(x) ;
469 #define DEBUG_CREATELISTVIEW(x) ;
470 #define DEBUG_CREATESCROLLER(x) ;
471 #define DEBUG_FREEGADGETS(x) ;
472 #define DEBUG_DUMPMENUS(x) ;
473 #define DEBUG_ALLOCMENUS(x) ;
474 #define DEBUG_FREEMENUS(x) ;
475 #define DEBUG_REFRESHWINDOW(x) ;
477 void DumpMenu(struct Menu
*menu
);
479 /* Structures for the class private data */
484 struct DrawInfo
*dri
;
491 struct DrawInfo
*dri
;
492 struct Gadget
*parentgadget
;
500 struct TextFont
*font
;
501 UWORD maxnumberlength
;
503 IPTR (*dispfunc
)(struct Gadget
*, WORD
);
519 /* GTScroller class */
523 struct Gadget
*arrow1
;
524 struct Gadget
*arrow2
;
543 struct TextFont
*font
;
548 /* GTListView class */
551 struct Hook
*ld_CallBack
;
552 struct List
*ld_Labels
;
553 struct DrawInfo
*ld_Dri
;
554 struct TextFont
*ld_Font
;
557 struct Gadget
*ld_ShowSelected
;
563 /* The number of first damaged entry, counting from first visible.
564 ** A value o -1 means "nothing has to be redrawn"
566 WORD ld_FirstDamaged
;
569 /* Number of entries the listview should scroll in GM_RENDER.
570 ** Negative valu means scroll up.
572 WORD ld_ScrollEntries
;
579 /* GTCheckBox class */
582 struct DrawInfo
*dri
;
590 struct TextFont
*font
;
600 struct DrawInfo
*dri
;
601 struct TextAttr
*tattr
;
602 struct Image
*mximage
;
603 struct TextFont
*font
;
604 struct Rectangle bbox
;
606 ULONG active
, newactive
; /* The active tick and the tick to be activated */
607 ULONG numlabels
; /* The number of labels */
608 LONG labelplace
, ticklabelplace
;
614 /* GTPalette class */
618 UBYTE
*pd_ColorTable
;
620 /* For state info, to know what selected entry to delete in GM_RENDER, GREDRAW_UPDATE */
623 UBYTE pd_ColorOffset
;
627 struct IBox pd_GadgetBox
; /* Box surrounding whole palette */
628 struct IBox pd_PaletteBox
; /* Box surrounding palette */
629 struct IBox pd_IndicatorBox
; /* Box surrounding indicator */
636 /* This one is used to backup pd_Color if left is clicked. This
637 ** way the old state can be restored if the left is released
638 ** outside the gadget.
640 UBYTE pd_ColorBackup
;
641 struct TextAttr
*pd_TAttr
;
647 #endif /* GADTOOLS_INTERN_H */