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:
@@ -52,6 +52,8 @@
|
|||||||
@interface NSView(EditableView)
|
@interface NSView(EditableView)
|
||||||
- (BOOL)isEditable;
|
- (BOOL)isEditable;
|
||||||
- (void)setEditable:(BOOL)flag;
|
- (void)setEditable:(BOOL)flag;
|
||||||
|
- (BOOL)isSelectable;
|
||||||
|
- (void)setSelectable:(BOOL)flag;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
class wxMacEditHelper
|
class wxMacEditHelper
|
||||||
@@ -60,10 +62,11 @@ public :
|
|||||||
wxMacEditHelper( NSView* textView )
|
wxMacEditHelper( NSView* textView )
|
||||||
{
|
{
|
||||||
m_textView = textView;
|
m_textView = textView;
|
||||||
m_formerState = YES;
|
m_formerEditable = YES;
|
||||||
if ( textView )
|
if ( textView )
|
||||||
{
|
{
|
||||||
m_formerState = [textView isEditable];
|
m_formerEditable = [textView isEditable];
|
||||||
|
m_formerSelectable = [textView isSelectable];
|
||||||
[textView setEditable:YES];
|
[textView setEditable:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,11 +74,15 @@ public :
|
|||||||
~wxMacEditHelper()
|
~wxMacEditHelper()
|
||||||
{
|
{
|
||||||
if ( m_textView )
|
if ( m_textView )
|
||||||
[m_textView setEditable:m_formerState];
|
{
|
||||||
|
[m_textView setEditable:m_formerEditable];
|
||||||
|
[m_textView setSelectable:m_formerSelectable];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
BOOL m_formerState ;
|
BOOL m_formerEditable ;
|
||||||
|
BOOL m_formerSelectable;
|
||||||
NSView* m_textView;
|
NSView* m_textView;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
@@ -192,6 +199,25 @@ protected :
|
|||||||
impl->controlTextDidChange();
|
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
|
@end
|
||||||
|
|
||||||
@implementation wxNSTextField
|
@implementation wxNSTextField
|
||||||
|
Reference in New Issue
Block a user