ui/gtk/container.c

changeset 483
069fca2a47c2
parent 471
063a9f29098c
child 485
c584149b22f0
--- a/ui/gtk/container.c	Wed Feb 26 21:33:57 2025 +0100
+++ b/ui/gtk/container.c	Fri Feb 28 21:42:38 2025 +0100
@@ -1044,6 +1044,8 @@
     newobj->container = ui_splitpane_container(obj, pane0, orientation, max);
     uic_obj_add(obj, newobj);
     
+    g_object_set_data(G_OBJECT(pane0), "ui_splitpane", newobj->container);
+    
     return pane0;
 }
 
@@ -1062,6 +1064,7 @@
     ct->current_pane = pane;
     ct->orientation = orientation;
     ct->max = max;
+    ct->children = cxArrayListCreateSimple(CX_STORE_POINTERS, 4);
     return (UiContainer*)ct;
 }
 
@@ -1073,6 +1076,8 @@
         return;
     }
     
+    cxListAdd(s->children, widget);
+    
     if(s->pos == 0) {
         gtk_paned_set_start_child(GTK_PANED(s->current_pane), widget);
         s->pos++;
@@ -1092,6 +1097,19 @@
     }
 }
 
+UIEXPORT void ui_splitpane_set_visible(UIWIDGET splitpane, int child_index, UiBool visible) {
+    UiSplitPaneContainer *ct = g_object_get_data(G_OBJECT(splitpane), "ui_splitpane");
+    if(!ct) {
+        fprintf(stderr, "UI Error: not a splitpane\n");
+        return;
+    }
+    
+    GtkWidget *w = cxListAt(ct->children, child_index);
+    if(w) {
+        gtk_widget_set_visible(w, visible);
+    }
+}
+
 /* -------------------- ItemList Container -------------------- */
 
 static void remove_item(void *data, void *item) {

mercurial