X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c8fdb345a0467b910260af935353b360bfcbd4f0..eb087029329fab4b9d4d956b525eba752ee8d5e3:/src/osx/cocoa/textctrl.mm diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index c288d78703..d5af7b488c 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -96,15 +96,7 @@ protected : wxUnusedVar(aNotification); wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); if ( impl ) - { - wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer(); - if ( wxpeer ) { - wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, wxpeer->GetId()); - event.SetEventObject( wxpeer ); - event.SetString( static_cast(wxpeer)->GetValue() ); - wxpeer->HandleWindowEvent( event ); - } - } + impl->controlTextDidChange(); } - (void)controlTextDidEndEditing:(NSNotification *)aNotification @@ -194,17 +186,10 @@ protected : - (void)textDidChange:(NSNotification *)aNotification { - wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( [aNotification object] ); + wxUnusedVar(aNotification); + wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); if ( impl ) - { - wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer(); - if ( wxpeer ) { - wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, wxpeer->GetId()); - event.SetEventObject( wxpeer ); - event.SetString( static_cast(wxpeer)->GetValue() ); - wxpeer->HandleWindowEvent( event ); - } - } + impl->controlTextDidChange(); } @end @@ -244,7 +229,6 @@ protected : return fieldEditor; } - - (void) setEnabled:(BOOL) flag { [super setEnabled: flag]; @@ -266,15 +250,7 @@ protected : wxUnusedVar(aNotification); wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); if ( impl ) - { - wxWindow* wxpeer = (wxWindow*) impl->GetWXPeer(); - if ( wxpeer ) { - wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, wxpeer->GetId()); - event.SetEventObject( wxpeer ); - event.SetString( static_cast(wxpeer)->GetValue() ); - wxpeer->HandleWindowEvent( event ); - } - } + impl->controlTextDidChange(); } typedef BOOL (*wxOSX_insertNewlineHandlerPtr)(NSView* self, SEL _cmd, NSControl *control, NSTextView* textView, SEL commandSelector); @@ -345,6 +321,15 @@ wxNSTextViewControl::~wxNSTextViewControl() [m_textView setDelegate: nil]; } +bool wxNSTextViewControl::CanFocus() const +{ + // we need to override so that we don't return the CanFocus value of + // the text view's overriding scroll view. + if (m_textView) + return [m_textView canBecomeKeyView]; + return false; +} + wxString wxNSTextViewControl::GetStringValue() const { if (m_textView)