ui/gtk/container.c

changeset 75
73c8a3780c72
parent 60
ee4e4742391e
--- a/ui/gtk/container.c	Tue Oct 29 20:30:00 2024 +0100
+++ b/ui/gtk/container.c	Sun Nov 10 09:12:30 2024 +0100
@@ -180,11 +180,29 @@
     
     int hexpand = FALSE;
     int vexpand = FALSE;
+    int hfill = FALSE;
+    int vfill = FALSE;
+    if(ct->layout.fill != UI_LAYOUT_UNDEFINED) {
+        fill = ui_lb2bool(ct->layout.fill);
+    }
     if(ct->layout.hexpand != UI_LAYOUT_UNDEFINED) {
         hexpand = ct->layout.hexpand;
+        hfill = TRUE;
     }
     if(ct->layout.vexpand != UI_LAYOUT_UNDEFINED) {
         vexpand = ct->layout.vexpand;
+        vfill = TRUE;
+    }
+    if(fill) {
+        hfill = TRUE;
+        vfill = TRUE;
+    }
+    
+    if(!hfill) {
+        gtk_widget_set_halign(widget, GTK_ALIGN_START);
+    }
+    if(!vfill) {
+        gtk_widget_set_valign(widget, GTK_ALIGN_START);
     }
     
     gtk_widget_set_hexpand(widget, hexpand);
@@ -917,6 +935,16 @@
     ct->layout.vexpand = expand;
 }
 
+void ui_layout_hfill(UiObject *obj, UiBool fill) {
+    UiContainer *ct = uic_get_current_container(obj);
+    ct->layout.hfill = fill;
+}
+
+void ui_layout_vfill(UiObject *obj, UiBool fill) {
+    UiContainer *ct = uic_get_current_container(obj);
+    ct->layout.vfill = fill;
+}
+
 void ui_layout_colspan(UiObject* obj, int cols) {
     UiContainer* ct = uic_get_current_container(obj);
     ct->layout.colspan = cols;

mercurial