ui/cocoa/BoxContainer.m

Fri, 10 Oct 2025 15:54:01 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 10 Oct 2025 15:54:01 +0200
changeset 830
13896bdaa151
parent 811
1391ba7e533f
child 846
ffa983c223c1
permissions
-rw-r--r--

add sourcelist event selection handler (Cocoa)



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

@end

mercurial