make/vs/testapp/main.c

branch
newapi
changeset 215
1bd5534c395d
parent 214
279c0c81d3b1
child 216
391c2c723029
--- a/make/vs/testapp/main.c	Fri Oct 13 11:26:47 2023 +0200
+++ b/make/vs/testapp/main.c	Fri Oct 13 15:20:54 2023 +0200
@@ -48,6 +48,8 @@
     UiList* list3;
 } WindowData;
 
+static UiIcon* folder_icon;
+
 void action1(UiEvent* event, void* data) {
     char* action = data;
     
@@ -105,9 +107,10 @@
 void* table_getvalue(void* data, int i) {
     TableData* t = data;
     switch (i) {
-    case 0: return t->col1;
-    case 1: return t->col2;
-    case 2: return t->col3;
+    case 0: return folder_icon;
+    case 1: return t->col1;
+    case 2: return t->col2;
+    case 3: return t->col3;
     }
     return NULL;
 }
@@ -160,6 +163,7 @@
     ui_list_append(wdata->list3, "test");
     ui_list_append(wdata->list3, "dir");
 
+    folder_icon = ui_icon("Folder", 32);
 
     TableData* td1 = malloc(sizeof(TableData));
     TableData* td2 = malloc(sizeof(TableData));
@@ -263,7 +267,7 @@
 
             ui_newline(obj);
 
-            UiModel* model = ui_model(obj->ctx, UI_STRING, "Col 1", UI_STRING, "Col 2", UI_STRING, "Col 3", -1);
+            UiModel* model = ui_model(obj->ctx, UI_ICON_TEXT, "Col 1", UI_STRING, "Col 2", UI_STRING, "Col 3", -1);
             model->getvalue = table_getvalue;
             ui_table(obj, .colspan = 3, .model = model, .list = wdata->list2);
             ui_model_free(obj->ctx, model);

mercurial