2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: srchctrl.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxSearchCtrl
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 13:29:13 +00:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxSearchCtrl
|
2008-03-08 14:43:31 +00:00
|
|
|
|
|
|
|
A search control is a composite control with a search button, a text
|
2008-03-08 13:52:38 +00:00
|
|
|
control, and a cancel button.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@beginStyleTable
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_PROCESS_ENTER}
|
2013-04-25 10:11:03 +00:00
|
|
|
The control will generate the event @c wxEVT_TEXT_ENTER
|
2008-03-08 13:52:38 +00:00
|
|
|
(otherwise pressing Enter key is either processed internally by the
|
|
|
|
control or used for navigation between dialog controls).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_PROCESS_TAB}
|
2011-01-06 19:52:14 +00:00
|
|
|
The control will receive @c wxEVT_CHAR events for TAB pressed -
|
2008-03-08 13:52:38 +00:00
|
|
|
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.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_NOHIDESEL}
|
2008-03-08 13:52:38 +00:00
|
|
|
By default, the Windows text control doesn't show the selection
|
|
|
|
when it doesn't have focus - use this style to force it to always
|
|
|
|
show it. It doesn't do anything under other platforms.
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_LEFT}
|
2008-03-08 13:52:38 +00:00
|
|
|
The text in the control will be left-justified (default).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_CENTRE}
|
2008-03-08 13:52:38 +00:00
|
|
|
The text in the control will be centered (currently wxMSW and
|
|
|
|
wxGTK2 only).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_RIGHT}
|
2008-03-08 13:52:38 +00:00
|
|
|
The text in the control will be right-justified (currently wxMSW
|
|
|
|
and wxGTK2 only).
|
2008-04-06 14:43:04 +00:00
|
|
|
@style{wxTE_CAPITALIZE}
|
2008-03-08 13:52:38 +00:00
|
|
|
On PocketPC and Smartphone, causes the first letter to be
|
|
|
|
capitalized.
|
|
|
|
@endStyleTable
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2009-02-18 17:58:51 +00:00
|
|
|
@beginEventEmissionTable{wxCommandEvent}
|
2008-10-05 11:24:00 +00:00
|
|
|
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)}
|
2011-01-06 19:52:14 +00:00
|
|
|
Respond to a @c wxEVT_SEARCHCTRL_SEARCH_BTN event, generated when the
|
2010-07-11 10:44:18 +00:00
|
|
|
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.
|
2008-10-05 11:24:00 +00:00
|
|
|
@event{EVT_SEARCHCTRL_CANCEL_BTN(id, func)}
|
2011-01-06 19:52:14 +00:00
|
|
|
Respond to a @c wxEVT_SEARCHCTRL_CANCEL_BTN event, generated when the
|
2008-10-05 11:24:00 +00:00
|
|
|
cancel button is clicked.
|
|
|
|
@endEventTable
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
2008-10-05 11:24:00 +00:00
|
|
|
@category{ctrl}
|
2012-11-03 18:32:50 +00:00
|
|
|
@appearance{searchctrl}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxTextCtrl::Create, wxValidator
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxSearchCtrl : public wxTextCtrl
|
|
|
|
{
|
|
|
|
public:
|
2008-05-29 14:10:52 +00:00
|
|
|
/**
|
|
|
|
Default constructor
|
|
|
|
*/
|
|
|
|
wxSearchCtrl();
|
2008-10-05 11:24:00 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a text control.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param parent
|
2008-03-09 12:33:59 +00:00
|
|
|
Parent window. Should not be @NULL.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param id
|
2008-03-09 12:33:59 +00:00
|
|
|
Control identifier. A value of -1 denotes a default value.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param value
|
2008-03-09 12:33:59 +00:00
|
|
|
Default text value.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2008-03-09 12:33:59 +00:00
|
|
|
Text control position.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param size
|
2008-03-09 12:33:59 +00:00
|
|
|
Text control size.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
Window style. See wxSearchCtrl.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param validator
|
2008-03-09 12:33:59 +00:00
|
|
|
Window validator.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param name
|
2008-03-09 12:33:59 +00:00
|
|
|
Window name.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see wxTextCtrl::Create, wxValidator
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxSearchCtrl(wxWindow* parent, wxWindowID id,
|
2008-11-13 21:32:53 +00:00
|
|
|
const wxString& value = wxEmptyString,
|
2008-03-08 14:43:31 +00:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = 0,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
|
|
|
const wxString& name = wxSearchCtrlNameStr);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the search control.
|
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual ~wxSearchCtrl();
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2011-10-29 21:34:49 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2008-03-08 14:43:31 +00:00
|
|
|
Returns a pointer to the search control's menu object or @NULL if there is no
|
2008-03-08 13:52:38 +00:00
|
|
|
menu attached.
|
|
|
|
*/
|
|
|
|
virtual wxMenu* GetMenu();
|
|
|
|
|
|
|
|
/**
|
2008-03-08 14:43:31 +00:00
|
|
|
Returns the search button visibility value.
|
2008-03-08 13:52:38 +00:00
|
|
|
If there is a menu attached, the search button will be visible regardless of
|
2008-10-05 11:24:00 +00:00
|
|
|
the search button visibility value.
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
This always returns @false in Mac OS X v10.3
|
|
|
|
*/
|
2008-09-27 11:21:10 +00:00
|
|
|
virtual bool IsSearchButtonVisible() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2011-10-29 21:34:49 +00:00
|
|
|
/**
|
|
|
|
Returns the cancel button's visibility state.
|
|
|
|
*/
|
|
|
|
virtual bool IsCancelButtonVisible() const;
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2008-10-05 11:24:00 +00:00
|
|
|
Sets the search control's menu object.
|
|
|
|
If there is already a menu associated with the search control it is deleted.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 14:43:31 +00:00
|
|
|
@param menu
|
2008-03-09 12:33:59 +00:00
|
|
|
Menu to attach to the search control.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
virtual void SetMenu(wxMenu* menu);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Shows or hides the cancel button.
|
|
|
|
*/
|
|
|
|
virtual void ShowCancelButton(bool show);
|
|
|
|
|
|
|
|
/**
|
2008-03-08 14:43:31 +00:00
|
|
|
Sets the search button visibility value on the search control.
|
2008-03-08 13:52:38 +00:00
|
|
|
If there is a menu attached, the search button will be visible regardless of
|
2008-10-05 11:24:00 +00:00
|
|
|
the search button visibility value.
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
This has no effect in Mac OS X v10.3
|
|
|
|
*/
|
|
|
|
virtual void ShowSearchButton(bool show);
|
2011-10-29 21:34:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
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;
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2011-10-29 21:34:49 +00:00
|
|
|
|
2013-04-25 10:11:03 +00:00
|
|
|
wxEventType wxEVT_SEARCHCTRL_CANCEL_BTN;
|
|
|
|
wxEventType wxEVT_SEARCHCTRL_SEARCH_BTN;
|