72 |
72 |
73 void action_toolbar_button(UiEvent *event, void *userdata) { |
73 void action_toolbar_button(UiEvent *event, void *userdata) { |
74 printf("toolbar button\n"); |
74 printf("toolbar button\n"); |
75 |
75 |
76 ui_dialog(event->obj, .title = "Dialog Title", .content = "Content Label", .button1_label = "btn1", .button2_label = "btn2", .input = TRUE, .closebutton_label = "Cancel"); |
76 ui_dialog(event->obj, .title = "Dialog Title", .content = "Content Label", .button1_label = "btn1", .button2_label = "btn2", .input = TRUE, .closebutton_label = "Cancel"); |
|
77 } |
|
78 |
|
79 void action_toolbar_newwindow(UiEvent *event, void *userdata) { |
|
80 UiObject *obj = ui_simple_window("New Window", NULL); |
|
81 |
|
82 ui_headerbar0(obj) { |
|
83 ui_headerbar_start(obj) { |
|
84 ui_button(obj, .label = "Open"); |
|
85 } |
|
86 ui_headerbar_end(obj) { |
|
87 ui_button(obj, .label = "Test"); |
|
88 } |
|
89 } |
|
90 |
|
91 ui_textarea(obj, .varname="text"); |
|
92 |
|
93 ui_show(obj); |
77 } |
94 } |
78 |
95 |
79 MyDocument* create_doc(void) { |
96 MyDocument* create_doc(void) { |
80 MyDocument *doc = ui_document_new(sizeof(MyDocument)); |
97 MyDocument *doc = ui_document_new(sizeof(MyDocument)); |
81 UiContext *docctx = ui_document_context(doc); |
98 UiContext *docctx = ui_document_context(doc); |
225 ui_menu("File") { |
242 ui_menu("File") { |
226 ui_menuitem(.label = "Test"); |
243 ui_menuitem(.label = "Test"); |
227 } |
244 } |
228 |
245 |
229 ui_toolbar_item("Test", .label = "Test", .onclick = action_toolbar_button); |
246 ui_toolbar_item("Test", .label = "Test", .onclick = action_toolbar_button); |
230 ui_toolbar_item("Test2", .label = "Test 2", .onclick = action_toolbar_button); |
247 ui_toolbar_item("Test2", .label = "New Window", .onclick = action_toolbar_newwindow); |
231 ui_toolbar_item("Test3", .label = "Test 3", .onclick = action_toolbar_button); |
248 ui_toolbar_item("Test3", .label = "Test 3", .onclick = action_toolbar_button); |
232 ui_toolbar_item("Test4", .label = "Test 4", .onclick = action_toolbar_button); |
249 ui_toolbar_item("Test4", .label = "Test 4", .onclick = action_toolbar_button); |
233 ui_toolbar_item("Test5", .label = "Test 5", .onclick = action_toolbar_button); |
250 ui_toolbar_item("Test5", .label = "Test 5", .onclick = action_toolbar_button); |
234 ui_toolbar_item("Test6", .label = "Test 6", .onclick = action_toolbar_button); |
251 ui_toolbar_item("Test6", .label = "Test 6", .onclick = action_toolbar_button); |
235 ui_toolbar_toggleitem("Toggle", .label = "Toggle", .onchange = action_toolbar_button); |
252 ui_toolbar_toggleitem("Toggle", .label = "Toggle", .onchange = action_toolbar_button); |