ui/gtk/tree.c

changeset 1245
4163776eef49
parent 1244
a29b53f97d1a
--- a/ui/gtk/tree.c	Wed Sep 09 18:57:52 2026 +0200
+++ b/ui/gtk/tree.c	Thu Sep 10 17:36:06 2026 +0200
@@ -32,4 +32,46 @@
 
 #include "../common/context.h"
 
-
+UiListView* ui_create_treeview(UiObject *obj, UiTreeArgs *args) {
+    UiListView *treeview = malloc(sizeof(UiListView));
+    memset(treeview, 0, sizeof(UiListView));
+    treeview->obj = obj;
+    treeview->model = args->model;
+    treeview->multiselection = args->multiselection;
+    treeview->onactivate = args->onactivate;
+    treeview->onactivatedata = args->onactivatedata;
+    treeview->onactivate_action = args->onactivate_action ? strdup(args->onactivate_action) : NULL;
+    treeview->onselection = args->onselection;
+    treeview->onselectiondata = args->onselectiondata;
+    treeview->onselection_action = args->onselection_action ? strdup(args->onselection_action) : NULL;
+    treeview->ondragstart = args->ondragstart;
+    treeview->ondragstartdata = args->ondragstartdata;
+    treeview->ondragstart_action = args->ondragstart_action ? strdup(args->ondragstart_action) : NULL;
+    treeview->ondragcomplete = args->ondragcomplete;
+    treeview->ondragcompletedata = args->ondragcompletedata;
+    treeview->ondragcomplete_action = args->ondragcomplete_action ? strdup(args->ondragcomplete_action) : NULL;
+    treeview->ondrop = args->ondrop;
+    treeview->ondropdata = args->ondropdata;
+    treeview->ondrop_action = args->ondrop_action ? strdup(args->ondrop_action) : NULL;
+    treeview->selection.count = 0;
+    treeview->selection.rows = NULL;
+    treeview->current_row = -1;
+    
+#if GTK_CHECK_VERSION(4, 0, 0)
+    treeview->coldata.listview = treeview;
+    treeview->coldata.column = 0;
+#endif
+    
+    if(args->getvalue != NULL) {
+        treeview->getvalue = args->getvalue;
+        treeview->getvaluedata = args->getvaluedata;
+    } else {
+        args->getvalue = ui_null_getvalue;
+    }
+    
+    treeview->istreeview = TRUE;
+    treeview->getdepth = args->getdepth;
+    treeview->getdepthdata = args->getdepthdata;
+      
+    return treeview;
+}

mercurial