More work on axwin, and slight changes in othe places
[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   MinWidth, MinHeight;
17         short   GapSize;
18         
19         short   Size;   // Size attribute
20         
21         char    *Text;
22         void    *Data;
23         
24         uint32_t        Flags;
25         
26         // -- Render Cache
27         short   CachedX, CachedY;
28         short   CachedW, CachedH;
29 }       tElement;
30
31 typedef struct sTab
32 {
33          int    Type;   // Should be zero, allows a tab to be the parent of an element
34         
35         struct sElement *Parent;
36         struct sElement *FirstChild;
37         struct sElement *LastChild;
38         
39         char    *Name;
40         
41         tElement        *RootElement;
42 }       tTab;
43
44 typedef struct sApplication
45 {
46         pid_t   PID;
47         
48          int    nTabs;
49         tTab    *Tabs;
50         
51         char    Name[];
52 }       tApplication;
53
54 // === CONSTANTS ===
55 enum eElementFlags
56 {
57         /**
58          * \brief Rendered
59          * 
60          * If set, the element will be ignored in calculating sizes and
61          * rendering.
62          */
63         ELEFLAG_NORENDER    = 0x001,
64         /**
65          * \brief Element visibility
66          * 
67          * If set, the element is not drawn.
68          */
69         ELEFLAG_INVISIBLE   = 0x002,
70         
71         /**
72          * \brief Position an element absulutely
73          */
74         ELEFLAG_ABSOLUTEPOS = 0x004,
75         
76         /**
77          * \brief Fixed size element
78          */
79         ELEFLAG_FIXEDSIZE   = 0x008,
80         
81         /**
82          * \brief Element "orientation"
83          */
84         ELEFLAG_VERTICAL    = 0x010,//  ELEFLAG_HORIZONTAL  = 0x000,
85         /**
86          * \brief Action for text that overflows
87          */
88         ELEFLAG_WRAP        = 0x020,//  ELEFLAG_NOWRAP      = 0x000,
89         /**
90          * \brief Cross size action
91          * 
92          * If this flag is set, the element will only be as large (across
93          * its parent) as is needed to encase the contents of the element.
94          * Otherwise, the element will expand to fill all avaliable space.
95          */
96         ELEFLAG_NOEXPAND    = 0x040,    //      ELEFLAG_EXPAND      = 0x000
97         
98         /**
99          * \brief Center alignment
100          */
101         ELEFLAG_ALIGN_CENTER= 0x080,
102         /**
103          * \brief Right/Bottom alignment
104          */
105         ELEFLAG_ALIGN_END = 0x100
106 };
107
108 /**
109  */
110 enum eElementTypes
111 {
112         ELETYPE_NONE,
113         
114         ELETYPE_BOX,    //!< Content box
115         ELETYPE_TABBAR, //!< Tab Bar
116         ELETYPE_TOOLBAR,        //!< Tool Bar
117         
118         ELETYPE_BUTTON, //!< Push Button
119         ELETYPE_TEXT,   //!< Text
120         ELETYPE_IMAGE,  //!< Image
121         
122         ELETYPE_SPACER, //!< Visual Spacer
123         
124         MAX_ELETYPES    = 0x100
125 };
126
127 // === FUNCTIONS ===
128 /**
129  * \brief Create a new element as a child of \a Parent
130  */
131 extern tElement *WM_CreateElement(tElement *Parent, int Type, int Flags);
132 extern void     WM_SetFlags(tElement *Element, int Flags);
133 extern void     WM_SetSize(tElement *Element, int Size);
134 extern void     WM_SetText(tElement *Element, char *Text);
135
136 #endif

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