]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/srchctrl.h
Somehow, setting a tint color makes gauge work :/.
[wxWidgets.git] / interface / wx / srchctrl.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: srchctrl.h
e54c96f1 3// Purpose: interface of wxSearchCtrl
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxSearchCtrl
7c913512
FM
10
11 A search control is a composite control with a search button, a text
23324ae1 12 control, and a cancel button.
7c913512 13
23324ae1 14 @beginStyleTable
8c6791e4 15 @style{wxTE_PROCESS_ENTER}
ce7fe42e 16 The control will generate the event @c wxEVT_TEXT_ENTER
23324ae1
FM
17 (otherwise pressing Enter key is either processed internally by the
18 control or used for navigation between dialog controls).
8c6791e4 19 @style{wxTE_PROCESS_TAB}
3a194bda 20 The control will receive @c wxEVT_CHAR events for TAB pressed -
23324ae1
FM
21 normally, TAB is used for passing to the next control in a dialog
22 instead. For the control created with this style, you can still use
23 Ctrl-Enter to pass to the next control from the keyboard.
8c6791e4 24 @style{wxTE_NOHIDESEL}
23324ae1
FM
25 By default, the Windows text control doesn't show the selection
26 when it doesn't have focus - use this style to force it to always
27 show it. It doesn't do anything under other platforms.
8c6791e4 28 @style{wxTE_LEFT}
23324ae1 29 The text in the control will be left-justified (default).
8c6791e4 30 @style{wxTE_CENTRE}
23324ae1
FM
31 The text in the control will be centered (currently wxMSW and
32 wxGTK2 only).
8c6791e4 33 @style{wxTE_RIGHT}
23324ae1
FM
34 The text in the control will be right-justified (currently wxMSW
35 and wxGTK2 only).
8c6791e4 36 @style{wxTE_CAPITALIZE}
23324ae1
FM
37 On PocketPC and Smartphone, causes the first letter to be
38 capitalized.
39 @endStyleTable
7c913512 40
3051a44a 41 @beginEventEmissionTable{wxCommandEvent}
e725ba4f
FM
42 To retrieve actual search queries, use EVT_TEXT and EVT_TEXT_ENTER events,
43 just as you would with wxTextCtrl.
44 @event{EVT_SEARCHCTRL_SEARCH_BTN(id, func)}
3a194bda 45 Respond to a @c wxEVT_SEARCHCTRL_SEARCH_BTN event, generated when the
ac63bc40
VZ
46 search button is clicked. Note that this does not initiate a search on
47 its own, you need to perform the appropriate action in your event
48 handler. You may use @code event.GetString() @endcode to retrieve the
49 string to search for in the event handler code.
e725ba4f 50 @event{EVT_SEARCHCTRL_CANCEL_BTN(id, func)}
3a194bda 51 Respond to a @c wxEVT_SEARCHCTRL_CANCEL_BTN event, generated when the
e725ba4f
FM
52 cancel button is clicked.
53 @endEventTable
54
23324ae1 55 @library{wxcore}
e725ba4f 56 @category{ctrl}
ce154616 57 @appearance{searchctrl}
7c913512 58
e54c96f1 59 @see wxTextCtrl::Create, wxValidator
23324ae1
FM
60*/
61class wxSearchCtrl : public wxTextCtrl
62{
63public:
671600d8
RR
64 /**
65 Default constructor
66 */
67 wxSearchCtrl();
e725ba4f 68
23324ae1
FM
69 /**
70 Constructor, creating and showing a text control.
3c4f71cc 71
7c913512 72 @param parent
4cc4bfaf 73 Parent window. Should not be @NULL.
7c913512 74 @param id
4cc4bfaf 75 Control identifier. A value of -1 denotes a default value.
7c913512 76 @param value
4cc4bfaf 77 Default text value.
7c913512 78 @param pos
4cc4bfaf 79 Text control position.
7c913512 80 @param size
4cc4bfaf 81 Text control size.
7c913512 82 @param style
4cc4bfaf 83 Window style. See wxSearchCtrl.
7c913512 84 @param validator
4cc4bfaf 85 Window validator.
7c913512 86 @param name
4cc4bfaf 87 Window name.
3c4f71cc 88
4cc4bfaf 89 @see wxTextCtrl::Create, wxValidator
23324ae1 90 */
7c913512 91 wxSearchCtrl(wxWindow* parent, wxWindowID id,
11e3af6e 92 const wxString& value = wxEmptyString,
7c913512
FM
93 const wxPoint& pos = wxDefaultPosition,
94 const wxSize& size = wxDefaultSize,
95 long style = 0,
96 const wxValidator& validator = wxDefaultValidator,
97 const wxString& name = wxSearchCtrlNameStr);
23324ae1
FM
98
99 /**
100 Destructor, destroying the search control.
101 */
adaaa686 102 virtual ~wxSearchCtrl();
23324ae1 103
7cab9c41
RD
104
105 bool Create(wxWindow* parent, wxWindowID id,
106 const wxString& value = wxEmptyString,
107 const wxPoint& pos = wxDefaultPosition,
108 const wxSize& size = wxDefaultSize,
109 long style = 0,
110 const wxValidator& validator = wxDefaultValidator,
111 const wxString& name = wxSearchCtrlNameStr);
112
23324ae1 113 /**
7c913512 114 Returns a pointer to the search control's menu object or @NULL if there is no
23324ae1
FM
115 menu attached.
116 */
117 virtual wxMenu* GetMenu();
118
119 /**
7c913512 120 Returns the search button visibility value.
23324ae1 121 If there is a menu attached, the search button will be visible regardless of
e725ba4f
FM
122 the search button visibility value.
123
23324ae1
FM
124 This always returns @false in Mac OS X v10.3
125 */
adaaa686 126 virtual bool IsSearchButtonVisible() const;
23324ae1 127
7cab9c41
RD
128 /**
129 Returns the cancel button's visibility state.
130 */
131 virtual bool IsCancelButtonVisible() const;
132
23324ae1 133 /**
e725ba4f
FM
134 Sets the search control's menu object.
135 If there is already a menu associated with the search control it is deleted.
3c4f71cc 136
7c913512 137 @param menu
4cc4bfaf 138 Menu to attach to the search control.
23324ae1
FM
139 */
140 virtual void SetMenu(wxMenu* menu);
141
142 /**
143 Shows or hides the cancel button.
144 */
145 virtual void ShowCancelButton(bool show);
146
147 /**
7c913512 148 Sets the search button visibility value on the search control.
23324ae1 149 If there is a menu attached, the search button will be visible regardless of
e725ba4f
FM
150 the search button visibility value.
151
23324ae1
FM
152 This has no effect in Mac OS X v10.3
153 */
154 virtual void ShowSearchButton(bool show);
7cab9c41
RD
155
156 /**
157 Set the text to be displayed in the search control when the user has
158 not yet typed anything in it.
159 */
160 void SetDescriptiveText(const wxString& text);
161
162 /**
163 Return the text displayed when there is not yet any user input.
164 */
165 wxString GetDescriptiveText() const;
23324ae1 166};
e54c96f1 167
7cab9c41 168
ce7fe42e
VZ
169wxEventType wxEVT_SEARCHCTRL_CANCEL_BTN;
170wxEventType wxEVT_SEARCHCTRL_SEARCH_BTN;