ui/cocoa/container.m

changeset 109
c3dfcb8f0be7
parent 108
77254bd6dccb
child 110
c00e968d018b
equal deleted inserted replaced
108:77254bd6dccb 109:c3dfcb8f0be7
55 55
56 56
57 return self; 57 return self;
58 } 58 }
59 59
60 - (void) addView:(NSView*)view fill:(BOOL)fill { 60 - (void) addView:(NSView*)view {
61 if(_uilayout.fill != UI_LAYOUT_UNDEFINED) { 61 UiBool fill = _uilayout.fill;
62 fill = ui_lb2bool(_uilayout.fill);
63 }
64 62
65 [self addArrangedSubview:view]; 63 [self addArrangedSubview:view];
66 64
67 if(self.orientation == NSUserInterfaceLayoutOrientationHorizontal) { 65 if(self.orientation == NSUserInterfaceLayoutOrientationHorizontal) {
68 [view.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES; 66 [view.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES;
99 BoxContainer *box = [[BoxContainer alloc] init:orientation spacing:args->spacing]; 97 BoxContainer *box = [[BoxContainer alloc] init:orientation spacing:args->spacing];
100 box.translatesAutoresizingMaskIntoConstraints = false; 98 box.translatesAutoresizingMaskIntoConstraints = false;
101 99
102 // add box to the parent 100 // add box to the parent
103 UiLayout layout = UI_INIT_LAYOUT(args); 101 UiLayout layout = UI_INIT_LAYOUT(args);
104 ui_container_add(obj, box, &layout, TRUE); 102 ui_container_add(obj, box, &layout);
105 103
106 // add new box to the obj container chain 104 // add new box to the obj container chain
107 uic_object_push_container(obj, ui_create_container(obj, box)); 105 uic_object_push_container(obj, ui_create_container(obj, box));
108 106
109 return (__bridge void*)box; 107 return (__bridge void*)box;
121 GridLayout *grid = [[GridLayout alloc] init]; 119 GridLayout *grid = [[GridLayout alloc] init];
122 grid.translatesAutoresizingMaskIntoConstraints = false; 120 grid.translatesAutoresizingMaskIntoConstraints = false;
123 121
124 // add box to the parent 122 // add box to the parent
125 UiLayout layout = UI_INIT_LAYOUT(args); 123 UiLayout layout = UI_INIT_LAYOUT(args);
126 ui_container_add(obj, grid, &layout, TRUE); 124 ui_container_add(obj, grid, &layout);
127 125
128 // add new box to the obj container chain 126 // add new box to the obj container chain
129 uic_object_push_container(obj, ui_create_container(obj, grid)); 127 uic_object_push_container(obj, ui_create_container(obj, grid));
130 128
131 return (__bridge void*)grid; 129 return (__bridge void*)grid;
155 ctn->prev = NULL; 153 ctn->prev = NULL;
156 ctn->next = NULL; 154 ctn->next = NULL;
157 return ctn; 155 return ctn;
158 } 156 }
159 157
160 void ui_container_add(UiObject *obj, NSView *view, UiLayout *layout, UiBool fill) { 158 void ui_container_add(UiObject *obj, NSView *view, UiLayout *layout) {
161 UiContainerX *ctn = obj->container_end; 159 UiContainerX *ctn = obj->container_end;
162 id<Container> container = (__bridge id<Container>)ctn->container; 160 id<Container> container = (__bridge id<Container>)ctn->container;
163 container.uilayout = *layout; 161 container.uilayout = *layout;
164 [container addView:view fill:fill]; 162 [container addView:view];
165 } 163 }
166 164
167 /* ---------------------- public layout functions ----------------------- */ 165 /* ---------------------- public layout functions ----------------------- */
168 166
169 void ui_newline(UiObject *obj) { 167 void ui_newline(UiObject *obj) {

mercurial