ui/gtk/container.c

branch
newapi
changeset 378
d41b1ffc5f77
parent 354
baf9bcc98d87
--- a/ui/gtk/container.c	Sun Nov 10 10:16:47 2024 +0100
+++ b/ui/gtk/container.c	Sun Nov 10 15:27:44 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