ui/ui/toolkit.h

changeset 95
29f5cd5f5367
parent 94
d51e334c1439
child 99
ea1a2d5de765
equal deleted inserted replaced
94:d51e334c1439 95:29f5cd5f5367
78 /* public types */ 78 /* public types */
79 typedef int UiBool; 79 typedef int UiBool;
80 80
81 typedef struct UiObject UiObject; 81 typedef struct UiObject UiObject;
82 typedef struct UiEvent UiEvent; 82 typedef struct UiEvent UiEvent;
83 typedef struct UiMouseEvent UiMouseEvent;
83 typedef struct UiObserver UiObserver; 84 typedef struct UiObserver UiObserver;
84 85
85 typedef struct UiInteger UiInteger; 86 typedef struct UiInteger UiInteger;
86 typedef struct UiString UiString; 87 typedef struct UiString UiString;
87 typedef struct UiText UiText; 88 typedef struct UiText UiText;
90 /* private types */ 91 /* private types */
91 typedef struct UiContext UiContext; 92 typedef struct UiContext UiContext;
92 typedef struct UiContainer UiContainer; 93 typedef struct UiContainer UiContainer;
93 94
94 typedef struct UiTabbedPane UiTabbedPane; 95 typedef struct UiTabbedPane UiTabbedPane;
96
97 enum UiMouseEventType { UI_PRESS = 0, UI_PRESS2 };
95 98
96 #define ui_getval(val) (val).get(&(val)) 99 #define ui_getval(val) (val).get(&(val))
97 #define ui_setval(val, v) (val).set(&(val), v) 100 #define ui_setval(val, v) (val).set(&(val), v)
98 101
99 #define ui_getsubstr(text, begin, end) (text).getsubstr(&(text), begin, end) 102 #define ui_getsubstr(text, begin, end) (text).getsubstr(&(text), begin, end)
157 UiObject *obj; 160 UiObject *obj;
158 void *document; 161 void *document;
159 void *window; 162 void *window;
160 void *eventdata; 163 void *eventdata;
161 int intval; 164 int intval;
165 };
166
167 struct UiMouseEvent {
168 int x;
169 int y;
170 enum UiMouseEventType type;
171 int button;
162 }; 172 };
163 173
164 struct UiObserver { 174 struct UiObserver {
165 ui_callback callback; 175 ui_callback callback;
166 void *data; 176 void *data;
323 void ui_clipboard_set(char *str); 333 void ui_clipboard_set(char *str);
324 char* ui_clipboard_get(); 334 char* ui_clipboard_get();
325 335
326 void ui_add_image(char *imgname, char *filename); 336 void ui_add_image(char *imgname, char *filename);
327 337
328 338 // common widget functions
329 339 void ui_mouse_handler(UiObject *obj, UIWIDGET widget, ui_callback f, void *u);
340
341 // label widgets
330 UIWIDGET ui_label(UiObject *obj, char *label); 342 UIWIDGET ui_label(UiObject *obj, char *label);
331 UIWIDGET ui_llabel(UiObject *obj, char *label); 343 UIWIDGET ui_llabel(UiObject *obj, char *label);
332 UIWIDGET ui_rlabel(UiObject *obj, char *label); 344 UIWIDGET ui_rlabel(UiObject *obj, char *label);
333 UIWIDGET ui_space(UiObject *obj); 345 UIWIDGET ui_space(UiObject *obj);
334 UIWIDGET ui_separator(UiObject *obj); 346 UIWIDGET ui_separator(UiObject *obj);

mercurial