ui/motif/container.c

changeset 901
884d70e847a3
parent 900
6e1485d5451a
child 903
019d078d665e
--- a/ui/motif/container.c	Mon Nov 17 08:27:03 2025 +0100
+++ b/ui/motif/container.c	Mon Nov 17 11:28:47 2025 +0100
@@ -55,6 +55,18 @@
     container->add(container, widget);
 }
 
+void ui_container_apply_grid_margin(
+        Arg *args,
+        int *n,
+        int margin_left, int margin_right, int margin_top, int margin_bottom)
+{
+    int c = *n;
+    XtSetArg(args[c], gridMarginLeft, margin_left); c++;
+    XtSetArg(args[c], gridMarginRight, margin_right); c++;
+    XtSetArg(args[c], gridMarginTop, margin_top); c++;
+    XtSetArg(args[c], gridMarginBottom, margin_bottom); c++;
+    *n = c;
+}
 
 /* ---------------------------- Box Container ---------------------------- */
 
@@ -102,7 +114,7 @@
 }
 
 static Widget ui_box_container_prepare(UiBoxContainer *box, UiLayout *layout, Arg *args, int *n) {
-    int a = *n;
+    ui_container_apply_grid_margin(args, n, layout->margin_left, layout->margin_right, layout->margin_top, layout->margin_bottom);
     box->n++;
     return box->container.widget;
 }
@@ -151,7 +163,10 @@
     UiLayout layout = UI_ARGS2LAYOUT(args);
     
     Widget parent = ui_container_prepare(ctn, &layout, xargs, &n);
-    XtSetArg(xargs[n], gridMargin, args->margin); n++;
+    XtSetArg(xargs[n], gridPaddingLeft, 10); n++;
+    XtSetArg(xargs[n], gridPaddingRight, 10); n++;
+    XtSetArg(xargs[n], gridPaddingTop, 10); n++;
+    XtSetArg(xargs[n], gridPaddingBottom, 10); n++;
     XtSetArg(xargs[n], gridColumnSpacing, args->columnspacing); n++;
     XtSetArg(xargs[n], gridRowSpacing, args->rowspacing); n++;
     Widget grid = XtCreateManagedWidget(args->name ? args->name : "gridcontainer", gridClass, parent, xargs, n);
@@ -218,6 +233,7 @@
     }
     
     *n = a;
+    ui_container_apply_grid_margin(args, n, layout->margin_left, layout->margin_right, layout->margin_top, layout->margin_bottom);
     return ctn->widget;
 }
 

mercurial