6 #define EVENT_UNHANDLED 0
7 #define EVENT_HANDLED 1
16 #define UI_WIDGET_NULL 0x00
17 #define UI_WIDGET_LABEL 0x01
18 #define UI_WIDGET_BUTTON 0x02
19 #define UI_WIDGET_CONTAINER 0x03
20 #define UI_WIDGET_TEXT 0x04
21 #define UI_WIDGET_NUM 0x05
22 #define UI_WIDGET_CHECK 0x06
23 #define UI_WIDGET_HEADER 0x07
24 #define UI_WIDGET_CONSOLE 0x08
25 #define UI_WIDGET_PBAR 0x09
26 #define UI_WIDGET_TEXTBOX 0x0A
27 #define UI_WIDGET_HSLIDE 0x0B
28 #define UI_WIDGET_LIST 0x0C
29 #define UI_WIDGET_LISTROW 0x0D
33 #ifndef _HAVE_SPRITE_TYPE
34 #define _HAVE_SPRITE_TYPE
35 typedef struct sprite_s
{
44 #ifndef _HAVE_MSGBOX_DATA_TYPE
45 #define _HAVE_MSGBOX_DATA_TYPE
46 typedef struct msgbox_data_s
{
47 struct widget_s
*container
;
49 struct widget_s
*btn1
;
50 struct widget_s
*btn2
;
51 int (*btn1_func
)(struct widget_s
*);
52 int (*btn2_func
)(struct widget_s
*);
56 #ifndef _HAVE_LISTROW_DATA_TYPE
57 #define _HAVE_LISTROW_DATA_TYPE
58 typedef struct listrow_data_s
{
63 #ifndef _HAVE_LISTCOLUMN_TYPE
64 #define _HAVE_LISTCOLUMN_TYPE
65 typedef struct list_column_s
{
71 #ifndef _HAVE_LIST_DATA_TYPE
72 #define _HAVE_LIST_DATA_TYPE
73 typedef struct list_data_s
{
78 int (*click
)(struct widget_s
*);
79 list_column_t
*columns
;
83 #ifndef _HAVE_OPTBOX_BTN_TYPE
84 #define _HAVE_OPTBOX_BTN_TYPE
85 typedef struct optbox_btn_s
{
87 int (*func
)(struct widget_s
*);
88 struct optbox_btn_s
*next
;
92 #ifndef _HAVE_OPTBOX_DATA_TYPE
93 #define _HAVE_OPTBOX_DATA_TYPE
94 typedef struct optbox_data_s
{
95 struct widget_s
*container
;
97 optbox_btn_t
*buttons
;
101 #ifndef _HAVE_OPTION_DATA_TYPE
102 #define _HAVE_OPTION_DATA_TYPE
103 typedef struct option_data_s
{
108 #ifndef _HAVE_CHECKBOX_DATA_TYPE
109 #define _HAVE_CHECKBOX_DATA_TYPE
110 typedef struct checkbox_data_s
{
115 #ifndef _HAVE_NUMBOX_DATA_TYPE
116 #define _HAVE_NUMBOX_DATA_TYPE
117 typedef struct numbox_data_s
{
124 #ifndef _HAVE_CONSOLE_LINE_TYPE
125 #define _HAVE_CONSOLE_LINE_TYPE
126 typedef struct console_line_s
{
127 struct console_line_s
*prev
;
128 struct console_line_s
*next
;
133 #ifndef _HAVE_CONSOLE_DATA_TYPE
134 #define _HAVE_CONSOLE_DATA_TYPE
135 typedef struct console_data_s
{
136 console_line_t
*lines
;
142 #ifndef _HAVE_SLIDE_DATA_TYPE
143 #define _HAVE_SLIDE_DATA_TYPE
144 typedef struct slide_data_s
{
152 #ifndef _HAVE_PBAR_DATA_TYPE
153 #define _HAVE_PBAR_DATA_TYPE
154 typedef struct pbar_data_s
{
162 #ifndef _HAVE_WIDGET_DATA_TYPE
163 #define _HAVE_WIDGET_DATA_TYPE
164 typedef union widget_data_u
{
178 #ifndef _HAVE_WIDGET_EVENTS_TYPE
179 #define _HAVE_WIDGET_EVENTS_TYPE
180 typedef struct widget_events_s
{
181 int (*mclick
)(struct widget_s
*w
);
182 int (*mdown
)(struct widget_s
*w
);
183 int (*mup
)(struct widget_s
*w
);
184 int (*sdown
)(struct widget_s
*w
);
185 int (*sup
)(struct widget_s
*w
);
186 int (*mmove
)(struct widget_s
*w
);
187 int (*kdown
)(struct widget_s
*w
);
188 int (*kup
)(struct widget_s
*w
);
189 int (*show
)(struct widget_s
*w
);
190 int (*hide
)(struct widget_s
*w
);
194 #ifndef _HAVE_WIDGET_STYLE_TYPE
195 #define _HAVE_WIDGET_STYLE_TYPE
196 typedef struct widget_style_s
{
202 int visibility_changed
;
220 #ifndef _HAVE_WIDGET_TYPE
221 #define _HAVE_WIDGET_TYPE
222 typedef struct widget_s
{
223 struct widget_s
*prev
;
224 struct widget_s
*next
;
231 widget_style_t style
;
233 widget_events_t
*events
;
234 struct widget_s
*parent
;
235 struct widget_s
*child
;
239 /* defined in ui.c */
241 widget_t
*ui_widget_container(void);
242 void ui_render(void);
243 void ui_msg(uint8_t type
, char* txt
, int (*func
)(), ...);
244 void ui_opt(char* txt
, ...);