2 ** $Id: SmartGroupGClass.h,v 1.1 1999/02/07 14:24:44 bernie Exp $
4 ** Copyright (C) 1999 Bernardo Innocenti
5 ** All rights reserved.
7 ** "smartgroupgclass", a class similar to the groupgclass
8 ** that allows attaching any number of child gadgets that
9 ** will behave like a single gadget. Input processing and
10 ** rendering are deferred to the children as appropriate.
12 ** The original ROM class is not very usable because it has
13 ** a lot of bugs and limitations:
15 ** - Doesn't forward GM_LAYOUT to its children
16 ** - Does not work when GA_RelRight or GA_RelBottom are set
17 ** - Ignores GA_(Rel)Width and GA_(Rel)Height on creation
18 ** and recalculates its size when new children are attached.
19 ** - Can not layout its children automatically
21 ** The smartgroupgclass provides the custom creation-time
22 ** attribute SGA_Child, which allows to attach child gadgets
23 ** to it in a single call to NewObject() instead of calling
24 ** OM_ADDMEMBER several times later. This enables the user
25 ** to create a whole GUI with a single C statement like this:
27 ** if (glist = NewObject(NULL, SMARTGROUPGCLASS,
28 ** LAYOUTA_Orientation, LORIENT_VERT,
29 ** SGA_Child, NewObject(NULL SMARTGROUPGCLASS,
30 ** LAYOUTA_Orientation, LORIENT_HORIZ,
31 ** SGA_Child, NewObject(...),
32 ** SGA_Child, NewObject(...),
34 ** SGA_Child, NewObject(...),
37 ** /* ... use your glist here... */
38 ** DeleteObject (glist);
41 ** printf ("Failed to create the application!\n");
44 #define SMARTGROUPGCLASS "smartgroupgclass"
45 #define SMARTGROUPVERS 1
48 /* Class initializer and terminator. Only avalable when
49 * the class is compiled in the static linker object flavour.
51 Class *MakeSmartGroupGClass (void);
52 BOOL FreeSmartGroupGClass (Class *class);
58 * This class does not define any new methods
66 #define SGA_Dummy (TAG_USER | ('S'<<16) | ('G'<<8))
68 #define SGA_Child (SGA_Dummy + 1)
69 /* [I] (struct Gadget *) - Attach the specified child to
70 * the group at creation time. If the argument is NULL,
71 * the group will be disposed and OM_NEW will also
72 * return NULL. This makes it easy to create a whole user
73 * interface by nesting several calls to NewObject() and
74 * testing the result of the higher level group only.
81 * [I] (ULONG) - Pass one of the LORIENT_#? modes.
82 * Defaults to LORIENT_HORIZ.
86 /* FIX: Define the attributes that not present
87 * before V42 of <intuition/gadgetclass.h>.
90 #define LAYOUTA_Dummy (TAG_USER+0x38000)
91 #define LAYOUTA_Orientation (LAYOUTA_Dummy+0x0003)
92 #define LORIENT_NONE 0
93 #define LORIENT_HORIZ 1
94 #define LORIENT_VERT 2
101 * The class redefines all the GM_#? methods and defers processing
102 * to its children in a way that makes the group behave as it was
103 * a single gadget. The children may still choose to send
104 * notification directly to the application or to gadgets attached