From a0fe90c644e83f29f9817ebc84d24d8829f7ad5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Mon, 10 Nov 2014 06:57:50 +0000 Subject: [PATCH] Fix wxStaticText::Disable() to respect text color on OS X wxStaticText emulates disabled state on OS X by changing text color to light grey. When re-enabling the control, though, it always set the color to the standard text color, which broke static texts with a custom color. Fix this by keeping track of the original color and restoring it back when setEnabled:YES is called. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78107 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/stattext.mm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/osx/cocoa/stattext.mm b/src/osx/cocoa/stattext.mm index ea8b8e53fb..97c2b86452 100644 --- a/src/osx/cocoa/stattext.mm +++ b/src/osx/cocoa/stattext.mm @@ -32,6 +32,7 @@ @interface wxNSStaticTextView : NSTextField { + NSColor *m_textColor; } @end @@ -47,6 +48,12 @@ } } +- (void)dealloc +{ + [m_textColor release]; + [super dealloc]; +} + - (void) setEnabled:(BOOL) flag { [super setEnabled: flag]; @@ -57,10 +64,13 @@ // http://www.cocoabuilder.com/archive/message/cocoa/2006/7/21/168028 if (flag) { - [self setTextColor: [NSColor controlTextColor]]; + if (m_textColor) + [self setTextColor: m_textColor]; } else { + [m_textColor release]; + m_textColor = [[self textColor] retain]; [self setTextColor: [NSColor secondarySelectedControlColor]]; } }