Usermode - Working on AxWin3 SubWin widget (also API change for SysSpawn)
[tpg/acess2.git] / Usermode / Libraries / libaxwin3.so_src / include_exp / axwin3 / widget.h
1 /*
2  * Acess2 GUI Version 3 (AxWin3)
3  * - By John Hodge (thePowersGang)
4  *
5  * widget.h
6  * - Server-side widget library
7  */
8 #ifndef _AXWIN3_WIDGET_H_
9 #define _AXWIN3_WIDGET_H_
10
11 #include "axwin.h"
12
13 typedef struct sAxWin3_Widget   tAxWin3_Widget;
14
15 // --- Callback types
16 typedef int     (*tAxWin3_Widget_FireCb)(tAxWin3_Widget *Widget);
17 typedef int     (*tAxWin3_Widget_KeyUpDownCb)(tAxWin3_Widget *Widget, int KeySym);
18 typedef int     (*tAxWin3_Widget_KeyFireCb)(tAxWin3_Widget *Widget, int KeySym, int Character);
19 typedef int     (*tAxWin3_Widget_MouseMoveCb)(tAxWin3_Widget *Widget, int X, int Y);
20 typedef int     (*tAxWin3_Widget_MouseBtnCb)(tAxWin3_Widget *Widget, int X, int Y, int Button, int bPressed);
21
22 // --- Windows
23 extern tHWND    AxWin3_Widget_CreateWindow(tHWND Parent, int W, int H, int RootEleFlags);
24 extern void     AxWin3_Widget_DestroyWindow(tHWND Window);
25 extern tAxWin3_Widget   *AxWin3_Widget_GetRoot(tHWND Window);
26
27 // --- Element Creation
28 extern tAxWin3_Widget   *AxWin3_Widget_AddWidget(tAxWin3_Widget *Parent, int Type, int Flags, const char *DebugName);
29 extern tAxWin3_Widget   *AxWin3_Widget_AddWidget_SubWindow(tAxWin3_Widget *Parent, tHWND Window, int Flags, const char *DebugName);
30 extern void     AxWin3_Widget_DelWidget(tAxWin3_Widget *Widget);
31
32 // --- Callbacks
33 extern void     AxWin3_Widget_SetFireHandler(tAxWin3_Widget *Widget, tAxWin3_Widget_FireCb Callback);
34 extern void     AxWin3_Widget_SetKeyHandler(tAxWin3_Widget *Widget, tAxWin3_Widget_KeyUpDownCb Callback);
35 extern void     AxWin3_Widget_SetKeyFireHandler(tAxWin3_Widget *Widget, tAxWin3_Widget_KeyFireCb Callback);
36 extern void     AxWin3_Widget_SetMouseMoveHandler(tAxWin3_Widget *Widget, tAxWin3_Widget_MouseMoveCb Callback);
37 extern void     AxWin3_Widget_SetMouseButtonHandler(tAxWin3_Widget *Widget, tAxWin3_Widget_MouseBtnCb Callback);
38 // --- Manipulation
39 extern void     AxWin3_Widget_SetFlags(tAxWin3_Widget *Widget, int FlagSet, int FlagMask);
40 extern void     AxWin3_Widget_SetSize(tAxWin3_Widget *Widget, int Size);
41 extern void     AxWin3_Widget_SetText(tAxWin3_Widget *Widget, const char *Text);
42 extern void     AxWin3_Widget_SetColour(tAxWin3_Widget *Widget, int Index, tAxWin3_Colour Colour);
43 // --- Inspection
44 extern char     *AxWin3_Widget_GetText(tAxWin3_Widget *Widget);
45
46 enum eElementTypes
47 {
48         ELETYPE_NONE,
49
50         ELETYPE_SUBWIN,
51
52         ELETYPE_BOX,    //!< Content box (invisible in itself)
53         ELETYPE_TEXT,   //!< Text
54         ELETYPE_IMAGE,  //!< Image
55         ELETYPE_BUTTON, //!< Push Button
56         ELETYPE_SPACER, //!< Visual Spacer (horizontal / vertical rule)
57         ELETYPE_TEXTINPUT,      //!< Text Input Field
58         ELETYPE_TEXTBOX,        //!< Text Box Input
59
60         ELETYPE_TABBAR, //!< Tab Bar
61         ELETYPE_TOOLBAR,        //!< Tool Bar
62         
63         NUM_ELETYPES
64 };
65
66 enum eElementFlags
67 {
68         /**
69          * \brief Rendered
70          * 
71          * If set, the element will be ignored in calculating sizes and
72          * rendering.
73          */
74         ELEFLAG_NORENDER    = 0x001,
75         /**
76          * \brief Element visibility
77          * 
78          * If set, the element is not drawn (but still is used for size calculations)
79          */
80         ELEFLAG_INVISIBLE   = 0x002,
81         
82         /**
83          * \brief Position an element absulutely (ignored in size calcs)
84          */
85         ELEFLAG_ABSOLUTEPOS = 0x004,
86         
87         /**
88          * \brief Fixed size element
89          */
90         ELEFLAG_FIXEDSIZE   = 0x008,
91         
92         /**
93          * \brief Element "orientation"
94          * 
95          * Vertical means that the children of this element are stacked,
96          * otherwise they list horizontally
97          */
98         ELEFLAG_VERTICAL    = 0x010,//  ELEFLAG_HORIZONTAL  = 0x000,
99         /**
100          * \brief Action for text that overflows
101          */
102         ELEFLAG_WRAP        = 0x020,//  ELEFLAG_NOWRAP      = 0x000,
103         /**
104          * \brief Cross size action
105          * 
106          * If this flag is set, the element will only be as large (across
107          * its parent) as is needed to encase the contents of the element.
108          * Otherwise, the element will expand to fill all avaliable space.
109          */
110         ELEFLAG_NOEXPAND    = 0x040,
111         
112         /**
113          * \brief With (length) size action
114          * If this flag is set, the element will only be as large as
115          * is required along it's parent
116          */
117         ELEFLAG_NOSTRETCH   = 0x080,
118         
119         /**
120          * \brief Center alignment
121          */
122         ELEFLAG_ALIGN_CENTER= 0x100,
123         /**
124          * \brief Right/Bottom alignment
125          * 
126          * If set, the element aligns to the end of avaliable space (instead
127          * of the beginning)
128          */
129         ELEFLAG_ALIGN_END       = 0x200
130 };
131
132
133 #endif
134

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