83 doc->list = ui_list_new(docctx, "list"); |
84 doc->list = ui_list_new(docctx, "list"); |
84 ui_list_append(doc->list, "test1"); |
85 ui_list_append(doc->list, "test1"); |
85 ui_list_append(doc->list, "test2"); |
86 ui_list_append(doc->list, "test2"); |
86 ui_list_append(doc->list, "test3"); |
87 ui_list_append(doc->list, "test3"); |
87 doc->radio = ui_int_new(docctx, "radio"); |
88 doc->radio = ui_int_new(docctx, "radio"); |
|
89 doc->tabview = ui_int_new(docctx, "tabview"); |
88 return doc; |
90 return doc; |
89 } |
91 } |
90 |
92 |
91 UiIcon *icon = NULL; |
93 UiIcon *icon = NULL; |
92 |
94 |
115 ui_list_notify(menu_list); |
117 ui_list_notify(menu_list); |
116 } |
118 } |
117 |
119 |
118 void action_menu_list(UiEvent *event, void *userdata) { |
120 void action_menu_list(UiEvent *event, void *userdata) { |
119 printf("menu list item: %d\n", event->intval); |
121 printf("menu list item: %d\n", event->intval); |
|
122 } |
|
123 |
|
124 static int tab_x = 0; |
|
125 void action_tab2_button(UiEvent *event, void *userdata) { |
|
126 MyDocument *doc = event->document; |
|
127 printf("current page: %d\n", (int)ui_get(doc->tabview)); |
|
128 ui_set(doc->tabview, 0); |
120 } |
129 } |
121 |
130 |
122 void application_startup(UiEvent *event, void *data) { |
131 void application_startup(UiEvent *event, void *data) { |
123 // global list |
132 // global list |
124 UiContext *global = ui_global_context(); |
133 UiContext *global = ui_global_context(); |
132 UiObject *obj = ui_window("Test", NULL); |
141 UiObject *obj = ui_window("Test", NULL); |
133 |
142 |
134 MyDocument *doc = create_doc(); |
143 MyDocument *doc = create_doc(); |
135 ui_attach_document(obj->ctx, doc); |
144 ui_attach_document(obj->ctx, doc); |
136 |
145 |
137 ui_tabview(obj, .spacing=10, .margin=10, .tabview = UI_TABVIEW_NAVIGATION_SIDE) { |
146 ui_tabview(obj, .spacing=10, .margin=10, .tabview = UI_TABVIEW_NAVIGATION_SIDE, .varname="tabview") { |
138 ui_tab(obj, "Tab 1") { |
147 ui_tab(obj, "Tab 1") { |
139 ui_vbox(obj, .fill = UI_OFF, .margin = 15, .spacing = 15) { |
148 ui_vbox(obj, .fill = UI_OFF, .margin = 15, .spacing = 15) { |
140 ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button); |
149 ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button); |
141 ui_togglebutton(obj, .label = "Toggle"); |
150 ui_togglebutton(obj, .label = "Toggle"); |
142 ui_checkbox(obj, .label = "My Checkbox"); |
151 ui_checkbox(obj, .label = "My Checkbox"); |