]> git.saurik.com Git - wxWidgets.git/commitdiff
Change event names to clarify that they are only fired by button clicks, and note...
authorKevin Ollivier <kevino@theolliviers.com>
Mon, 11 Dec 2006 20:32:16 +0000 (20:32 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Mon, 11 Dec 2006 20:32:16 +0000 (20:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43939 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/srchctrl.tex
include/wx/srchctrl.h
src/common/srchcmn.cpp
src/generic/srchctlg.cpp
src/mac/carbon/srchctrl.cpp
wxPython/demo/SearchCtrl.py
wxPython/src/_srchctrl.i

index 0d7b769ae3d5f03de8674cd9b7fce790ef30c0f9..e341103e498e1e131e9905280883e40c75cecff8 100644 (file)
@@ -7,7 +7,7 @@ control, and a cancel button.
 
 \wxheading{Derived from}
 
-\helpref{wxTextCtrl}{wxsearchctrl}\\
+\helpref{wxTextCtrl}{wxtextctrl}\\
 streambuf\\
 \helpref{wxControl}{wxcontrol}\\
 \helpref{wxWindow}{wxwindow}\\
@@ -44,13 +44,14 @@ See also \helpref{window styles overview}{windowstyles} and \helpref{wxSearchCtr
 \wxheading{Event handling}
 
 To process input from a search control, use these event handler macros to direct input to member
-functions that take a \helpref{wxCommandEvent}{wxcommandevent} argument.
+functions that take a \helpref{wxCommandEvent}{wxcommandevent} argument. To retrieve actual search
+queries, use EVT\_TEXT and EVT\_TEXT\_ENTER events, just as you would with \helpref{wxTextCtrl}{wxtextctrl}.
 
 \twocolwidtha{9cm}%
 \begin{twocollist}\itemsep=0pt
-\twocolitem{{\bf EVT\_SEARCHCTRL\_SEARCH(id, func)}}{Respond to a wxEVT\_SEARCHCTRL\_SEARCH event,
-generated when the search button is clicked.}
-\twocolitem{{\bf EVT\_SEARCHCTRL\_CANCEL(id, func)}}{Respond to a wxEVT\_SEARCHCTRL\_CANCEL event,
+\twocolitem{{\bf EVT\_SEARCHCTRL\_SEARCH\_BTN(id, func)}}{Respond to a wxEVT\_SEARCHCTRL\_SEARCH\_BTN event,
+generated when the search button is clicked. Note that this does not initiate a search.}
+\twocolitem{{\bf EVT\_SEARCHCTRL\_CANCEL\_BTN(id, func)}}{Respond to a wxEVT\_SEARCHCTRL\_CANCEL\_BTN event,
 generated when the cancel button is clicked.}
 \end{twocollist}%
 
index e9d2a277c52772674ba69e049f6fcd558ede67cb..5ec9336f3f13cbfb554320431c5d643c5a2a2bbf 100644 (file)
@@ -37,8 +37,8 @@
 extern WXDLLEXPORT_DATA(const wxChar) wxSearchCtrlNameStr[];
 
 BEGIN_DECLARE_EVENT_TYPES()
-    DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL, 1119)
-    DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH, 1120)
+    DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, 1119)
+    DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, 1120)
 END_DECLARE_EVENT_TYPES()
 
 // ----------------------------------------------------------------------------
@@ -78,11 +78,11 @@ public:
 // macros for handling search events
 // ----------------------------------------------------------------------------
 
-#define EVT_SEARCHCTRL_CANCEL(id, fn) \
-    wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL, id, wxCommandEventHandler(fn))
+#define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \
+    wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn))
 
-#define EVT_SEARCHCTRL_SEARCH(id, fn) \
-    wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH, id, wxCommandEventHandler(fn))
+#define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \
+    wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn))
 
 #endif // wxUSE_SEARCHCTRL
 
index f42771c753f746638c3f0edf151296246ffe5ca2..8cdbaf7e0a6ac7f5116cad5875e70b967fe8482f 100644 (file)
@@ -35,8 +35,8 @@
 
 const wxChar wxSearchCtrlNameStr[] = wxT("searchCtrl");
 
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN)
 
 
 #endif // wxUSE_SEARCHCTRL
index b09517beda2d4905cdd6f391948cb8b0d375e19e..d622f78795e7d083f3e39779d50797b00c4c17a3 100644 (file)
@@ -137,7 +137,7 @@ protected:
 
         m_search->SetFocus();
 
