ui/ui/button.h

changeset 109
c3dfcb8f0be7
parent 108
77254bd6dccb
child 112
c3f2f16fa4b8
equal deleted inserted replaced
108:77254bd6dccb 109:c3dfcb8f0be7
33 33
34 #ifdef __cplusplus 34 #ifdef __cplusplus
35 extern "C" { 35 extern "C" {
36 #endif 36 #endif
37 37
38 enum UiLinkType {
39 UI_LINK_TEXT = 0,
40 UI_LINK_BUTTON
41 };
42 typedef enum UiLinkType UiLinkType;
43
38 typedef struct UiButtonArgs { 44 typedef struct UiButtonArgs {
39 UiBool fill; 45 UiBool fill;
40 UiBool hexpand; 46 UiBool hexpand;
41 UiBool vexpand; 47 UiBool vexpand;
42 UiBool hfill; 48 UiBool hfill;
79 void* onchangedata; 85 void* onchangedata;
80 int enable_group; 86 int enable_group;
81 87
82 const int* groups; 88 const int* groups;
83 } UiToggleArgs; 89 } UiToggleArgs;
90
91 typedef struct UiLinkButtonArgs {
92 UiBool fill;
93 UiBool hexpand;
94 UiBool vexpand;
95 UiBool hfill;
96 UiBool vfill;
97 UiBool override_defaults;
98 int colspan;
99 int rowspan;
100 const char *name;
101 const char *style_class;
102
103 const char *label;
104 const char *uri;
105 UiString *value;
106 const char *varname;
107 ui_callback onclick;
108 void *onclickdata;
109 UiBool nofollow;
110 UiLinkType type;
111
112 const int* groups;
113 } UiLinkButtonArgs;
84 114
85 #define ui_button(obj, ...) ui_button_create(obj, &(UiButtonArgs){ __VA_ARGS__ } ) 115 #define ui_button(obj, ...) ui_button_create(obj, &(UiButtonArgs){ __VA_ARGS__ } )
86 #define ui_togglebutton(obj, ...) ui_togglebutton_create(obj, &(UiToggleArgs){ __VA_ARGS__ } ) 116 #define ui_togglebutton(obj, ...) ui_togglebutton_create(obj, &(UiToggleArgs){ __VA_ARGS__ } )
87 #define ui_checkbox(obj, ...) ui_checkbox_create(obj, &(UiToggleArgs){ __VA_ARGS__ } ) 117 #define ui_checkbox(obj, ...) ui_checkbox_create(obj, &(UiToggleArgs){ __VA_ARGS__ } )
88 #define ui_switch(obj, ...) ui_switch_create(obj, &(UiToggleArgs){ __VA_ARGS__ } ) 118 #define ui_switch(obj, ...) ui_switch_create(obj, &(UiToggleArgs){ __VA_ARGS__ } )
89 #define ui_radiobutton(obj, ...) ui_radiobutton_create(obj, &(UiToggleArgs){ __VA_ARGS__ } ) 119 #define ui_radiobutton(obj, ...) ui_radiobutton_create(obj, &(UiToggleArgs){ __VA_ARGS__ } )
120 #define ui_linkbutton(obj, ...) ui_linkbutton_create(obj, &(UiLinkButtonArgs){ __VA_ARGS__ })
90 121
91 UIEXPORT UIWIDGET ui_button_create(UiObject* obj, UiButtonArgs *args); 122 UIEXPORT UIWIDGET ui_button_create(UiObject *obj, UiButtonArgs *args);
92 UIEXPORT UIWIDGET ui_togglebutton_create(UiObject* obj, UiToggleArgs *args); 123 UIEXPORT UIWIDGET ui_togglebutton_create(UiObject *obj, UiToggleArgs *args);
93 UIEXPORT UIWIDGET ui_checkbox_create(UiObject* obj, UiToggleArgs *args); 124 UIEXPORT UIWIDGET ui_checkbox_create(UiObject *obj, UiToggleArgs *args);
94 UIEXPORT UIWIDGET ui_switch_create(UiObject* obj, UiToggleArgs *args); 125 UIEXPORT UIWIDGET ui_switch_create(UiObject *obj, UiToggleArgs *args);
95 UIEXPORT UIWIDGET ui_radiobutton_create(UiObject* obj, UiToggleArgs *args); 126 UIEXPORT UIWIDGET ui_radiobutton_create(UiObject *obj, UiToggleArgs *args);
127 UIEXPORT UIWIDGET ui_linkbutton_create(UiObject *obj, UiLinkButtonArgs *args);
96 128
129 UIEXPORT void ui_button_set_label(UIWIDGET button, const char *label);
130 UIEXPORT void ui_button_set_icon(UIWIDGET button, const char *icon);
97 131
132 UIEXPORT void ui_linkbutton_value_set(UiString *str, const char *label, const char *uri);
133 UIEXPORT void ui_linkbutton_value_set_label(UiString *str, const char *label);
134 UIEXPORT void ui_linkbutton_value_set_uri(UiString *str, const char *uri);
135 UIEXPORT void ui_linkbutton_value_set_visited(UiString *str, UiBool visited);
98 136
137 UIEXPORT void ui_linkbutton_set_label(UIWIDGET button, const char *label);
138 UIEXPORT void ui_linkbutton_set_uri(UIWIDGET button, const char *label);
139 UIEXPORT void ui_linkbutton_set_visited(UIWIDGET button, UiBool visited);
140 UIEXPORT char* ui_linkbutton_get_label(UIWIDGET button);
141 UIEXPORT char* ui_linkbutton_get_uri(UIWIDGET button);
142 UIEXPORT UiBool ui_linkbutton_get_visited(UIWIDGET button);
99 143
100 #ifdef __cplusplus 144 #ifdef __cplusplus
101 } 145 }
102 #endif 146 #endif
103 147

mercurial