| |
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 { |
| |
17 UiLayout layout = self.uilayout; |
| |
18 if(_orientation == NSUserInterfaceLayoutOrientationVertical) { |
| |
19 layout.hexpand = TRUE; |
| |
20 layout.hfill = TRUE; |
| |
21 } else { |
| |
22 layout.vexpand = TRUE; |
| |
23 layout.vfill = TRUE; |
| |
24 self.newline = FALSE; |
| |
25 } |
| |
26 self.uilayout = layout; |
| |
27 [super addView:view]; |
| |
28 if(_orientation == NSUserInterfaceLayoutOrientationVertical) { |
| |
29 self.newline = TRUE; |
| |
30 } |
| |
31 } |
| |
32 |
| |
33 @end |