| 677 ui_button(obj, .label = "Test 4"); |
677 ui_button(obj, .label = "Test 4"); |
| 678 } |
678 } |
| 679 ui_show(obj); |
679 ui_show(obj); |
| 680 } |
680 } |
| 681 |
681 |
| |
682 static void content_toggled(UiEvent *event, void *userdata) { |
| |
683 int i = ui_var_get_int(event->obj->ctx, "ctntoggle"); |
| |
684 printf("content toggled: %d : %d\n", i, event->intval); |
| |
685 } |
| |
686 |
| 682 void application_startup(UiEvent *event, void *data) { |
687 void application_startup(UiEvent *event, void *data) { |
| 683 // test window destruction |
688 // test window destruction |
| 684 UiObject *testobj = ui_window("testwindow"); |
689 UiObject *testobj = ui_window("testwindow"); |
| 685 ui_object_unref(testobj); |
690 ui_object_unref(testobj); |
| 686 |
691 |
| 722 ui_button(obj, .label = "Activate Group 1", .hexpand = TRUE, .onclick = action_group1); |
727 ui_button(obj, .label = "Activate Group 1", .hexpand = TRUE, .onclick = action_group1); |
| 723 ui_button(obj, .label = "Disable Group 1", .onclick = action_group1, .onclickdata = "disable"); |
728 ui_button(obj, .label = "Disable Group 1", .onclick = action_group1, .onclickdata = "disable"); |
| 724 ui_newline(obj); |
729 ui_newline(obj); |
| 725 ui_button(obj, .label = "Activate Group 2", .hexpand = TRUE, .onclick = action_group2); |
730 ui_button(obj, .label = "Activate Group 2", .hexpand = TRUE, .onclick = action_group2); |
| 726 ui_button(obj, .label = "Disable Group 2", .onclick = action_group2, .onclickdata = "disable"); |
731 ui_button(obj, .label = "Disable Group 2", .onclick = action_group2, .onclickdata = "disable"); |
| |
732 ui_newline(obj); |
| |
733 |
| |
734 ui_content_togglebutton(obj, .label0 = "Off", .label1 = "On", .tooltip0 = "enable", .tooltip1 = "disable", .istogglebutton = TRUE, .onchange = content_toggled, .varname = "ctntoggle"); |
| 727 ui_newline(obj); |
735 ui_newline(obj); |
| 728 |
736 |
| 729 ui_button(obj, .label = "Groups 1,2", .colspan = 2, .states = UI_STATES(1, 2)); |
737 ui_button(obj, .label = "Groups 1,2", .colspan = 2, .states = UI_STATES(1, 2)); |
| 730 ui_newline(obj); |
738 ui_newline(obj); |
| 731 |
739 |