62 ui_draw_text(g, 50, 50, text); |
62 ui_draw_text(g, 50, 50, text); |
63 |
63 |
64 ui_text_free(text); |
64 ui_text_free(text); |
65 } |
65 } |
66 |
66 |
|
67 void click(UiEvent *event, void *data) { |
|
68 UiMouseEvent *me = event->eventdata; |
|
69 printf("click[%d](%d,%d)\n", me->type, me->x, me->y); |
|
70 } |
|
71 |
67 int main(int argc, char** argv) { |
72 int main(int argc, char** argv) { |
68 ui_init("app1", argc, argv); |
73 ui_init("app1", argc, argv); |
69 |
74 |
70 ui_menu("File"); |
75 ui_menu("File"); |
71 ui_menuitem("Hello", action_menu, "hello"); |
76 ui_menuitem("Hello", action_menu, "hello"); |
81 ui_toolitem("button2", "OK", action_button, NULL); |
86 ui_toolitem("button2", "OK", action_button, NULL); |
82 ui_toolbar_add_default("button1"); |
87 ui_toolbar_add_default("button1"); |
83 ui_toolbar_add_default("button2"); |
88 ui_toolbar_add_default("button2"); |
84 |
89 |
85 UiObject *obj = ui_window("Test", NULL); |
90 UiObject *obj = ui_window("Test", NULL); |
86 ui_drawingarea(obj, draw, NULL); |
91 UIWIDGET w = ui_drawingarea(obj, draw, NULL); |
|
92 ui_mouse_handler(obj, w, click, NULL); |
87 |
93 |
88 ui_show(obj); |
94 ui_show(obj); |
89 ui_main(); |
95 ui_main(); |
90 |
96 |
91 return (EXIT_SUCCESS); |
97 return (EXIT_SUCCESS); |