X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03647350fc7cd141953c72e0284e928847d30f44..8383e673b1d839548b7336947a61fa699eeb6621:/src/osx/cocoa/srchctrl.mm diff --git a/src/osx/cocoa/srchctrl.mm b/src/osx/cocoa/srchctrl.mm index 399729c183..6e74612d73 100644 --- a/src/osx/cocoa/srchctrl.mm +++ b/src/osx/cocoa/srchctrl.mm @@ -5,7 +5,7 @@ // Created: 2006-02-19 // RCS-ID: $Id: srchctrl.cpp 54820 2008-07-29 20:04:11Z SC $ // Copyright: Vince Harron -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". @@ -50,31 +50,15 @@ - (id)initWithFrame:(NSRect)frame { [super initWithFrame:frame]; - [self setTarget: self]; - [self setAction: @selector(searchAction:)]; return self; } - -- (void) searchAction: (id) sender + +- (void)controlTextDidChange:(NSNotification *)aNotification { - (void) sender; + wxUnusedVar(aNotification); wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self ); if ( impl ) - { - wxSearchCtrl* wxpeer = dynamic_cast( impl->GetWXPeer() ); - if ( wxpeer ) - { - NSString *searchString = [self stringValue]; - if ( searchString == nil ) - { - wxpeer->HandleSearchFieldCancelHit(); - } - else - { - wxpeer->HandleSearchFieldSearchHit(); - } - } - } + impl->controlTextDidChange(); } @end @@ -142,6 +126,23 @@ public : return wxNSTextFieldControl::SetFocus(); } + void controlAction( WXWidget WXUNUSED(slf), void *WXUNUSED(_cmd), void *WXUNUSED(sender)) + { + wxSearchCtrl* wxpeer = (wxSearchCtrl*) GetWXPeer(); + if ( wxpeer ) + { + NSString *searchString = [m_searchField stringValue]; + if ( searchString == nil ) + { + wxpeer->HandleSearchFieldCancelHit(); + } + else + { + wxpeer->HandleSearchFieldSearchHit(); + } + } + } + private: wxNSSearchField* m_searchField; NSSearchFieldCell* m_searchFieldCell; @@ -151,7 +152,7 @@ wxNSSearchFieldControl::~wxNSSearchFieldControl() { } -wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxTextCtrl* wxpeer, +wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxSearchCtrl* wxpeer, wxWindowMac* WXUNUSED(parent), wxWindowID WXUNUSED(id), const wxString& str,