application/main.c

branch
newapi
changeset 269
3380100e20f5
parent 268
1b321a0c624f
child 270
9389313ac00f
equal deleted inserted replaced
268:1b321a0c624f 269:3380100e20f5
71 } 71 }
72 72
73 UiIcon *icon = NULL; 73 UiIcon *icon = NULL;
74 74
75 static void* list_getvalue(void *elm, int col) { 75 static void* list_getvalue(void *elm, int col) {
76 /*
76 if(col == 0) { 77 if(col == 0) {
77 if(!icon) { 78 if(!icon) {
78 icon = ui_icon("folder", 24); 79 icon = ui_icon("folder", 24);
79 } 80 }
80 return icon; 81 return icon;
81 } 82 }
83 */
84
82 char *str = elm; 85 char *str = elm;
83 return col == 1 ? str : "x"; 86 return col == 1 ? str : "x";
84 } 87 }
85 88
86 void application_startup(UiEvent *event, void *data) { 89 void application_startup(UiEvent *event, void *data) {
113 ui_newline(obj); 116 ui_newline(obj);
114 117
115 ui_textfield(obj, .value = doc->str1); 118 ui_textfield(obj, .value = doc->str1);
116 ui_newline(obj); 119 ui_newline(obj);
117 120
118 UiModel *model = ui_model(obj->ctx, UI_ICON_TEXT, "Col 1", UI_STRING, "Col 2", -1); 121 //UiModel *model = ui_model(obj->ctx, UI_ICON_TEXT, "Col 1", UI_STRING, "Col 2", -1);
119 model->getvalue = list_getvalue; 122 //model->getvalue = list_getvalue;
120 ui_table(obj, .hexpand = true, .vexpand = true, .colspan = 2, .varname = "list", .model = model); 123 ui_listview(obj, .hexpand = true, .vexpand = true, .colspan = 2, .varname = "list", .getvalue = list_getvalue);
121 } 124 }
122 125
123 ui_show(obj); 126 ui_show(obj);
124 } 127 }
125 128

mercurial