ui/gtk/container.c

changeset 802
cc73993a3ff9
parent 801
e096c441e874
child 803
f0c4322741c8
--- a/ui/gtk/container.c	Sun Oct 05 18:13:15 2025 +0200
+++ b/ui/gtk/container.c	Sun Oct 05 19:06:34 2025 +0200
@@ -37,6 +37,7 @@
 
 #include "../common/context.h"
 #include "../common/object.h"
+#include "../common/container.h"
 
 #include "../ui/properties.h"
 
@@ -71,7 +72,6 @@
 #endif
 }
 
-// TODO: refactoring
 GtkWidget* ui_subcontainer_create(
         UiSubContainerType type,
         UiObject *obj,
@@ -180,41 +180,6 @@
     return (UiContainerX*)ct;
 }
 
-/*
- * TODO: move to common
- * prepares the layout horizontal and vertical fill/expand settings
- * based on fill and defaults
- */
-static void layout_setup_expand_fill(
-        UiLayout *layout,
-        UiBool def_hexpand,
-        UiBool def_vexpand,
-        UiBool def_hfill,
-        UiBool def_vfill)
-{
-    if(layout->fill) {
-        layout->hfill = TRUE;
-        layout->vfill = TRUE;
-        layout->hexpand = TRUE;
-        layout->vexpand = TRUE;
-        return;
-    }
-    
-    if(!layout->override_defaults) {
-        if(def_hexpand) {
-            layout->hexpand = TRUE;
-        }
-        if(def_hfill) {
-            layout->hfill = TRUE;
-        }
-        if(def_vexpand) {
-            layout->vexpand = TRUE;
-        }
-        if(def_vfill) {
-            layout->vfill = TRUE;
-        }
-    }
-}
 
 #if GTK_MAJOR_VERSION >= 3
 void ui_grid_container_add(UiContainerPrivate *ct, GtkWidget *widget, UiLayout *layout) {
@@ -226,7 +191,7 @@
         ct->container.newline = FALSE;
     }
     
-    layout_setup_expand_fill(layout, grid->def_hexpand, grid->def_vexpand, grid->def_hfill, grid->def_vfill);
+    uic_layout_setup_expand_fill(layout, grid->def_hexpand, grid->def_vexpand, grid->def_hfill, grid->def_vfill);
     
     if(!layout->hfill) {
         gtk_widget_set_halign(widget, GTK_ALIGN_START);
@@ -257,7 +222,7 @@
         ct->container.newline = FALSE;
     }
     
-    layout_setup_expand_fill(layout, grid->def_hexpand, grid->def_vexpand, grid->def_hfill, grid->def_vfill);
+    uic_layout_setup_expand_fill(layout, grid->def_hexpand, grid->def_vexpand, grid->def_hfill, grid->def_vfill);
     
     GtkAttachOptions xoptions = 0;
     GtkAttachOptions yoptions = 0;

mercurial