Merge branch 'master' of [email protected]:acess2
[tpg/acess2.git] / Usermode / Applications / axwin2_src / WM / wm.h
1
2 #ifndef _WM_H_
3 #define _WM_H_
4
5 typedef struct sElement
6 {
7          int    Type;
8         
9         struct sElement *Parent;
10         struct sElement *FirstChild;
11         struct sElement *LastChild;
12         struct sElement *NextSibling;
13         
14         short   PaddingL, PaddingR;
15         short   PaddingT, PaddingB;
16         short   GapSize;
17         
18         short   FixedWith;      // Fixed Long Size attribute (height)
19         short   FixedCross;     // Fixed Cross Size attribute (width)
20         
21         char    *Text;
22         
23         // -- Attributes maitained by the element code
24         // Not touched by the user
25         short   MinWith;        // Minimum long size
26         short   MinCross;       // Minimum cross size
27         void    *Data;
28         
29         uint32_t        Flags;
30         
31         // -- Render Cache
32         short   CachedX, CachedY;
33         short   CachedW, CachedH;
34         
35         char    DebugName[];
36 }       tElement;
37
38 typedef struct sTab
39 {
40          int    Type;   // Should be zero, allows a tab to be the parent of an element
41         
42         struct sElement *Parent;
43         struct sElement *FirstChild;
44         struct sElement *LastChild;
45         
46         char    *Name;
47         
48         tElement        *RootElement;
49 }       tTab;
50
51 typedef struct sApplication
52 {
53         pid_t   PID;
54         
55          int    nTabs;
56         tTab    *Tabs;
57         
58         char    Name[];
59 }       tApplication;
60
61 // === CONSTANTS ===
62 enum eElementFlags
63 {
64         /**
65          * \brief Rendered
66          * 
67          * If set, the element will be ignored in calculating sizes and
68          * rendering.
69          */
70         ELEFLAG_NORENDER    = 0x001,
71         /**
72          * \brief Element visibility
73          * 
74          * If set, the element is not drawn (but still is used for size calculations)
75          */
76         ELEFLAG_INVISIBLE   = 0x002,
77         
78         /**
79          * \brief Position an element absulutely (ignored in size calcs)
80          */
81         ELEFLAG_ABSOLUTEPOS = 0x004,
82         
83         /**
84          * \brief Fixed size element
85          */
86         ELEFLAG_FIXEDSIZE   = 0x008,
87         
88         /**
89          * \brief Element "orientation"
90          * 
91          * Vertical means that the children of this element are stacked,
92          * otherwise they list horizontally
93          */
94         ELEFLAG_VERTICAL    = 0x010,//  ELEFLAG_HORIZONTAL  = 0x000,
95         /**
96          * \brief Action for text that overflows
97          */
98         ELEFLAG_WRAP        = 0x020,//  ELEFLAG_NOWRAP      = 0x000,
99         /**
100          * \brief Cross size action
101          * 
102          * If this flag is set, the element will only be as large (across
103          * its parent) as is needed to encase the contents of the element.
104          * Otherwise, the element will expand to fill all avaliable space.
105          */
106         ELEFLAG_NOEXPAND    = 0x040,
107         
108         /**
109          * \brief With (length) size action
110          * If this flag is set, the element will only be as large as
111          * is required along it's parent
112          */
113         ELEFLAG_NOSTRETCH   = 0x080,
114         
115         /**
116          * \brief Center alignment
117          */
118         ELEFLAG_ALIGN_CENTER= 0x100,
119         /**
120          * \brief Right/Bottom alignment
121          * 
122          * If set, the element aligns to the end of avaliable space (instead
123          * of the beginning)
124          */
125         ELEFLAG_ALIGN_END       = 0x200
126 };
127
128 /**
129  */
130 enum eElementTypes
131 {
132         ELETYPE_NONE,
133         
134         ELETYPE_BOX,    //!< Content box (invisible in itself)
135         ELETYPE_TABBAR, //!< Tab Bar
136         ELETYPE_TOOLBAR,        //!< Tool Bar
137         
138         ELETYPE_BUTTON, //!< Push Button
139         
140         ELETYPE_TEXT,   //!< Text
141         ELETYPE_IMAGE,  //!< Image
142         
143         ELETYPE_SPACER, //!< Visual Spacer (horizontal / vertical rule)
144         
145         MAX_ELETYPES    = 0x100
146 };
147
148 // === FUNCTIONS ===
149 /**
150  * \brief Create a new element as a child of \a Parent
151  */
152 extern tElement *WM_CreateElement(tElement *Parent, int Type, int Flags, const char *DebugName);
153 extern void     WM_SetFlags(tElement *Element, int Flags);
154 extern void     WM_SetSize(tElement *Element, int Size);
155 extern void     WM_SetText(tElement *Element, const char *Text);
156
157 #endif

UCC git Repository :: git.ucc.asn.au