UNIXworkcode

1 2 3 #import "BoxContainer.h" 4 5 @implementation BoxContainer 6 7 - (BoxContainer*)init:(NSUserInterfaceLayoutOrientation)orientation spacing:(int)spacing { 8 self = [super init]; 9 _orientation = orientation; 10 self.columnspacing = spacing; 11 self.rowspacing = spacing; 12 13 return self; 14 } 15 16 - (void) addView:(NSView*)view layout:(UiLayout*)layout { 17 if(_orientation == NSUserInterfaceLayoutOrientationVertical) { 18 layout->hexpand = TRUE; 19 layout->hfill = TRUE; 20 } else { 21 layout->vexpand = TRUE; 22 layout->vfill = TRUE; 23 } 24 [super addView:view layout:layout]; 25 if(_orientation == NSUserInterfaceLayoutOrientationVertical) { 26 self.container->newline = TRUE; 27 } 28 } 29 30 @end 31