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

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