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

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