ui/cocoa/BoxContainer.m

Sun, 19 Oct 2025 21:20:08 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 19 Oct 2025 21:20:08 +0200
changeset 112
c3f2f16fa4b8
parent 110
c00e968d018b
permissions
-rw-r--r--

update toolkit



#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  layout:(UiLayout*)layout {
    if(_orientation == NSUserInterfaceLayoutOrientationVertical) {
        layout->hexpand = TRUE;
        layout->hfill = TRUE;
    } else {
        layout->vexpand = TRUE;
        layout->vfill = TRUE;
    }
    [super addView:view layout:layout];
    if(_orientation == NSUserInterfaceLayoutOrientationVertical) {
        self.container->newline = TRUE;
    }
}

@end

mercurial