| 78 GridDef *col = &cols[x]; |
80 GridDef *col = &cols[x]; |
| 79 GridDef *row = &rows[y]; |
81 GridDef *row = &rows[y]; |
| 80 |
82 |
| 81 NSSize size = elm->view.intrinsicContentSize; |
83 NSSize size = elm->view.intrinsicContentSize; |
| 82 NSSize size2 = elm->view.fittingSize; |
84 NSSize size2 = elm->view.fittingSize; |
| 83 NSEdgeInsets alignment = elm->view.alignmentRectInsets; |
|
| 84 // TODO: remove alignment |
|
| 85 alignment.left = 0; |
|
| 86 alignment.right = 0; |
|
| 87 alignment.top = 0; |
|
| 88 alignment.bottom = 0; |
|
| 89 if(size.width == NSViewNoIntrinsicMetric) { |
85 if(size.width == NSViewNoIntrinsicMetric) { |
| 90 size.width = size2.width; |
86 size.width = size2.width; |
| 91 } |
87 } |
| 92 if(size.height == NSViewNoIntrinsicMetric) { |
88 if(size.height == NSViewNoIntrinsicMetric) { |
| 93 size.height = size2.height; |
89 size.height = size2.height; |
| 94 } |
90 } |
| 95 if(size.width != NSViewNoIntrinsicMetric) { |
91 if(size.width != NSViewNoIntrinsicMetric) { |
| 96 CGFloat width = size.width + alignment.left + alignment.right; |
92 CGFloat width = size.width; |
| 97 if(width > cols[elm->x].preferred_size && elm->colspan <= 1 && span_max == 1) { |
93 if(width > cols[elm->x].preferred_size && elm->colspan <= 1 && span_max == 1) { |
| 98 cols[elm->x].preferred_size = width; |
94 cols[elm->x].preferred_size = width; |
| 99 } |
95 } |
| 100 elm->preferred_width = width; |
96 elm->preferred_width = width; |
| 101 } |
97 } |
| 102 if(size.height != NSViewNoIntrinsicMetric) { |
98 if(size.height != NSViewNoIntrinsicMetric) { |
| 103 CGFloat height = size.height + alignment.top + alignment.right; |
99 CGFloat height = size.height; |
| 104 //CGFloat height = size.height; |
100 //CGFloat height = size.height; |
| 105 if(height > rows[elm->y].preferred_size && elm->rowspan <= 1 && span_max == 1) { |
101 if(height > rows[elm->y].preferred_size && elm->rowspan <= 1 && span_max == 1) { |
| 106 rows[elm->y].preferred_size = height; |
102 rows[elm->y].preferred_size = height; |
| 107 } |
103 } |
| 108 elm->preferred_height = height; |
104 elm->preferred_height = height; |