catching default button handling also in password fields

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70667 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2012-02-22 08:24:09 +00:00
parent 83189c3b0e
commit a2ce64695d

View File

@ -186,6 +186,39 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
}
}
- (BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)commandSelector
{
wxUnusedVar(textView);
BOOL handled = NO;
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( control );
if ( impl )
{
wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer();
if ( wxpeer )
{
if (commandSelector == @selector(insertNewline:))
{
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(wxpeer), wxTopLevelWindow);
if ( tlw && tlw->GetDefaultItem() )
{
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
if ( def && def->IsEnabled() )
{
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
event.SetEventObject(def);
def->Command(event);
handled = YES;
}
}
}
}
}
return handled;
}
@end
@interface wxNSTextScrollView : NSScrollView