ui/cocoa/GridLayout.m

changeset 846
ffa983c223c1
parent 811
1391ba7e533f
child 851
367b2bbbc07e
--- a/ui/cocoa/GridLayout.m	Mon Oct 13 21:31:58 2025 +0200
+++ b/ui/cocoa/GridLayout.m	Tue Oct 14 09:45:44 2025 +0200
@@ -32,8 +32,7 @@
 
 @implementation GridLayout
 
-@synthesize uilayout=_uilayout;
-@synthesize container=_container;
+@synthesize container = _container;
 
 - (GridLayout*)init {
     self = [super init];
@@ -293,6 +292,7 @@
         } else {
             frame.size.height = elm->preferred_height;
         }
+        frame.size.height -= elm->margin.top + elm->margin.bottom;
         
         frame.origin.x = col->pos + elm->margin.left;
         frame.origin.y = row->pos + elm->margin.top;
@@ -312,7 +312,7 @@
     return self.preferredSize;
 }
 
-- (void) addView:(NSView*)view margin:(NSEdgeInsets)margin {
+- (void) addView:(NSView*)view layout:(UiLayout*)layout {
     _preferredSize.width = -1;
     _preferredSize.height = -1;
     
@@ -325,19 +325,19 @@
     GridElm elm;
     elm.x = _x;
     elm.y = _y;
-    elm.margin = margin;
-    elm.colspan = _uilayout.colspan;
-    elm.rowspan = _uilayout.rowspan;
-    if(_uilayout.fill) {
+    elm.margin = NSEdgeInsetsMake(layout->margin_top, layout->margin_left, layout->margin_bottom, layout->margin_right);
+    elm.colspan = layout->colspan;
+    elm.rowspan = layout->rowspan;
+    if(layout->fill) {
         elm.hfill = TRUE;
         elm.vfill = TRUE;
         elm.hexpand = TRUE;
         elm.vexpand = TRUE;
     } else {
-        elm.hfill = _uilayout.hfill;
-        elm.vfill = _uilayout.vfill;
-        elm.hexpand = _uilayout.hexpand;
-        elm.vexpand = _uilayout.vexpand;
+        elm.hfill = layout->hfill;
+        elm.vfill = layout->vfill;
+        elm.hexpand = layout->hexpand;
+        elm.vexpand = layout->vexpand;
     }
     elm.view = view;
     cxListAdd(_children, &elm);

mercurial