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
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
@interface wxNSStaticTextView : NSTextField
|
@interface wxNSStaticTextView : NSTextField
|
||||||
{
|
{
|
||||||
|
NSColor *m_textColor;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -47,6 +48,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)dealloc
|
||||||
|
{
|
||||||
|
[m_textColor release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setEnabled:(BOOL) flag
|
- (void) setEnabled:(BOOL) flag
|
||||||
{
|
{
|
||||||
[super setEnabled: flag];
|
[super setEnabled: flag];
|
||||||
@@ -57,10 +64,13 @@
|
|||||||
// http://www.cocoabuilder.com/archive/message/cocoa/2006/7/21/168028
|
// http://www.cocoabuilder.com/archive/message/cocoa/2006/7/21/168028
|
||||||
if (flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
[self setTextColor: [NSColor controlTextColor]];
|
if (m_textColor)
|
||||||
|
[self setTextColor: m_textColor];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
[m_textColor release];
|
||||||
|
m_textColor = [[self textColor] retain];
|
||||||
[self setTextColor: [NSColor secondarySelectedControlColor]];
|
[self setTextColor: [NSColor secondarySelectedControlColor]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user