Get wxSearchCtrl text events working, and share the text event handler code among all the various wxTextCtrl-based classes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f9022ad209
commit
75a2c6a1ee
@ -174,6 +174,10 @@ public :
|
||||
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;
|
||||
NSEvent* m_lastKeyDownEvent;
|
||||
|
@ -77,6 +77,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
||||
{
|
||||
wxUnusedVar(aNotification);
|
||||
wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
|
||||
if ( impl )
|
||||
impl->controlTextDidChange();
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// ============================================================================
|
||||
|
@ -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<wxTextCtrl*>(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<wxTextCtrl*>(wxpeer)->GetValue() );
|
||||
wxpeer->HandleWindowEvent( event );
|
||||
}
|
||||
}
|
||||
impl->controlTextDidChange();
|
||||
}
|
||||
|
||||
@end
|
||||
@ -266,15 +251,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<wxTextCtrl*>(wxpeer)->GetValue() );
|
||||
wxpeer->HandleWindowEvent( event );
|
||||
}
|
||||
}
|
||||
impl->controlTextDidChange();
|
||||
}
|
||||
|
||||
typedef BOOL (*wxOSX_insertNewlineHandlerPtr)(NSView* self, SEL _cmd, NSControl *control, NSTextView* textView, SEL commandSelector);
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "wx/dcclient.h"
|
||||
#include "wx/nonownedwnd.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/textctrl.h"
|
||||
#endif
|
||||
|
||||
#ifdef __WXMAC__
|
||||
@ -1123,6 +1124,18 @@ void wxWidgetCocoaImpl::controlDoubleAction( WXWidget WXUNUSED(slf), void *WXUNU
|
||||
{
|
||||
}
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user