applying editor part of patch, see #15003
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -341,6 +341,18 @@ public:
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface wxNSComboBox : NSComboBox
|
||||||
|
{
|
||||||
|
wxNSTextFieldEditor* fieldEditor;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (wxNSTextFieldEditor*) fieldEditor;
|
||||||
|
- (void) setFieldEditor:(wxNSTextFieldEditor*) fieldEditor;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@interface wxNSMenu : NSMenu
|
@interface wxNSMenu : NSMenu
|
||||||
{
|
{
|
||||||
wxMenuImpl* impl;
|
wxMenuImpl* impl;
|
||||||
|
@@ -36,12 +36,6 @@
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
@interface wxNSComboBox : NSComboBox
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation wxNSComboBox
|
@implementation wxNSComboBox
|
||||||
|
|
||||||
+ (void)initialize
|
+ (void)initialize
|
||||||
@@ -54,6 +48,33 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
[fieldEditor release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Over-riding NSComboBox onKeyDown method doesn't work for key events.
|
||||||
|
// Ensure that we can use our own wxNSTextFieldEditor to catch key events.
|
||||||
|
// See windowWillReturnFieldEditor in nonownedwnd.mm.
|
||||||
|
// Key events will be caught and handled via wxNSTextFieldEditor onkey...
|
||||||
|
// methods in textctrl.mm.
|
||||||
|
|
||||||
|
- (void) setFieldEditor:(wxNSTextFieldEditor*) editor
|
||||||
|
{
|
||||||
|
if ( editor != fieldEditor )
|
||||||
|
{
|
||||||
|
[editor retain];
|
||||||
|
[fieldEditor release];
|
||||||
|
fieldEditor = editor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (wxNSTextFieldEditor*) fieldEditor
|
||||||
|
{
|
||||||
|
return fieldEditor;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
- (void)controlTextDidChange:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
wxUnusedVar(aNotification);
|
wxUnusedVar(aNotification);
|
||||||
|
@@ -484,6 +484,19 @@ extern int wxOSXGetIdFromSelector(SEL action );
|
|||||||
}
|
}
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
else if ([anObject isKindOfClass:[wxNSComboBox class]])
|
||||||
|
{
|
||||||
|
wxNSComboBox * cb = (wxNSComboBox*) anObject;
|
||||||
|
wxNSTextFieldEditor* editor = [cb fieldEditor];
|
||||||
|
if ( editor == nil )
|
||||||
|
{
|
||||||
|
editor = [[wxNSTextFieldEditor alloc] init];
|
||||||
|
[editor setFieldEditor:YES];
|
||||||
|
[cb setFieldEditor:editor];
|
||||||
|
[editor release];
|
||||||
|
}
|
||||||
|
return editor;
|
||||||
|
}
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user