]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: fdrepdlg.h | |
0ce6d6c8 | 3 | // Purpose: interface of wxFindDialogEvent, wxFindReplaceDialog |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
0ce6d6c8 FM |
8 | |
9 | /** | |
10 | See wxFindDialogEvent::GetFlags(). | |
11 | */ | |
12 | enum wxFindReplaceFlags | |
13 | { | |
14 | /** downward search/replace selected (otherwise - upwards) */ | |
15 | wxFR_DOWN = 1, | |
16 | ||
17 | /** whole word search/replace selected */ | |
18 | wxFR_WHOLEWORD = 2, | |
19 | ||
20 | /** case sensitive search/replace selected (otherwise - case insensitive) */ | |
21 | wxFR_MATCHCASE = 4 | |
475d0f24 | 22 | }; |
0ce6d6c8 FM |
23 | |
24 | ||
25 | /** | |
26 | These flags can be specified in wxFindReplaceDialog ctor or Create(): | |
27 | */ | |
28 | enum wxFindReplaceDialogStyles | |
29 | { | |
30 | /** replace dialog (otherwise find dialog) */ | |
31 | wxFR_REPLACEDIALOG = 1, | |
32 | ||
33 | /** don't allow changing the search direction */ | |
34 | wxFR_NOUPDOWN = 2, | |
35 | ||
36 | /** don't allow case sensitive searching */ | |
37 | wxFR_NOMATCHCASE = 4, | |
38 | ||
39 | /** don't allow whole word searching */ | |
40 | wxFR_NOWHOLEWORD = 8 | |
475d0f24 | 41 | }; |
0ce6d6c8 FM |
42 | |
43 | ||
23324ae1 FM |
44 | /** |
45 | @class wxFindDialogEvent | |
7c913512 | 46 | |
3051a44a | 47 | wxFindReplaceDialog events. |
7c913512 | 48 | |
0ce6d6c8 | 49 | @beginEventTable{wxFindDialogEvent} |
8c6791e4 | 50 | @event{EVT_FIND(id, func)} |
0ce6d6c8 | 51 | Find button was pressed in the dialog. |
8c6791e4 | 52 | @event{EVT_FIND_NEXT(id, func)} |
0ce6d6c8 | 53 | Find next button was pressed in the dialog. |
8c6791e4 | 54 | @event{EVT_FIND_REPLACE(id, func)} |
0ce6d6c8 | 55 | Replace button was pressed in the dialog. |
8c6791e4 | 56 | @event{EVT_FIND_REPLACE_ALL(id, func)} |
0ce6d6c8 | 57 | Replace all button was pressed in the dialog. |
8c6791e4 | 58 | @event{EVT_FIND_CLOSE(id, func)} |
0ce6d6c8 FM |
59 | The dialog is being destroyed, any pointers to it cannot be used any longer. |
60 | @endEventTable | |
61 | ||
23324ae1 FM |
62 | @library{wxcore} |
63 | @category{events} | |
64 | */ | |
65 | class wxFindDialogEvent : public wxCommandEvent | |
66 | { | |
67 | public: | |
68 | /** | |
d13b34d3 | 69 | Constructor used by wxWidgets only. |
23324ae1 | 70 | */ |
4cc4bfaf | 71 | wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, |
23324ae1 FM |
72 | int id = 0); |
73 | ||
74 | /** | |
75 | Return the pointer to the dialog which generated this event. | |
76 | */ | |
328f5751 | 77 | wxFindReplaceDialog* GetDialog() const; |
23324ae1 FM |
78 | |
79 | /** | |
80 | Return the string to find (never empty). | |
81 | */ | |
328f5751 | 82 | wxString GetFindString() const; |
23324ae1 FM |
83 | |
84 | /** | |
0ce6d6c8 FM |
85 | Get the currently selected flags: this is the combination of |
86 | the ::wxFindReplaceFlags enumeration values. | |
23324ae1 | 87 | */ |
328f5751 | 88 | int GetFlags() const; |
23324ae1 FM |
89 | |
90 | /** | |
91 | Return the string to replace the search string with (only for replace and | |
92 | replace all events). | |
93 | */ | |
0ce6d6c8 | 94 | const wxString& GetReplaceString() const; |
23324ae1 FM |
95 | }; |
96 | ||
ce7fe42e VZ |
97 | wxEventType wxEVT_FIND; |
98 | wxEventType wxEVT_FIND_NEXT; | |
99 | wxEventType wxEVT_FIND_REPLACE; | |
100 | wxEventType wxEVT_FIND_REPLACE_ALL; | |
101 | wxEventType wxEVT_FIND_CLOSE; | |
475d0f24 | 102 | |
23324ae1 | 103 | |
e54c96f1 | 104 | |
23324ae1 FM |
105 | /** |
106 | @class wxFindReplaceData | |
7c913512 | 107 | |
0ce6d6c8 FM |
108 | wxFindReplaceData holds the data for wxFindReplaceDialog. |
109 | ||
110 | It is used to initialize the dialog with the default values and will keep the | |
111 | last values from the dialog when it is closed. It is also updated each time a | |
112 | wxFindDialogEvent is generated so instead of using the wxFindDialogEvent | |
113 | methods you can also directly query this object. | |
7c913512 | 114 | |
23324ae1 FM |
115 | Note that all @c SetXXX() methods may only be called before showing the |
116 | dialog and calling them has no effect later. | |
7c913512 | 117 | |
23324ae1 | 118 | @library{wxcore} |
3c99e2fd | 119 | @category{cmndlg,data} |
23324ae1 FM |
120 | */ |
121 | class wxFindReplaceData : public wxObject | |
122 | { | |
123 | public: | |
124 | /** | |
d13b34d3 | 125 | Constructor initializes the flags to default value (0). |
23324ae1 FM |
126 | */ |
127 | wxFindReplaceData(wxUint32 flags = 0); | |
128 | ||
129 | /** | |
130 | Get the string to find. | |
131 | */ | |
5475b39f | 132 | const wxString& GetFindString() const; |
23324ae1 FM |
133 | |
134 | /** | |
135 | Get the combination of @c wxFindReplaceFlags values. | |
136 | */ | |
328f5751 | 137 | int GetFlags() const; |
23324ae1 FM |
138 | |
139 | /** | |
140 | Get the replacement string. | |
141 | */ | |
5475b39f | 142 | const wxString& GetReplaceString() const; |
23324ae1 FM |
143 | |
144 | /** | |
145 | Set the string to find (used as initial value by the dialog). | |
146 | */ | |
147 | void SetFindString(const wxString& str); | |
148 | ||
149 | /** | |
150 | Set the flags to use to initialize the controls of the dialog. | |
151 | */ | |
152 | void SetFlags(wxUint32 flags); | |
153 | ||
154 | /** | |
155 | Set the replacement string (used as initial value by the dialog). | |
156 | */ | |
157 | void SetReplaceString(const wxString& str); | |
158 | }; | |
159 | ||
160 | ||
e54c96f1 | 161 | |
23324ae1 FM |
162 | /** |
163 | @class wxFindReplaceDialog | |
7c913512 | 164 | |
23324ae1 FM |
165 | wxFindReplaceDialog is a standard modeless dialog which is used to allow the |
166 | user to search for some text (and possibly replace it with something else). | |
0ce6d6c8 | 167 | |
23324ae1 FM |
168 | The actual searching is supposed to be done in the owner window which is the |
169 | parent of this dialog. Note that it means that unlike for the other standard | |
170 | dialogs this one @b must have a parent window. Also note that there is no | |
171 | way to use this dialog in a modal way; it is always, by design and | |
172 | implementation, modeless. | |
7c913512 | 173 | |
0ce6d6c8 | 174 | Please see the @ref page_samples_dialogs sample for an example of using it. |
7c913512 | 175 | |
23324ae1 FM |
176 | @library{wxcore} |
177 | @category{cmndlg} | |
178 | */ | |
179 | class wxFindReplaceDialog : public wxDialog | |
180 | { | |
181 | public: | |
0ce6d6c8 FM |
182 | wxFindReplaceDialog(); |
183 | ||
23324ae1 | 184 | /** |
0ce6d6c8 FM |
185 | After using default constructor Create() must be called. |
186 | ||
4cc4bfaf | 187 | The @a parent and @a data parameters must be non-@NULL. |
23324ae1 | 188 | */ |
4cc4bfaf | 189 | wxFindReplaceDialog(wxWindow* parent, |
7c913512 FM |
190 | wxFindReplaceData* data, |
191 | const wxString& title, | |
192 | int style = 0); | |
23324ae1 FM |
193 | |
194 | /** | |
195 | Destructor. | |
196 | */ | |
adaaa686 | 197 | virtual ~wxFindReplaceDialog(); |
23324ae1 FM |
198 | |
199 | /** | |
200 | Creates the dialog; use wxWindow::Show to show it on screen. | |
0ce6d6c8 | 201 | |
4cc4bfaf | 202 | The @a parent and @a data parameters must be non-@NULL. |
23324ae1 | 203 | */ |
4cc4bfaf | 204 | bool Create(wxWindow* parent, wxFindReplaceData* data, |
23324ae1 FM |
205 | const wxString& title, int style = 0); |
206 | ||
207 | /** | |
0ce6d6c8 | 208 | Get the wxFindReplaceData object used by this dialog. |
23324ae1 | 209 | */ |
328f5751 | 210 | const wxFindReplaceData* GetData() const; |
23324ae1 | 211 | }; |
e54c96f1 | 212 |