X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3c17b4013e80b99976c750c19fca47729517f6..7c60222510bc5e197b12f153c4bf05db66cb0f4a:/interface/wx/srchctrl.h diff --git a/interface/wx/srchctrl.h b/interface/wx/srchctrl.h index 348632ae3f..a29762df6c 100644 --- a/interface/wx/srchctrl.h +++ b/interface/wx/srchctrl.h @@ -3,23 +3,22 @@ // Purpose: interface of wxSearchCtrl // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @class wxSearchCtrl - @wxheader{srchctrl.h} A search control is a composite control with a search button, a text control, and a cancel button. @beginStyleTable @style{wxTE_PROCESS_ENTER} - The control will generate the event wxEVT_COMMAND_TEXT_ENTER + The control will generate the event @c wxEVT_TEXT_ENTER (otherwise pressing Enter key is either processed internally by the control or used for navigation between dialog controls). @style{wxTE_PROCESS_TAB} - The control will receive wxEVT_CHAR events for TAB pressed - + The control will receive @c wxEVT_CHAR events for TAB pressed - normally, TAB is used for passing to the next control in a dialog instead. For the control created with this style, you can still use Ctrl-Enter to pass to the next control from the keyboard. @@ -40,8 +39,23 @@ capitalized. @endStyleTable + @beginEventEmissionTable{wxCommandEvent} + To retrieve actual search queries, use EVT_TEXT and EVT_TEXT_ENTER events, + just as you would with wxTextCtrl. + @event{EVT_SEARCHCTRL_SEARCH_BTN(id, func)} + Respond to a @c wxEVT_SEARCHCTRL_SEARCH_BTN event, generated when the + search button is clicked. Note that this does not initiate a search on + its own, you need to perform the appropriate action in your event + handler. You may use @code event.GetString() @endcode to retrieve the + string to search for in the event handler code. + @event{EVT_SEARCHCTRL_CANCEL_BTN(id, func)} + Respond to a @c wxEVT_SEARCHCTRL_CANCEL_BTN event, generated when the + cancel button is clicked. + @endEventTable + @library{wxcore} - @category{FIXME} + @category{ctrl} + @appearance{searchctrl} @see wxTextCtrl::Create, wxValidator */ @@ -52,7 +66,7 @@ public: Default constructor */ wxSearchCtrl(); - + /** Constructor, creating and showing a text control. @@ -76,7 +90,7 @@ public: @see wxTextCtrl::Create, wxValidator */ wxSearchCtrl(wxWindow* parent, wxWindowID id, - const wxString& value = "", + const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, @@ -86,7 +100,16 @@ public: /** Destructor, destroying the search control. */ - ~wxSearchCtrl(); + virtual ~wxSearchCtrl(); + + + bool Create(wxWindow* parent, wxWindowID id, + const wxString& value = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxSearchCtrlNameStr); /** Returns a pointer to the search control's menu object or @NULL if there is no @@ -97,16 +120,20 @@ public: /** Returns the search button visibility value. If there is a menu attached, the search button will be visible regardless of - the search - button visibility value. + the search button visibility value. + This always returns @false in Mac OS X v10.3 */ - virtual bool IsSearchButtonVisible(); + virtual bool IsSearchButtonVisible() const; /** - Sets the search control's menu object. If there is already a menu associated - with - the search control it is deleted. + Returns the cancel button's visibility state. + */ + virtual bool IsCancelButtonVisible() const; + + /** + Sets the search control's menu object. + If there is already a menu associated with the search control it is deleted. @param menu Menu to attach to the search control. @@ -121,10 +148,24 @@ public: /** Sets the search button visibility value on the search control. If there is a menu attached, the search button will be visible regardless of - the search - button visibility value. + the search button visibility value. + This has no effect in Mac OS X v10.3 */ virtual void ShowSearchButton(bool show); + + /** + Set the text to be displayed in the search control when the user has + not yet typed anything in it. + */ + void SetDescriptiveText(const wxString& text); + + /** + Return the text displayed when there is not yet any user input. + */ + wxString GetDescriptiveText() const; }; + +wxEventType wxEVT_SEARCHCTRL_CANCEL_BTN; +wxEventType wxEVT_SEARCHCTRL_SEARCH_BTN;