]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: srchctrl.h | |
e54c96f1 | 3 | // Purpose: interface of wxSearchCtrl |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxSearchCtrl | |
7c913512 FM |
11 | |
12 | A search control is a composite control with a search button, a text | |
23324ae1 | 13 | control, and a cancel button. |
7c913512 | 14 | |
23324ae1 | 15 | @beginStyleTable |
8c6791e4 | 16 | @style{wxTE_PROCESS_ENTER} |
23324ae1 FM |
17 | The control will generate the event wxEVT_COMMAND_TEXT_ENTER |
18 | (otherwise pressing Enter key is either processed internally by the | |
19 | control or used for navigation between dialog controls). | |
8c6791e4 | 20 | @style{wxTE_PROCESS_TAB} |
23324ae1 FM |
21 | The control will receive wxEVT_CHAR events for TAB pressed - |
22 | normally, TAB is used for passing to the next control in a dialog | |
23 | instead. For the control created with this style, you can still use | |
24 | Ctrl-Enter to pass to the next control from the keyboard. | |
8c6791e4 | 25 | @style{wxTE_NOHIDESEL} |
23324ae1 FM |
26 | By default, the Windows text control doesn't show the selection |
27 | when it doesn't have focus - use this style to force it to always | |
28 | show it. It doesn't do anything under other platforms. | |
8c6791e4 | 29 | @style{wxTE_LEFT} |
23324ae1 | 30 | The text in the control will be left-justified (default). |
8c6791e4 | 31 | @style{wxTE_CENTRE} |
23324ae1 FM |
32 | The text in the control will be centered (currently wxMSW and |
33 | wxGTK2 only). | |
8c6791e4 | 34 | @style{wxTE_RIGHT} |
23324ae1 FM |
35 | The text in the control will be right-justified (currently wxMSW |
36 | and wxGTK2 only). | |
8c6791e4 | 37 | @style{wxTE_CAPITALIZE} |
23324ae1 FM |
38 | On PocketPC and Smartphone, causes the first letter to be |
39 | capitalized. | |
40 | @endStyleTable | |
7c913512 | 41 | |
e725ba4f FM |
42 | @beginEventTable{wxCommandEvent} |
43 | To retrieve actual search queries, use EVT_TEXT and EVT_TEXT_ENTER events, | |
44 | just as you would with wxTextCtrl. | |
45 | @event{EVT_SEARCHCTRL_SEARCH_BTN(id, func)} | |
46 | Respond to a wxEVT_SEARCHCTRL_SEARCH_BTN event, generated when the | |
47 | search button is clicked. Note that this does not initiate a search. | |
48 | @event{EVT_SEARCHCTRL_CANCEL_BTN(id, func)} | |
49 | Respond to a wxEVT_SEARCHCTRL_CANCEL_BTN event, generated when the | |
50 | cancel button is clicked. | |
51 | @endEventTable | |
52 | ||
23324ae1 | 53 | @library{wxcore} |
e725ba4f | 54 | @category{ctrl} |
e4821c39 | 55 | @appearance{searchctrl.png} |
7c913512 | 56 | |
e54c96f1 | 57 | @see wxTextCtrl::Create, wxValidator |
23324ae1 FM |
58 | */ |
59 | class wxSearchCtrl : public wxTextCtrl | |
60 | { | |
61 | public: | |
671600d8 RR |
62 | /** |
63 | Default constructor | |
64 | */ | |
65 | wxSearchCtrl(); | |
e725ba4f | 66 | |
23324ae1 FM |
67 | /** |
68 | Constructor, creating and showing a text control. | |
3c4f71cc | 69 | |
7c913512 | 70 | @param parent |
4cc4bfaf | 71 | Parent window. Should not be @NULL. |
7c913512 | 72 | @param id |
4cc4bfaf | 73 | Control identifier. A value of -1 denotes a default value. |
7c913512 | 74 | @param value |
4cc4bfaf | 75 | Default text value. |
7c913512 | 76 | @param pos |
4cc4bfaf | 77 | Text control position. |
7c913512 | 78 | @param size |
4cc4bfaf | 79 | Text control size. |
7c913512 | 80 | @param style |
4cc4bfaf | 81 | Window style. See wxSearchCtrl. |
7c913512 | 82 | @param validator |
4cc4bfaf | 83 | Window validator. |
7c913512 | 84 | @param name |
4cc4bfaf | 85 | Window name. |
3c4f71cc | 86 | |
4cc4bfaf | 87 | @see wxTextCtrl::Create, wxValidator |
23324ae1 | 88 | */ |
7c913512 | 89 | wxSearchCtrl(wxWindow* parent, wxWindowID id, |
11e3af6e | 90 | const wxString& value = wxEmptyString, |
7c913512 FM |
91 | const wxPoint& pos = wxDefaultPosition, |
92 | const wxSize& size = wxDefaultSize, | |
93 | long style = 0, | |
94 | const wxValidator& validator = wxDefaultValidator, | |
95 | const wxString& name = wxSearchCtrlNameStr); | |
23324ae1 FM |
96 | |
97 | /** | |
98 | Destructor, destroying the search control. | |
99 | */ | |
adaaa686 | 100 | virtual ~wxSearchCtrl(); |
23324ae1 FM |
101 | |
102 | /** | |
7c913512 | 103 | Returns a pointer to the search control's menu object or @NULL if there is no |
23324ae1 FM |
104 | menu attached. |
105 | */ | |
106 | virtual wxMenu* GetMenu(); | |
107 | ||
108 | /** | |
7c913512 | 109 | Returns the search button visibility value. |
23324ae1 | 110 | If there is a menu attached, the search button will be visible regardless of |
e725ba4f FM |
111 | the search button visibility value. |
112 | ||
23324ae1 FM |
113 | This always returns @false in Mac OS X v10.3 |
114 | */ | |
adaaa686 | 115 | virtual bool IsSearchButtonVisible() const; |
23324ae1 FM |
116 | |
117 | /** | |
e725ba4f FM |
118 | Sets the search control's menu object. |
119 | If there is already a menu associated with the search control it is deleted. | |
3c4f71cc | 120 | |
7c913512 | 121 | @param menu |
4cc4bfaf | 122 | Menu to attach to the search control. |
23324ae1 FM |
123 | */ |
124 | virtual void SetMenu(wxMenu* menu); | |
125 | ||
126 | /** | |
127 | Shows or hides the cancel button. | |
128 | */ | |
129 | virtual void ShowCancelButton(bool show); | |
130 | ||
131 | /** | |
7c913512 | 132 | Sets the search button visibility value on the search control. |
23324ae1 | 133 | If there is a menu attached, the search button will be visible regardless of |
e725ba4f FM |
134 | the search button visibility value. |
135 | ||
23324ae1 FM |
136 | This has no effect in Mac OS X v10.3 |
137 | */ | |
138 | virtual void ShowSearchButton(bool show); | |
139 | }; | |
e54c96f1 | 140 |