From 915a35aa96916c4a00ffe3c8758e5fc92b82d54b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 12 Nov 2014 15:11:13 +0000 Subject: [PATCH] Fix disabling wxStaticText repeatedly in wxOSX. Changes in r78108 would reset control's color to gray if it was disabled more than once in a row. Guard against this and only remember the color of an enabled control. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@78145 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/stattext.mm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/osx/cocoa/stattext.mm b/src/osx/cocoa/stattext.mm index 42fa7765bf..f64b589f12 100644 --- a/src/osx/cocoa/stattext.mm +++ b/src/osx/cocoa/stattext.mm @@ -55,7 +55,9 @@ } - (void) setEnabled:(BOOL) flag -{ +{ + bool wasEnabled = [self isEnabled]; + [super setEnabled: flag]; if (![self drawsBackground]) { @@ -68,9 +70,12 @@ [self setTextColor: m_textColor]; } else - { - [m_textColor release]; - m_textColor = [[self textColor] retain]; + { + if (wasEnabled) + { + [m_textColor release]; + m_textColor = [[self textColor] retain]; + } [self setTextColor: [NSColor secondarySelectedControlColor]]; } }