ui/cocoa/container.m

changeset 500
95ab1710993f
parent 404
384f6d1f5784
equal deleted inserted replaced
499:0a386bd871be 500:95ab1710993f
65 [self addArrangedSubview:view]; 65 [self addArrangedSubview:view];
66 66
67 if(self.orientation == NSUserInterfaceLayoutOrientationHorizontal) { 67 if(self.orientation == NSUserInterfaceLayoutOrientationHorizontal) {
68 [view.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES; 68 [view.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES;
69 if(!fill) { 69 if(!fill) {
70 [view.widthAnchor constraintEqualToConstant:view.intrinsicContentSize.width].active = YES; 70 NSSize isize = view.intrinsicContentSize;
71 [view.widthAnchor constraintEqualToConstant:isize.width].active = YES;
71 } 72 }
72 } else { 73 } else {
73 [view.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES; 74 [view.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES;
74 if(!fill) { 75 if(!fill) {
75 [view.heightAnchor constraintEqualToConstant:view.intrinsicContentSize.height].active = YES; 76 NSSize isize = view.intrinsicContentSize;
77 NSRect frame = view.frame;
78 CGFloat height = isize.height > 0 ? isize.height : frame.size.height;
79 if(height == 0) {
80 printf("debug");
81 }
82 if(height > 0) {
83 [view.heightAnchor constraintEqualToConstant:height].active = YES;
84 }
76 } 85 }
77 } 86 }
78 87
79 // at the moment, only the fill layout option needs to be reset 88 // at the moment, only the fill layout option needs to be reset
80 _uilayout.fill = UI_DEFAULT; 89 _uilayout.fill = UI_DEFAULT;

mercurial