disabling multiline text controls correctly
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66864 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
6ade9e8917
commit
816b29417d
@ -52,6 +52,8 @@
|
||||
@interface NSView(EditableView)
|
||||
- (BOOL)isEditable;
|
||||
- (void)setEditable:(BOOL)flag;
|
||||
- (BOOL)isSelectable;
|
||||
- (void)setSelectable:(BOOL)flag;
|
||||
@end
|
||||
|
||||
class wxMacEditHelper
|
||||
@ -60,10 +62,11 @@ public :
|
||||
wxMacEditHelper( NSView* textView )
|
||||
{
|
||||
m_textView = textView;
|
||||
m_formerState = YES;
|
||||
m_formerEditable = YES;
|
||||
if ( textView )
|
||||
{
|
||||
m_formerState = [textView isEditable];
|
||||
m_formerEditable = [textView isEditable];
|
||||
m_formerSelectable = [textView isSelectable];
|
||||
[textView setEditable:YES];
|
||||
}
|
||||
}
|
||||
@ -71,11 +74,15 @@ public :
|
||||
~wxMacEditHelper()
|
||||
{
|
||||
if ( m_textView )
|
||||
[m_textView setEditable:m_formerState];
|
||||
{
|
||||
[m_textView setEditable:m_formerEditable];
|
||||
[m_textView setSelectable:m_formerSelectable];
|
||||
}
|
||||
}
|
||||
|
||||
protected :
|
||||
BOOL m_formerState ;
|
||||
BOOL m_formerEditable ;
|
||||
BOOL m_formerSelectable;
|
||||
NSView* m_textView;
|
||||
} ;
|
||||
|
||||
@ -192,6 +199,25 @@ protected :
|
||||
impl->controlTextDidChange();
|
||||
}
|
||||
|
||||
- (void) setEnabled:(BOOL) flag
|
||||
{
|
||||
// from Technical Q&A QA1461
|
||||
if (flag) {
|
||||
[self setTextColor: [NSColor controlTextColor]];
|
||||
|
||||
} else {
|
||||
[self setTextColor: [NSColor disabledControlTextColor]];
|
||||
}
|
||||
|
||||
[self setSelectable: flag];
|
||||
[self setEditable: flag];
|
||||
}
|
||||
|
||||
- (BOOL) isEnabled
|
||||
{
|
||||
return [self isEditable];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation wxNSTextField
|
||||
|
Loading…
Reference in New Issue
Block a user