ui/win32/list.c

changeset 1053
f9976b83795c
parent 1034
330b415910bd
--- a/ui/win32/list.c	Thu Jan 22 23:18:00 2026 +0100
+++ b/ui/win32/list.c	Fri Jan 23 16:13:42 2026 +0100
@@ -41,7 +41,7 @@
     .enable = w32_widget_default_enable,
     .show = w32_widget_default_show,
     .get_preferred_size = ui_listview_get_preferred_size,
-    .destroy  = w32_widget_default_destroy
+    .destroy  = ui_listview_destroy
 };
 
 static void* strmodel_getvalue(UiList *list, void *elm, int row, int col, void *userdata, UiBool *freeResult) {
@@ -103,11 +103,15 @@
     HWND parent = ui_container_get_parent(container);
     UiLayout layout = UI_ARGS2LAYOUT(args);
 
+    unsigned int noheader = 0;
+    if (!table || args->hide_header) {
+        noheader = LVS_NOCOLUMNHEADER;
+    }
     HWND hwnd = CreateWindowEx(
             WS_EX_CLIENTEDGE,
             WC_LISTVIEW,
             "",
-            WS_CHILD | WS_VISIBLE | LVS_REPORT,
+            WS_CHILD | WS_VISIBLE | LVS_REPORT | noheader,
             0, 0, 100, 100,
             parent,
             (HMENU)1337,
@@ -278,6 +282,14 @@
     return size;
 }
 
+void ui_listview_destroy(W32Widget *widget) {
+    UiListView *listview = (UiListView*)widget;
+    if (listview->model) {
+        ui_model_unref(listview->model);
+    }
+    free(widget);
+}
+
 /*
  * Creates and inserts an LVITEM
  *

mercurial