virtual void controlAction(WXWidget slf, void* _cmd, void* sender);
virtual void controlDoubleAction(WXWidget slf, void* _cmd, void *sender);
+
+ // for wxTextCtrl-derived classes, put here since they don't all derive
+ // from the same pimpl class.
+ virtual void controlTextDidChange();
protected:
WXWidget m_osxView;
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<wxTextCtrl*>(wxpeer)->GetValue() );
- wxpeer->HandleWindowEvent( event );
- }
- }
+ impl->controlTextDidChange();
}
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
- (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<wxTextCtrl*>(wxpeer)->GetValue() );
- wxpeer->HandleWindowEvent( event );
- }
- }
+ impl->controlTextDidChange();
}
@end
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<wxTextCtrl*>(wxpeer)->GetValue() );
- wxpeer->HandleWindowEvent( event );
- }
- }
+ impl->controlTextDidChange();
}
typedef BOOL (*wxOSX_insertNewlineHandlerPtr)(NSView* self, SEL _cmd, NSControl *control, NSTextView* textView, SEL commandSelector);
#include "wx/dcclient.h"
#include "wx/nonownedwnd.h"
#include "wx/log.h"
+ #include "wx/textctrl.h"
#endif
#ifdef __WXMAC__
{
}
+void wxWidgetCocoaImpl::controlTextDidChange()
+{
+ wxWindow* wxpeer = (wxWindow*)GetWXPeer();
+ if ( wxpeer )
+ {
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, wxpeer->GetId());
+ event.SetEventObject( wxpeer );
+ event.SetString( static_cast<wxTextCtrl*>(wxpeer)->GetValue() );
+ wxpeer->HandleWindowEvent( event );
+ }
+}
+
//
#if OBJC_API_VERSION >= 2