]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: fdrepdlg.h | |
3 | // Purpose: interface of wxFindDialogEvent, wxFindReplaceDialog | |
4 | // Author: wxWidgets team | |
5 | // Licence: wxWindows licence | |
6 | ///////////////////////////////////////////////////////////////////////////// | |
7 | ||
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 | |
22 | }; | |
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 | |
41 | }; | |
42 | ||
43 | ||
44 | /** | |
45 | @class wxFindDialogEvent | |
46 | ||
47 | wxFindReplaceDialog events. | |
48 | ||
49 | @beginEventTable{wxFindDialogEvent} | |
50 | @event{EVT_FIND(id, func)} | |
51 | Find button was pressed in the dialog. | |
52 | @event{EVT_FIND_NEXT(id, func)} | |
53 | Find next button was pressed in the dialog. | |
54 | @event{EVT_FIND_REPLACE(id, func)} | |
55 | Replace button was pressed in the dialog. | |
56 | @event{EVT_FIND_REPLACE_ALL(id, func)} | |
57 | Replace all button was pressed in the dialog. | |
58 | @event{EVT_FIND_CLOSE(id, func)} | |
59 | The dialog is being destroyed, any pointers to it cannot be used any longer. | |
60 | @endEventTable | |
61 | ||
62 | @library{wxcore} | |
63 | @category{events} | |
64 | */ | |
65 | class wxFindDialogEvent : public wxCommandEvent | |
66 | { | |
67 | public: | |
68 | /** | |
69 | Constructor used by wxWidgets only. | |
70 | */ | |
71 | wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, | |
72 | int id = 0); | |
73 | ||
74 | /** | |
75 | Return the pointer to the dialog which generated this event. | |
76 | */ | |
77 | wxFindReplaceDialog* GetDialog() const; | |
78 | ||
79 | /** | |
80 | Return the string to find (never empty). | |
81 | */ | |
82 | wxString GetFindString() const; | |
83 | ||
84 | /** | |
85 | Get the currently selected flags: this is the combination of | |
86 | the ::wxFindReplaceFlags enumeration values. | |
87 | */ | |
88 | int GetFlags() const; | |
89 | ||
90 | /** | |
91 | Return the string to replace the search string with (only for replace and | |
92 | replace all events). | |
93 | */ | |
94 | const wxString& GetReplaceString() const; | |
95 | }; | |
96 | ||
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; | |
102 | ||
103 | ||
104 | ||
105 | /** | |
106 | @class wxFindReplaceData | |
107 | ||
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. | |
114 | ||
115 | Note that all @c SetXXX() methods may only be called before showing the | |
116 | dialog and calling them has no effect later. | |
117 | ||
118 | @library{wxcore} | |
119 | @category{cmndlg,data} | |
120 | */ | |
121 | class wxFindReplaceData : public wxObject | |
122 | { | |
123 | public: | |
124 | /** | |
125 | Constructor initializes the flags to default value (0). | |
126 | */ | |
127 | wxFindReplaceData(wxUint32 flags = 0); | |
128 | ||
129 | /** | |
130 | Get the string to find. | |
131 | */ | |
132 | const wxString& GetFindString() const; | |
133 | ||
134 | /** | |
135 | Get the combination of @c wxFindReplaceFlags values. | |
136 | */ | |
137 | int GetFlags() const; | |
138 | ||
139 | /** | |
140 | Get the replacement string. | |
141 | */ | |
142 | const wxString& GetReplaceString() const; | |
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 | ||
161 | ||
162 | /** | |
163 | @class wxFindReplaceDialog | |
164 | ||
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). | |
167 | ||
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. | |
173 | ||
174 | Please see the @ref page_samples_dialogs sample for an example of using it. | |
175 | ||
176 | @library{wxcore} | |
177 | @category{cmndlg} | |
178 | */ | |
179 | class wxFindReplaceDialog : public wxDialog | |
180 | { | |
181 | public: | |
182 | wxFindReplaceDialog(); | |
183 | ||
184 | /** | |
185 | After using default constructor Create() must be called. | |
186 | ||
187 | The @a parent and @a data parameters must be non-@NULL. | |
188 | */ | |
189 | wxFindReplaceDialog(wxWindow* parent, | |
190 | wxFindReplaceData* data, | |
191 | const wxString& title, | |
192 | int style = 0); | |
193 | ||
194 | /** | |
195 | Destructor. | |
196 | */ | |
197 | virtual ~wxFindReplaceDialog(); | |
198 | ||
199 | /** | |
200 | Creates the dialog; use wxWindow::Show to show it on screen. | |
201 | ||
202 | The @a parent and @a data parameters must be non-@NULL. | |
203 | */ | |
204 | bool Create(wxWindow* parent, wxFindReplaceData* data, | |
205 | const wxString& title, int style = 0); | |
206 | ||
207 | /** | |
208 | Get the wxFindReplaceData object used by this dialog. | |
209 | */ | |
210 | const wxFindReplaceData* GetData() const; | |
211 | }; | |
212 |