make/vs/testapp/main.c

branch
newapi
changeset 186
5db4979bf482
parent 185
4a8b1a748f09
child 187
24ce2c326d85
equal deleted inserted replaced
185:4a8b1a748f09 186:5db4979bf482
28 28
29 #include <Windows.h> 29 #include <Windows.h>
30 30
31 #include <stdio.h> 31 #include <stdio.h>
32 #include <stdlib.h> 32 #include <stdlib.h>
33 #include <stdbool.h>
33 34
34 #include <ui/ui.h> 35 #include <ui/ui.h>
35 36
36 37
37 void action1(UiEvent* event, void* data) { 38 void action1(UiEvent* event, void* data) {
38 char* action = data; 39 char* action = data;
39 printf("hello world!\n"); 40 printf("data: %s!\n", data);
40 } 41 }
41 42
42 void application_startup(UiEvent* event, void* data) { 43 void application_startup(UiEvent* event, void* data) {
43 UiObject* obj = ui_window("Test", NULL); 44 UiObject* obj = ui_window("Test", NULL);
44 45
45 /*
46 ui_button(obj, "Button1", action1, "action1");
47 ui_button(obj, "Button2", action1, "action2");
48 ui_layout_fill(obj, TRUE);
49 ui_button(obj, "Button3", action1, "action3");
50 */
51
52 UI_GRID_SP(obj, 10, 5, 20) { 46 UI_GRID_SP(obj, 10, 5, 20) {
53 ui_button(obj, "Button1", action1, "action1"); 47 ui_button(obj, .label="Button1", .onclick=action1, .onclickdata="action1");
54 ui_button(obj, "Button2", action1, "action2"); 48 ui_button(obj, .label="Button2", .onclick=action1, .onclickdata="action2");
55 ui_layout_hexpand(obj, 1); 49 ui_button(obj, .label="Button3", .onclick=action1, .onclickdata="action3", .hexpand=true);
56 ui_button(obj, "Button3", action1, "action3");
57 ui_newline(obj); 50 ui_newline(obj);
58 51
59 ui_button(obj, "Button4", action1, "action4"); 52 ui_button(obj, .label="Button4", .onclick=action1, .onclickdata="action4");
60 ui_layout_gridwidth(obj, 2); 53 ui_button(obj, .label="Button5", .onclick=action1, .onclickdata="action5", .colspan=2);
61 ui_button(obj, "Button5_", action1, "action5");
62 ui_newline(obj); 54 ui_newline(obj);
63 55
64 ui_button(obj, "Very Long Button Label Text ____________ Test", action1, "test"); 56 ui_button(obj, .label="Very Long Button Label Text ____________ Test", .onclick=action1, .onclickdata="test");
65 } 57 }
66 58
67 ui_show(obj); 59 ui_show(obj);
68 } 60 }
69 61

mercurial