From bb57c8e60f96bcb55f077033bb03218522b9a795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 12 Nov 2014 15:10:56 +0000 Subject: [PATCH] Fix disabling wxStaticText repeatedly in wxOSX. Changes in r78107 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/trunk@78144 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 97c2b86452..6a58c9e27b 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]]; } }