ui/cocoa/BoxContainer.m

Sun, 19 Apr 2026 20:05:11 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 19 Apr 2026 20:05:11 +0200
changeset 1097
d44c895e9ee9
parent 846
ffa983c223c1
permissions
-rw-r--r--

change ui_reg_destructor behavior: registered destructors are called before the context mempool is destroyed



#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