| 640 |
640 |
| 641 static void global_action_save(UiEvent *event, void *data) { |
641 static void global_action_save(UiEvent *event, void *data) { |
| 642 printf("global save\n"); |
642 printf("global save\n"); |
| 643 } |
643 } |
| 644 |
644 |
| |
645 static void action_test_dialog_onclick(UiEvent *event, void *userdata) { |
| |
646 ui_close(event->obj); |
| |
647 } |
| |
648 |
| |
649 static void action_test_dialog(UiEvent *event, void *userdata) { |
| |
650 UiObject *obj = ui_dialog_window(event->obj, .title = "Test Dialog", .lbutton1 = "OK", .rbutton4 = "Cancel", .onclick = action_test_dialog_onclick); |
| |
651 ui_vbox(obj, .margin = 10, .spacing = 10) { |
| |
652 ui_button(obj, .label = "Test 1"); |
| |
653 ui_button(obj, .label = "Test 2"); |
| |
654 ui_button(obj, .label = "Test 3"); |
| |
655 ui_button(obj, .label = "Test 4"); |
| |
656 } |
| |
657 ui_show(obj); |
| |
658 } |
| |
659 |
| 645 void application_startup(UiEvent *event, void *data) { |
660 void application_startup(UiEvent *event, void *data) { |
| 646 // test window destruction |
661 // test window destruction |
| 647 UiObject *testobj = ui_window("testwindow"); |
662 UiObject *testobj = ui_window("testwindow"); |
| 648 ui_object_unref(testobj); |
663 ui_object_unref(testobj); |
| 649 |
664 |
| 757 ui_button(obj, .label = "Button 2 Notify Thread", .onclick=action_notify_thread); |
772 ui_button(obj, .label = "Button 2 Notify Thread", .onclick=action_notify_thread); |
| 758 ui_button(obj, .label = "Obj Ref", .onclick=action_button_ref); |
773 ui_button(obj, .label = "Obj Ref", .onclick=action_button_ref); |
| 759 ui_button(obj, .label = "Obj Unref", .onclick=action_button_unref, .onclickdata = obj); |
774 ui_button(obj, .label = "Obj Unref", .onclick=action_button_unref, .onclickdata = obj); |
| 760 ui_button(obj, .label = "Button 5", .onclick=action_tab2_button); |
775 ui_button(obj, .label = "Button 5", .onclick=action_tab2_button); |
| 761 ui_button(obj, .label = "Button 6", .onclick=action_tab2_button); |
776 ui_button(obj, .label = "Button 6", .onclick=action_tab2_button); |
| |
777 ui_button(obj, .label = "Test Dialog", .onclick=action_test_dialog); |
| 762 } |
778 } |
| 763 ui_tab(obj, "Tab 3") { |
779 ui_tab(obj, "Tab 3") { |
| 764 UiTabViewArgs args = {.fill = TRUE}; |
780 UiTabViewArgs args = {.fill = TRUE}; |
| 765 UI_CTN(obj, tabview=ui_tabview_create(obj, &args)) { |
781 UI_CTN(obj, tabview=ui_tabview_create(obj, &args)) { |
| 766 UiObject *tab1 = ui_tabview_add(tabview, "Sub 1", -1); |
782 UiObject *tab1 = ui_tabview_add(tabview, "Sub 1", -1); |