From b3051a5bd0fca36a1b2d9ed9bbfd39e9e0cf2399 Mon Sep 17 00:00:00 2001 From: Didier Korthoudt Date: Mon, 21 Mar 2022 13:35:22 +0100 Subject: [PATCH] Fixed: Before this PR, CPBox followed the autoresizesSubviews flags while Cocoa NSBox always autoresizes its subviews, whatever the flag is set to. (#2992) --- AppKit/CPBox.j | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/AppKit/CPBox.j b/AppKit/CPBox.j index b87303569..40522d306 100644 --- a/AppKit/CPBox.j +++ b/AppKit/CPBox.j @@ -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 -