AxWin - Re-structured to share headers between clients and server
[tpg/acess2.git] / Usermode / include / axwin2 / axwin.h
1 /**
2  * \file axwin2/axwin.h
3  * \author John Hodge (thePowersGang)
4  * \brief AxWin Core functions
5  */
6 #ifndef _AXWIN2_AXWIN_H
7 #define _AXWIN2_AXWIN_H
8
9 #include <stdlib.h>
10 #include <stdint.h>
11
12 #include <axwin2/messages.h>
13
14 // === Core Types ===
15 typedef struct sAxWin_Element   tAxWin_Element;
16 //typedef struct sAxWin_Message tAxWin_Message;
17 typedef int     tAxWin_MessageCallback(tAxWin_Message *);
18
19 // === Functions ===
20 extern int      AxWin_Register(const char *ApplicationName, tAxWin_MessageCallback *DefaultHandler);
21 extern tAxWin_Element   *AxWin_CreateTab(const char *TabTitle);
22 extern tAxWin_Element   *AxWin_AddMenuItem(tAxWin_Element *Parent, const char *Label, int Message);
23
24 extern int      AxWin_MessageLoop(void);
25 extern int      AxWin_SendMessage(tAxWin_Message *Message);
26 extern tAxWin_Message   *AxWin_WaitForMessage(void);
27 extern int      AxWin_HandleMessage(tAxWin_Message *Message);
28
29 // === Window Control ===
30
31 extern tAxWin_Element   *AxWin_CreateElement(tAxWin_Element *Parent, int ElementType, int Flags, const char *DebugName);
32 extern void     AxWin_SetFlags(tAxWin_Element *Element, int Flags);
33 extern void     AxWin_SetText(tAxWin_Element *Element, const char *Text);
34 extern void     AxWin_SetSize(tAxWin_Element *Element, int Size);
35 extern void     AxWin_DeleteElement(tAxWin_Element *Element);
36
37 // === CONSTANTS ===
38 enum eElementFlags
39 {
40         /**
41          * \brief Rendered
42          * 
43          * If set, the element will be ignored in calculating sizes and
44          * rendering.
45          */
46         ELEFLAG_NORENDER    = 0x001,
47         /**
48          * \brief Element visibility
49          * 
50          * If set, the element is not drawn (but still is used for size calculations)
51          */
52         ELEFLAG_INVISIBLE   = 0x002,
53         
54         /**
55          * \brief Position an element absulutely (ignored in size calcs)
56          */
57         ELEFLAG_ABSOLUTEPOS = 0x004,
58         
59         /**
60          * \brief Fixed size element
61          */
62         ELEFLAG_FIXEDSIZE   = 0x008,
63         
64         /**
65          * \brief Element "orientation"
66          * 
67          * Vertical means that the children of this element are stacked,
68          * otherwise they list horizontally
69          */
70         ELEFLAG_VERTICAL    = 0x010,//  ELEFLAG_HORIZONTAL  = 0x000,
71         /**
72          * \brief Action for text that overflows
73          */
74         ELEFLAG_WRAP        = 0x020,//  ELEFLAG_NOWRAP      = 0x000,
75         /**
76          * \brief Cross size action
77          * 
78          * If this flag is set, the element will only be as large (across
79          * its parent) as is needed to encase the contents of the element.
80          * Otherwise, the element will expand to fill all avaliable space.
81          */
82         ELEFLAG_NOEXPAND    = 0x040,
83         
84         /**
85          * \brief With (length) size action
86          * If this flag is set, the element will only be as large as
87          * is required along it's parent
88          */
89         ELEFLAG_NOSTRETCH   = 0x080,
90         
91         /**
92          * \brief Center alignment
93          */
94         ELEFLAG_ALIGN_CENTER= 0x100,
95         /**
96          * \brief Right/Bottom alignment
97          * 
98          * If set, the element aligns to the end of avaliable space (instead
99          * of the beginning)
100          */
101         ELEFLAG_ALIGN_END       = 0x200
102 };
103
104 /**
105  */
106 enum eElementTypes
107 {
108         ELETYPE_NONE,
109         
110         ELETYPE_BOX,    //!< Content box (invisible in itself)
111         ELETYPE_TABBAR, //!< Tab Bar
112         ELETYPE_TOOLBAR,        //!< Tool Bar
113         
114         ELETYPE_BUTTON, //!< Push Button
115         
116         ELETYPE_TEXT,   //!< Text
117         ELETYPE_IMAGE,  //!< Image
118         
119         ELETYPE_SPACER, //!< Visual Spacer (horizontal / vertical rule)
120         
121         MAX_ELETYPES    = 0x100
122 };
123
124 #endif

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