Initial commit
[amiga/OpenBoopsi.git] / include / gadgets / SmartGroupGClass.h
1 /*
2 **      $Id: SmartGroupGClass.h,v 1.1 1999/02/07 14:24:44 bernie Exp $
3 **
4 **      Copyright (C) 1999 Bernardo Innocenti
5 **      All rights reserved.
6 **
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.
11 **
12 **      The original ROM class is not very usable because it has
13 **      a lot of bugs and limitations:
14 **
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
20 **
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:
26 **
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(...),
33 **                      TAG_DONE),
34 **              SGA_Child, NewObject(...),
35 **              TAG_DONE))
36 **              {
37 **                      /* ... use your glist here... */
38 **                      DeleteObject (glist);
39 **              }
40 **              else
41 **                      printf ("Failed to create the application!\n");
42 */
43
44 #define SMARTGROUPGCLASS "smartgroupgclass"
45 #define SMARTGROUPVERS  1
46
47
48 /* Class initializer and terminator. Only avalable when
49  * the class is compiled in the static linker object flavour.
50  */
51 Class   *MakeSmartGroupGClass (void);
52 BOOL     FreeSmartGroupGClass (Class *class);
53
54
55 /*
56  * New Methods:
57  *
58  *      This class does not define any new methods
59  */
60
61
62 /*
63  * New Attributes:
64  *
65  */
66 #define SGA_Dummy                       (TAG_USER | ('S'<<16) | ('G'<<8))
67
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.
75          */
76
77 /*
78  * Changed attributes:
79  *
80  * LAYOUTA_Orientation
81  *      [I] (ULONG) - Pass one of the LORIENT_#? modes.
82  *      Defaults to LORIENT_HORIZ.
83  *
84  */
85
86 /* FIX: Define the attributes that not present
87  * before V42 of <intuition/gadgetclass.h>.
88  */
89 #ifndef LAYOUTA_Dummy
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
95 #endif
96
97
98 /*
99  * Changed methods:
100  *
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
105  *      to other groups.
106  */