application/main.c

branch
newapi
changeset 389
d15eca5fd8b3
parent 388
473c03f85197
child 390
b130f80ec7f9
equal deleted inserted replaced
388:473c03f85197 389:d15eca5fd8b3
237 ui_button(obj, .label = "Unref", .onclick = action_button_unref, .onclickdata = ref_window); 237 ui_button(obj, .label = "Unref", .onclick = action_button_unref, .onclickdata = ref_window);
238 } 238 }
239 ui_show(obj); 239 ui_show(obj);
240 } 240 }
241 241
242 UiMenuBuilder *menubuilder;
243
242 void application_startup(UiEvent *event, void *data) { 244 void application_startup(UiEvent *event, void *data) {
243 // global list 245 // global list
244 UiContext *global = ui_global_context(); 246 UiContext *global = ui_global_context();
245 menu_list = ui_list_new(global, "menulist"); 247 menu_list = ui_list_new(global, "menulist");
246 ui_list_append(menu_list, "menu list item 1"); 248 ui_list_append(menu_list, "menu list item 1");
325 ui_tab(obj, "Tab 4") { 327 ui_tab(obj, "Tab 4") {
326 ui_textarea(obj, .varname = "text"); 328 ui_textarea(obj, .varname = "text");
327 } 329 }
328 ui_tab(obj, "Tab 5") { 330 ui_tab(obj, "Tab 5") {
329 ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button); 331 ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button);
330 ui_imageviewer(obj, .varname = "image", .style_class = "imageviewer"); 332 ui_imageviewer(obj, .varname = "image", .style_class = "imageviewer", .contextmenu = menubuilder);
331 } 333 }
332 334
333 ui_tab(obj, "Tab 6") { 335 ui_tab(obj, "Tab 6") {
334 ui_scrolledwindow(obj, .fill = UI_ON) { 336 ui_scrolledwindow(obj, .fill = UI_ON) {
335 ui_expander(obj, .label = "Expander", .margin = 10, .spacing = 10) { 337 ui_expander(obj, .label = "Expander", .margin = 10, .spacing = 10) {
367 // menu 369 // menu
368 ui_menu("File") { 370 ui_menu("File") {
369 ui_menuitem(.label = "Test"); 371 ui_menuitem(.label = "Test");
370 } 372 }
371 373
372 UiMenuBuilder *menubuilder;
373 ui_contextmenu(&menubuilder) { 374 ui_contextmenu(&menubuilder) {
374 ui_menuitem(.label = "Context Item 1"); 375 ui_menuitem(.label = "Context Item 1");
375 ui_menuitem(.label = "Context Item 2"); 376 ui_menuitem(.label = "Context Item 2");
376 ui_menu("Context Submenu") { 377 ui_menu("Context Submenu") {
377 ui_menuitem(.label = "Context Sub Item"); 378 ui_menuitem(.label = "Context Sub Item");

mercurial