ui/cocoa/BoxContainer.m

changeset 110
c00e968d018b
child 112
c3f2f16fa4b8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/cocoa/BoxContainer.m	Sat Oct 04 14:52:59 2025 +0200
@@ -0,0 +1,33 @@
+
+
+#import "BoxContainer.h"
+
+@implementation BoxContainer
+
+- (BoxContainer*)init:(NSUserInterfaceLayoutOrientation)orientation spacing:(int)spacing {
+    self = [super init];
+    _orientation = orientation;
+    self.columnspacing = spacing;
+    self.rowspacing = spacing;
+    
+    return self;
+}
+
+- (void) addView:(NSView*)view {
+    UiLayout layout = self.uilayout;
+    if(_orientation == NSUserInterfaceLayoutOrientationVertical) {
+        layout.hexpand = TRUE;
+        layout.hfill = TRUE;
+    } else {
+        layout.vexpand = TRUE;
+        layout.vfill = TRUE;
+        self.newline = FALSE;
+    }
+    self.uilayout = layout;
+    [super addView:view];
+    if(_orientation == NSUserInterfaceLayoutOrientationVertical) {
+        self.newline = TRUE;
+    }
+}
+
+@end

mercurial