application/main.c

branch
newapi
changeset 390
b130f80ec7f9
parent 389
d15eca5fd8b3
child 402
96a055be7f0b
equal deleted inserted replaced
389:d15eca5fd8b3 390:b130f80ec7f9
38 UiString *str2; 38 UiString *str2;
39 UiString *path; 39 UiString *path;
40 UiText *text; 40 UiText *text;
41 UiDouble *progress; 41 UiDouble *progress;
42 UiList *list; 42 UiList *list;
43 UiList *list2;
43 UiList *menulist; 44 UiList *menulist;
44 UiInteger *radio; 45 UiInteger *radio;
45 UiInteger *tabview; 46 UiInteger *tabview;
46 UiGeneric *image; 47 UiGeneric *image;
47 } MyDocument; 48 } MyDocument;
150 doc->progress = ui_double_new(docctx, "progress"); 151 doc->progress = ui_double_new(docctx, "progress");
151 doc->list = ui_list_new(docctx, "list"); 152 doc->list = ui_list_new(docctx, "list");
152 ui_list_append(doc->list, "test1"); 153 ui_list_append(doc->list, "test1");
153 ui_list_append(doc->list, "test2"); 154 ui_list_append(doc->list, "test2");
154 ui_list_append(doc->list, "test3"); 155 ui_list_append(doc->list, "test3");
156 doc->list2 = ui_list_new(docctx, "list2");
157 ui_list_append(doc->list2, "test1");
158 ui_list_append(doc->list2, "test2");
159 ui_list_append(doc->list2, "test3");
155 doc->radio = ui_int_new(docctx, "radio"); 160 doc->radio = ui_int_new(docctx, "radio");
156 doc->tabview = ui_int_new(docctx, "tabview"); 161 doc->tabview = ui_int_new(docctx, "tabview");
157 doc->image = ui_generic_new(docctx, "image"); 162 doc->image = ui_generic_new(docctx, "image");
158 //doc->text = ui_text_new(docctx, "text"); 163 //doc->text = ui_text_new(docctx, "text");
159 return doc; 164 return doc;
238 } 243 }
239 ui_show(obj); 244 ui_show(obj);
240 } 245 }
241 246
242 UiMenuBuilder *menubuilder; 247 UiMenuBuilder *menubuilder;
248
249 void* table_getvalue(void *row, int col) {
250 return row;
251 }
243 252
244 void application_startup(UiEvent *event, void *data) { 253 void application_startup(UiEvent *event, void *data) {
245 // global list 254 // global list
246 UiContext *global = ui_global_context(); 255 UiContext *global = ui_global_context();
247 menu_list = ui_list_new(global, "menulist"); 256 menu_list = ui_list_new(global, "menulist");
301 ui_hbox0(obj) { 310 ui_hbox0(obj) {
302 ui_radiobutton(obj, .label = "Radio 1", .varname = "radio"); 311 ui_radiobutton(obj, .label = "Radio 1", .varname = "radio");
303 ui_radiobutton(obj, .label = "Radio 2", .varname = "radio"); 312 ui_radiobutton(obj, .label = "Radio 2", .varname = "radio");
304 ui_radiobutton(obj, .label = "Radio 3", .varname = "radio"); 313 ui_radiobutton(obj, .label = "Radio 3", .varname = "radio");
305 } 314 }
315 ui_newline(obj);
316
317 UiModel *model = ui_model(obj->ctx, UI_STRING, "col1", -1);
318 model->getvalue = table_getvalue;
319 ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .hexpand = TRUE, .contextmenu = menubuilder);
306 } 320 }
307 } 321 }
308 ui_tab(obj, "Tab 2") { 322 ui_tab(obj, "Tab 2") {
309 ui_button(obj, .label = "Button 1 Start Thread", .onclick=action_start_thread); 323 ui_button(obj, .label = "Button 1 Start Thread", .onclick=action_start_thread);
310 ui_button(obj, .label = "Button 2 Notify Thread", .onclick=action_notify_thread); 324 ui_button(obj, .label = "Button 2 Notify Thread", .onclick=action_notify_thread);

mercurial