]> git.saurik.com Git - wxWidgets.git/commitdiff
fixing searchctrl on osx_cocoa, changing type for peer to wxSearchCtrl
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 2 Feb 2011 07:55:57 +0000 (07:55 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 2 Feb 2011 07:55:57 +0000 (07:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66826 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/core/private.h
src/osx/carbon/srchctrl.cpp
src/osx/cocoa/srchctrl.mm

index 741306805a2c0930ae8e724c4c5cf8de23d037a0..fff53bc513cce7c54f2bff54caf94ee890434adf 100644 (file)
@@ -114,6 +114,7 @@ class wxWidgetImpl;
 class wxComboBox;
 class wxNotebook;
 class wxTextCtrl;
+class wxSearchCtrl;
 
 WXDLLIMPEXP_CORE wxWindowMac * wxFindWindowFromWXWidget(WXWidget inControl );
 
@@ -377,7 +378,7 @@ public :
                                     long style,
                                     long extraStyle) ;
 
-    static wxWidgetImplType*    CreateSearchControl( wxTextCtrl* wxpeer,
+    static wxWidgetImplType*    CreateSearchControl( wxSearchCtrl* wxpeer,
                                     wxWindowMac* parent,
                                     wxWindowID id,
                                     const wxString& content,
index 5c123d617909f930344e0286fd7ed677a6403b36..929340920de8ae873d1c18bca7bf46427e4440ee 100644 (file)
@@ -204,7 +204,7 @@ bool wxMacSearchFieldControl::SetFocus()
     return true;
 }
 
-wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxTextCtrl* wxpeer,
+wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxSearchCtrl* wxpeer,
                                     wxWindowMac* WXUNUSED(parent),
                                     wxWindowID WXUNUSED(id),
                                     const wxString& str,
index d19b37c564999a68f06a2aa78a6c9db25edf4c52..6e74612d738799cd5cd1929cb1640a8806e6a33a 100644 (file)
 - (id)initWithFrame:(NSRect)frame
 {
     [super initWithFrame:frame];
-    [self setTarget: self];
-    [self setAction: @selector(searchAction:)];
     return self;
 }
-
-- (void) searchAction: (id) sender
-{
-    (void) sender;
-    wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
-    if ( impl )
-    {
-        wxSearchCtrl* wxpeer = dynamic_cast<wxSearchCtrl*>( impl->GetWXPeer() );
-        if ( wxpeer )
-        {
-            NSString *searchString = [self stringValue];
-            if ( searchString == nil )
-            {
-                wxpeer->HandleSearchFieldCancelHit();
-            }
-            else
-            {
-                wxpeer->HandleSearchFieldSearchHit();
-            }
-        }
-    }
-}
-
 - (void)controlTextDidChange:(NSNotification *)aNotification
 {
     wxUnusedVar(aNotification);
@@ -150,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;
@@ -159,7 +152,7 @@ wxNSSearchFieldControl::~wxNSSearchFieldControl()
 {
 }
 
-wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxTextCtrl* wxpeer,
+wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxSearchCtrl* wxpeer,
                                     wxWindowMac* WXUNUSED(parent),
                                     wxWindowID WXUNUSED(id),
                                     const wxString& str,