-        if ( m_eventType == wxEVT_COMMAND_SEARCHCTRL_SEARCH )
+        if ( m_eventType == wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN )
         {
             // this happens automatically, just like on Mac OS X
             m_search->PopupSearchMenu();
@@ -230,8 +230,10 @@ bool wxSearchCtrl::Create(wxWindow *parent, wxWindowID id,
 
     m_text = new wxSearchTextCtrl(this, value, style & ~wxBORDER_MASK);
 
-    m_searchButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_SEARCH,m_searchBitmap);
-    m_cancelButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_CANCEL,m_cancelBitmap);
+    wxSize sizeText = m_text->GetBestSize();
+
+    m_searchButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN,m_searchBitmap);
+    m_cancelButton = new wxSearchButton(this,wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN,m_cancelBitmap);
 
     SetForegroundColour( m_text->GetForegroundColour() );
     m_searchButton->SetForegroundColour( m_text->GetForegroundColour() );
index 6ec0a7b394741a6d13d92b83119135090a845041..b8a450ef406b4bb1fca9b07a17e3fbdfa4719f26 100644 (file)
@@ -341,7 +341,7 @@ bool wxSearchCtrl::IsCancelButtonVisible() const
 
 wxInt32 wxSearchCtrl::MacSearchFieldSearchHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
 {
-    wxCommandEvent event(wxEVT_COMMAND_SEARCHCTRL_SEARCH, m_windowId );
+    wxCommandEvent event(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, m_windowId );
     event.SetEventObject(this);
     ProcessCommand(event);
     return eventNotHandledErr ;
@@ -349,7 +349,7 @@ wxInt32 wxSearchCtrl::MacSearchFieldSearchHit(WXEVENTHANDLERREF WXUNUSED(handler
 
 wxInt32 wxSearchCtrl::MacSearchFieldCancelHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
 {
-    wxCommandEvent event(wxEVT_COMMAND_SEARCHCTRL_CANCEL, m_windowId );
+    wxCommandEvent event(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, m_windowId );
     event.SetEventObject(this);
     ProcessCommand(event);
     return eventNotHandledErr ;
index 53d600c907f51a31b07ce39d8e3db336c761606d..dfadb43a28d2ab0ba6cd0f0ae69eb5192a467fbb 100644 (file)
@@ -39,8 +39,8 @@ class TestPanel(wx.Panel):
         self.Bind(wx.EVT_CHECKBOX, self.OnToggleCancelButton, cancelBtnOpt)
         self.Bind(wx.EVT_CHECKBOX, self.OnToggleSearchMenu,   menuBtnOpt)
 
-        self.Bind(wx.EVT_SEARCHCTRL_SEARCH, self.OnSearch, self.search)
-        self.Bind(wx.EVT_SEARCHCTRL_CANCEL, self.OnCancel, self.search)
+        self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnSearch, self.search)
+        self.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnCancel, self.search)
         self.search.Bind(wx.EVT_TEXT_ENTER,        self.OnDoSearch) #, self.search)
         
 
index cac34b3cfdc244e1e7f0e740f05c6c06a9958f04..83a244b345cfcc088a7f2d9bd30876c1717d0427 100644 (file)
@@ -158,7 +158,6 @@ v10.3", "");
 attached, the search button will be visible regardless of the search
 button visibility value.  This always returns false in Mac OS X v10.3", "");
     
-
     DocDeclStr(
         virtual void , ShowCancelButton( bool show ),
         "Shows or hides the cancel button.", "");
@@ -200,12 +199,12 @@ work on the Mac.", "");
 
 
 
-%constant wxEventType wxEVT_COMMAND_SEARCHCTRL_CANCEL;
-%constant wxEventType wxEVT_COMMAND_SEARCHCTRL_SEARCH;
+%constant wxEventType wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN;
+%constant wxEventType wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN;
 
 %pythoncode {
-    EVT_SEARCHCTRL_CANCEL = wx.PyEventBinder( wxEVT_COMMAND_SEARCHCTRL_CANCEL, 1)
-    EVT_SEARCHCTRL_SEARCH = wx.PyEventBinder( wxEVT_COMMAND_SEARCHCTRL_SEARCH, 1)
+    EVT_SEARCHCTRL_CANCEL_BTN = wx.PyEventBinder( wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, 1)
+    EVT_SEARCHCTRL_SEARCH_BTN = wx.PyEventBinder( wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, 1)
 }
 
 //---------------------------------------------------------------------------