Fixed: Before this PR, CPBox followed the autoresizesSubviews flags while Cocoa NSBox always autoresizes its subviews, whatever the flag is set to. (#2992)

This commit is contained in:
Didier Korthoudt
2022-03-21 13:35:22 +01:00
committed by GitHub
parent a523cfc381
commit b3051a5bd0
+15
View File
@@ -67,6 +67,8 @@ CPBelowBottom = 6;
CPString _title @accessors(getter=title);
int _titlePosition @accessors(getter=titlePosition);
CPTextField _titleView;
BOOL _cachedAutoresizesSubviews;
}
+ (Class)_binderClassForBinding:(CPString)aBinding
@@ -812,6 +814,19 @@ CPBelowBottom = 6;
[self setNeedsDisplay:YES];
}
- (void)setAutoresizesSubviews:(BOOL)flag
{
// CPBox should always resize its subviews, like in Cocoa, whatever is the corresponding flag set.
// We have to keep the flag value as we could have to return it in -autoresizesSubview method.
_cachedAutoresizesSubviews = !!flag;
[super setAutoresizesSubviews:YES];
}
- (BOOL)autoresizesSubview
{
return _cachedAutoresizesSubviews;
}
@end
#pragma mark -