application/main.c

changeset 107
9aff1dc3990d
parent 106
a4f4123ca12a
child 108
fcf6d5fac8f5
equal deleted inserted replaced
106:a4f4123ca12a 107:9aff1dc3990d
31 31
32 #include <ui/ui.h> 32 #include <ui/ui.h>
33 #include <ucx/buffer.h> 33 #include <ucx/buffer.h>
34 #include <ucx/utils.h> 34 #include <ucx/utils.h>
35 35
36 UiRadioButtonGroup rgroup;
37
36 void action_menu(UiEvent *event, void *data) { 38 void action_menu(UiEvent *event, void *data) {
37 printf("action_menu test: {%s}\n", data); 39 printf("action_menu test: {%s}\n", data);
38 printf("text: {%s}\n", ui_gettext(event->obj, "text")); 40 printf("text: {%s}\n", ui_gettext(event->obj, "text"));
39 fflush(stdout); 41 fflush(stdout);
40 42
43 fflush(stdout); 45 fflush(stdout);
44 free(file); 46 free(file);
45 } 47 }
46 48
47 void action_button(UiEvent *event, void *data) { 49 void action_button(UiEvent *event, void *data) {
48 printf("button clicked\n"); 50 printf("radio: %d\n", ui_radiobuttongroup_selection(&rgroup));
49 fflush(stdout); 51 fflush(stdout);
52 }
53
54 void action_button2(UiEvent *event, void *data) {
55 ui_radiobuttongroup_select(&rgroup, 3);
50 } 56 }
51 57
52 void draw(UiEvent *event, UiGraphics *g, void *data) { 58 void draw(UiEvent *event, UiGraphics *g, void *data) {
53 /* 59 /*
54 int width = g->width; 60 int width = g->width;
93 ui_toolitem("button1", "Test", action_button, NULL); 99 ui_toolitem("button1", "Test", action_button, NULL);
94 ui_toolitem("button2", "OK", action_button, NULL); 100 ui_toolitem("button2", "OK", action_button, NULL);
95 ui_toolbar_add_default("button1"); 101 ui_toolbar_add_default("button1");
96 ui_toolbar_add_default("button2"); 102 ui_toolbar_add_default("button2");
97 103
98 UiObject *obj = ui_window("Test", NULL); 104 UiObject *obj = ui_simplewindow("Test", NULL);
99 //UIWIDGET w = ui_drawingarea(obj, draw, NULL); 105 //UIWIDGET w = ui_drawingarea(obj, draw, NULL);
100 //ui_mouse_handler(obj, w, click, NULL); 106 //ui_mouse_handler(obj, w, click, NULL);
101 107
102 ///* 108 ///*
103 ui_grid_sp(obj, 8, 4, 4); 109 ui_vbox_sp(obj, 8, 8);
104 110
105 ui_button(obj, "OK", NULL, NULL); 111 ui_layout_fill(obj, FALSE);
106 ui_layout_hexpand(obj, TRUE); 112 ui_grid_sp(obj, 0, 4, 4);
107 ui_button(obj, "Google", NULL, NULL); 113 ui_label(obj, "Name");
108 ui_textfield(obj, NULL); 114 ui_textfield(obj, NULL);
109 ui_newline(obj); 115 ui_newline(obj);
110 116 ui_label(obj, "Email");
111 ui_vbox(obj);
112 ui_button(obj, "txt", NULL, NULL);
113 ui_textfield(obj, NULL); 117 ui_textfield(obj, NULL);
114 ui_end(obj); 118 ui_end(obj);
115 ui_layout_hexpand(obj, TRUE); 119
116 ui_layout_vexpand(obj, TRUE); 120 ui_separator(obj);
117 ui_textarea(obj, NULL); 121
118 ui_button(obj, "BTN1", NULL, NULL); 122 ui_layout_fill(obj, FALSE);
123 ui_grid_sp(obj, 0, 4, 4);
124 ui_checkbox(obj, "Shit", NULL);
125 ui_newline(obj);
126 ui_checkbox(obj, "Nein", NULL);
127 ui_checkbox(obj, "Nein", NULL);
128 ui_checkbox(obj, "Nein", NULL);
129 ui_end(obj);
130
131 ui_separator(obj);
132
133 ui_layout_fill(obj, FALSE);
134 ui_grid_sp(obj, 0, 4, 4);
135 rgroup = ui_radiobuttongroup();
136 ui_radiobutton(obj, "better", &rgroup);
137 ui_newline(obj);
138 ui_radiobutton(obj, "awesome", &rgroup);
139 ui_newline(obj);
140 ui_radiobutton(obj, "smarter", &rgroup);
141 ui_end(obj);
142
143 ui_button(obj, "OK", action_button, NULL);
144 ui_button(obj, "Activate", action_button2, NULL);
119 145
120 ui_end(obj); 146 ui_end(obj);
121 //*/ 147 //*/
122 148
123 ui_show(obj); 149 ui_show(obj);

mercurial