96 void action_menu(UiEvent *event, void *data) { |
96 void action_menu(UiEvent *event, void *data) { |
97 printf("action_menu test: {%s}\n", data); |
97 printf("action_menu test: {%s}\n", data); |
98 fflush(stdout); |
98 fflush(stdout); |
99 } |
99 } |
100 |
100 |
|
101 void action_button(UiEvent *event, void *data) { |
|
102 printf("button clicked\n"); |
|
103 fflush(stdout); |
|
104 } |
|
105 |
101 int main(int argc, char** argv) { |
106 int main(int argc, char** argv) { |
102 ui_init("app1", argc, argv); |
107 ui_init("app1", argc, argv); |
103 |
108 |
104 ui_menu("File"); |
109 ui_menu("File"); |
105 ui_menuitem("Hello", action_menu, "hello"); |
110 ui_menuitem("Hello", action_menu, "hello"); |
110 ui_menuitem("item3", NULL, NULL); |
115 ui_menuitem("item3", NULL, NULL); |
111 ui_submenu_end(); |
116 ui_submenu_end(); |
112 ui_menuitem("item4", NULL, NULL); |
117 ui_menuitem("item4", NULL, NULL); |
113 |
118 |
114 UiObject *obj = ui_window("Test", NULL); |
119 UiObject *obj = ui_window("Test", NULL); |
|
120 ui_button(obj, "Test1", action_button, NULL); |
|
121 ui_button(obj, "Test2", action_button, NULL); |
|
122 ui_button(obj, "Test3", action_button, NULL); |
|
123 ui_button(obj, "Test4", action_button, NULL); |
115 ui_show(obj); |
124 ui_show(obj); |
116 ui_main(); |
125 ui_main(); |
117 /* |
126 /* |
118 ui_locales_dir("/opt/app1/locales"); |
127 ui_locales_dir("/opt/app1/locales"); |
119 ui_load_lang_def(NULL, "en_EN"); |
128 ui_load_lang_def(NULL, "en_EN"); |