diff -r 91f45354d1e2 -r 3c63f57a8f77 application/main.c --- a/application/main.c Sun Feb 01 12:37:31 2015 +0100 +++ b/application/main.c Wed Feb 11 11:34:55 2015 +0100 @@ -33,7 +33,6 @@ #include #include -/* typedef struct Person { char *name; char *mail; @@ -91,49 +90,23 @@ void action_test(UiEvent *event, void *data) { //ui_select_tab(tabview, 0); } -*/ void action_menu(UiEvent *event, void *data) { printf("action_menu test: {%s}\n", data); fflush(stdout); } -void action_button(UiEvent *event, void *data) { - printf("button clicked\n"); - fflush(stdout); +void action_combobox_select(UiEvent *event, void *data) { + UiList *list = data; + int i = event->intval; + printf("selection{%s}[%d]\n", ui_list_get(list, i), i); } + int main(int argc, char** argv) { + ui_locales_dir("/opt/app1/locales"); + ui_load_lang_def(NULL, "en_EN"); ui_init("app1", argc, argv); - - ui_menu("File"); - ui_menuitem("Hello", action_menu, "hello"); - ui_submenu("Submenu1"); - ui_submenu("Submenu2"); - ui_menuitem("item2", NULL, NULL); - ui_submenu_end(); - ui_menuitem("item3", NULL, NULL); - ui_submenu_end(); - ui_menuitem("item4", NULL, NULL); - - UiObject *obj = ui_window("Test", NULL); - ui_layout_fill(obj, FALSE); - ui_hbox(obj); - ui_button(obj, "HELLO", NULL, NULL); - ui_button(obj, "WORLD", NULL, NULL); - ui_layout_fill(obj, TRUE); - ui_button(obj, "BUTTON", NULL, NULL); - ui_end(obj); - ui_button(obj, "Test1", action_button, NULL); - ui_button(obj, "Test2", action_button, NULL); - ui_button(obj, "Test3", action_button, NULL); - ui_button(obj, "Test4", action_button, NULL); - ui_show(obj); - fflush(stdout); - ui_main(); - /* - ui_locales_dir("/opt/app1/locales"); - ui_load_lang_def(NULL, "en_EN"); //ui_openfilefunc(action_new, NULL); @@ -144,7 +117,17 @@ //ui_checkitem("Check", action_button, NULL); ui_toolitem_st("button", UI_STOCK_GO_BACK, action_button, NULL); + + UiList *cb = ui_list_new(); + ui_list_append(cb, "Hello World"); + ui_list_append(cb, "2"); + ui_list_append(cb, "3"); + ui_list_append(cb, "4"); + ui_list_append(cb, "5"); + ui_toolbar_combobox_str("combobox", cb, action_combobox_select, cb); + ui_toolbar_add_default("button"); + ui_toolbar_add_default("combobox"); printf("create window\n"); UiObject *window = ui_window("Mod0", NULL); @@ -191,6 +174,5 @@ ui_show(window); ui_main(); - */ return (EXIT_SUCCESS); }