1 |
struct widget; // defined in gui_internal.c
|
2 |
struct graphics_image;
|
3 |
|
4 |
#define STATE_VISIBLE 1
|
5 |
#define STATE_SELECTED 2
|
6 |
#define STATE_HIGHLIGHTED 4
|
7 |
#define STATE_SENSITIVE 8
|
8 |
#define STATE_EDIT 16
|
9 |
#define STATE_CLEAR 32
|
10 |
#define STATE_EDITABLE 64
|
11 |
|
12 |
enum widget_type {
|
13 |
widget_box=1,
|
14 |
widget_button,
|
15 |
widget_label,
|
16 |
widget_image,
|
17 |
widget_table,
|
18 |
widget_table_row
|
19 |
};
|
20 |
|
21 |
enum flags {
|
22 |
gravity_none=0x00,
|
23 |
gravity_left=1,
|
24 |
gravity_xcenter=2,
|
25 |
gravity_right=4,
|
26 |
gravity_top=8,
|
27 |
gravity_ycenter=16,
|
28 |
gravity_bottom=32,
|
29 |
gravity_left_top=gravity_left|gravity_top,
|
30 |
gravity_top_center=gravity_xcenter|gravity_top,
|
31 |
gravity_right_top=gravity_right|gravity_top,
|
32 |
gravity_left_center=gravity_left|gravity_ycenter,
|
33 |
gravity_center=gravity_xcenter|gravity_ycenter,
|
34 |
gravity_right_center=gravity_right|gravity_ycenter,
|
35 |
gravity_left_bottom=gravity_left|gravity_bottom,
|
36 |
gravity_bottom_center=gravity_xcenter|gravity_bottom,
|
37 |
gravity_right_bottom=gravity_right|gravity_bottom,
|
38 |
flags_expand=0x100,
|
39 |
flags_fill=0x200,
|
40 |
orientation_horizontal=0x10000,
|
41 |
orientation_vertical=0x20000,
|
42 |
orientation_horizontal_vertical=0x40000,
|
43 |
};
|
44 |
|
45 |
|
46 |
struct gui_internal_methods {
|
47 |
void (*add_callback)(struct gui_priv *priv, struct callback *cb);
|
48 |
void (*remove_callback)(struct gui_priv *priv, struct callback *cb);
|
49 |
void (*menu_render)(struct gui_priv *this);
|
50 |
struct graphics_image * (*image_new_xs)(struct gui_priv *this, const char *name);
|
51 |
struct graphics_image * (*image_new_l)(struct gui_priv *this, const char *name);
|
52 |
};
|
53 |
|
54 |
struct gui_internal_widget_methods {
|
55 |
void (*append)(struct widget *parent, struct widget *child);
|
56 |
struct widget * (*button_new)(struct gui_priv *this, char *text, struct graphics_image *image, enum flags flags);
|
57 |
struct widget * (*button_new_with_callback)(struct gui_priv *this, char *text, struct graphics_image *image, enum flags flags, void(*func)(struct gui_priv *priv, struct widget *widget, void *data), void *data);
|
58 |
struct widget * (*box_new)(struct gui_priv *this, enum flags flags);
|
59 |
struct widget * (*label_new)(struct gui_priv *this, char *text);
|
60 |
struct widget * (*image_new)(struct gui_priv *this, struct graphics_image *image);
|
61 |
struct widget * (*keyboard)(struct gui_priv *this, int mode);
|
62 |
struct widget * (*menu)(struct gui_priv *this, const char *label);
|
63 |
enum flags (*get_flags)(struct widget *widget);
|
64 |
void (*set_flags)(struct widget *widget, enum flags flags);
|
65 |
int (*get_state)(struct widget *widget);
|
66 |
void (*set_state)(struct widget *widget, int state);
|
67 |
void (*set_func)(struct widget *widget, void (*func)(struct gui_priv *priv, struct widget *widget, void *data));
|
68 |
void (*set_data)(struct widget *widget, void *data);
|
69 |
void (*set_default_background)(struct gui_priv *this, struct widget *widget);
|
70 |
|
71 |
};
|
72 |
|
73 |
struct gui_internal_data {
|
74 |
struct gui_priv *priv;
|
75 |
struct gui_internal_methods *gui;
|
76 |
struct gui_internal_widget_methods *widget;
|
77 |
};
|