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