48 void action_menu(UiEvent *event, void *userdata) { |
48 void action_menu(UiEvent *event, void *userdata) { |
49 |
49 |
50 } |
50 } |
51 |
51 |
52 void action_button(UiEvent *event, void *userdata) { |
52 void action_button(UiEvent *event, void *userdata) { |
53 |
53 ui_dialog(event->obj, |
|
54 .title = "My Title", |
|
55 .button1_label = "OK", |
|
56 .button2_label = "Test", |
|
57 .closebutton_label = "Cancel", |
|
58 .content = "Hello World!", |
|
59 .input = true); |
54 } |
60 } |
55 |
61 |
56 void action_switch(UiEvent *event, void *userdata) { |
62 void action_switch(UiEvent *event, void *userdata) { |
57 |
63 |
58 } |
64 } |
96 UiObject *obj = ui_window("Test", NULL); |
102 UiObject *obj = ui_window("Test", NULL); |
97 |
103 |
98 MyDocument *doc = create_doc(); |
104 MyDocument *doc = create_doc(); |
99 ui_attach_document(obj->ctx, doc); |
105 ui_attach_document(obj->ctx, doc); |
100 |
106 |
101 ui_button(obj, .label = "Test Button", .icon = "application-x-generic"); |
107 ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button); |
102 ui_togglebutton(obj, .label = "Toggle"); |
108 ui_togglebutton(obj, .label = "Toggle"); |
103 ui_checkbox(obj, .label = "Checkbox"); |
109 ui_checkbox(obj, .label = "Checkbox"); |
104 |
110 |
105 ui_grid(obj, .fill = 1, .columnspacing = 5, .rowspacing = 5, .margin = 5) { |
111 ui_grid(obj, .fill = 1, .columnspacing = 5, .rowspacing = 5, .margin = 5) { |
106 ui_button(obj, .label = "cell1", .hexpand = TRUE); |
112 ui_button(obj, .label = "cell1", .hexpand = TRUE); |