ui/cocoa/GridLayout.m

changeset 811
1391ba7e533f
parent 810
7b5ba65b246f
child 846
ffa983c223c1
equal deleted inserted replaced
810:7b5ba65b246f 811:1391ba7e533f
30 30
31 31
32 32
33 @implementation GridLayout 33 @implementation GridLayout
34 34
35 @synthesize label=_label;
36 @synthesize uilayout=_uilayout; 35 @synthesize uilayout=_uilayout;
37 @synthesize newline=_newline; 36 @synthesize container=_container;
38 37
39 - (GridLayout*)init { 38 - (GridLayout*)init {
40 self = [super init]; 39 self = [super init];
41 _columnspacing = 0; 40 _columnspacing = 0;
42 _rowspacing = 0; 41 _rowspacing = 0;
81 cx_foreach(GridElm *, elm, i) { 80 cx_foreach(GridElm *, elm, i) {
82 int x = elm->x; 81 int x = elm->x;
83 int y = elm->y; 82 int y = elm->y;
84 GridDef *col = &cols[x]; 83 GridDef *col = &cols[x];
85 GridDef *row = &rows[y]; 84 GridDef *row = &rows[y];
86
87 if(elm->margin.left + elm->margin.right > 0) {
88 printf(""); // break
89 }
90 85
91 NSSize size = elm->view.intrinsicContentSize; 86 NSSize size = elm->view.intrinsicContentSize;
92 NSSize size2 = elm->view.fittingSize; 87 NSSize size2 = elm->view.fittingSize;
93 if(size.width == NSViewNoIntrinsicMetric) { 88 if(size.width == NSViewNoIntrinsicMetric) {
94 size.width = size2.width; 89 size.width = size2.width;
319 314
320 - (void) addView:(NSView*)view margin:(NSEdgeInsets)margin { 315 - (void) addView:(NSView*)view margin:(NSEdgeInsets)margin {
321 _preferredSize.width = -1; 316 _preferredSize.width = -1;
322 _preferredSize.height = -1; 317 _preferredSize.height = -1;
323 318
324 if(_newline) { 319 if(self.container->newline) {
325 _y++; 320 _y++;
326 _x = 0; 321 _x = 0;
327 _newline = FALSE; 322 self.container->newline = FALSE;
328 } 323 }
329 324
330 GridElm elm; 325 GridElm elm;
331 elm.x = _x; 326 elm.x = _x;
332 elm.y = _y; 327 elm.y = _y;

mercurial