#include </home/zeitlin/src/wx/github/interface/wx/srchctrl.h>
A search control is a composite control with a search button, a text control, and a cancel button.
This class supports the following styles:
wxEVT_COMMAND_TEXT_ENTER
(otherwise pressing Enter key is either processed internally by the control or used for navigation between dialog controls). 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. The following event handler macros redirect the events to member function handlers 'func' with prototypes like:
Event macros for events emitted by this class:
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 event.GetString()
wxEVT_SEARCHCTRL_CANCEL_BTN
event, generated when the cancel button is clicked. wxMSW appearance | wxGTK appearance | wxMac appearance |
Public Member Functions | |
wxSearchCtrl () | |
Default constructor. | |
wxSearchCtrl (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) | |
Constructor, creating and showing a text control. | |
virtual | ~wxSearchCtrl () |
Destructor, destroying the search control. | |
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) |
Creates the text control for two-step construction. | |
virtual wxMenu * | GetMenu () |
Returns a pointer to the search control's menu object or NULL if there is no menu attached. | |
virtual bool | IsSearchButtonVisible () const |
Returns the search button visibility value. | |
virtual bool | IsCancelButtonVisible () const |
Returns the cancel button's visibility state. | |
virtual void | SetMenu (wxMenu *menu) |
Sets the search control's menu object. | |
virtual void | ShowCancelButton (bool show) |
Shows or hides the cancel button. | |
virtual void | ShowSearchButton (bool show) |
Sets the search button visibility value on the search control. | |
void | SetDescriptiveText (const wxString &text) |
Set the text to be displayed in the search control when the user has not yet typed anything in it. | |
wxString | GetDescriptiveText () const |
Return the text displayed when there is not yet any user input. |
wxSearchCtrl::wxSearchCtrl | ( | ) |
Default constructor.
wxSearchCtrl::wxSearchCtrl | ( | 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 |
||
) |
Constructor, creating and showing a text control.
parent | Parent window. Should not be NULL. |
id | Control identifier. A value of -1 denotes a default value. |
value | Default text value. |
pos | Text control position. |
size | Text control size. |
style | Window style. See wxSearchCtrl. |
validator | Window validator. |
name | Window name. |
virtual wxSearchCtrl::~wxSearchCtrl | ( | ) | [virtual] |
Destructor, destroying the search control.
bool wxSearchCtrl::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 |
||
) |
Creates the text control for two-step construction.
This method should be called if the default constructor was used for the control creation. Its parameters have the same meaning as for the non-default constructor.
Reimplemented from wxTextCtrl.
wxString wxSearchCtrl::GetDescriptiveText | ( | ) | const |
Return the text displayed when there is not yet any user input.
virtual wxMenu* wxSearchCtrl::GetMenu | ( | ) | [virtual] |
Returns a pointer to the search control's menu object or NULL if there is no menu attached.
virtual bool wxSearchCtrl::IsCancelButtonVisible | ( | ) | const [virtual] |
Returns the cancel button's visibility state.
virtual bool wxSearchCtrl::IsSearchButtonVisible | ( | ) | const [virtual] |
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.
This always returns false in Mac OS X v10.3
void wxSearchCtrl::SetDescriptiveText | ( | const wxString & | text | ) |
Set the text to be displayed in the search control when the user has not yet typed anything in it.
virtual void wxSearchCtrl::SetMenu | ( | wxMenu * | menu | ) | [virtual] |
Sets the search control's menu object.
If there is already a menu associated with the search control it is deleted.
menu | Menu to attach to the search control. |
virtual void wxSearchCtrl::ShowCancelButton | ( | bool | show | ) | [virtual] |
Shows or hides the cancel button.
virtual void wxSearchCtrl::ShowSearchButton | ( | bool | show | ) | [virtual] |
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.
This has no effect in Mac OS X v10.3