]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/fdrepdlg.h
Add wxSize::DecToIfSpecified() helper.
[wxWidgets.git] / interface / wx / fdrepdlg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: fdrepdlg.h
3 // Purpose: interface of wxFindDialogEvent, wxFindReplaceDialog
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
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
45 /**
46 @class wxFindDialogEvent
47
48 wxFindReplaceDialog events.
49
50 @beginEventTable{wxFindDialogEvent}
51 @event{EVT_FIND(id, func)}
52 Find button was pressed in the dialog.
53 @event{EVT_FIND_NEXT(id, func)}
54 Find next button was pressed in the dialog.
55 @event{EVT_FIND_REPLACE(id, func)}
56 Replace button was pressed in the dialog.
57 @event{EVT_FIND_REPLACE_ALL(id, func)}
58 Replace all button was pressed in the dialog.
59 @event{EVT_FIND_CLOSE(id, func)}
60 The dialog is being destroyed, any pointers to it cannot be used any longer.
61 @endEventTable
62
63 @library{wxcore}
64 @category{events}
65 */
66 class wxFindDialogEvent : public wxCommandEvent
67 {
68 public:
69 /**
70 Constructor used by wxWidgets only.
71 */
72 wxFindDialogEvent(wxEventType commandType = wxEVT_NULL,
73 int id = 0);
74
75 /**
76 Return the pointer to the dialog which generated this event.
77 */
78 wxFindReplaceDialog* GetDialog() const;
79
80 /**
81 Return the string to find (never empty).
82 */
83 wxString GetFindString() const;
84
85 /**
86 Get the currently selected flags: this is the combination of
87 the ::wxFindReplaceFlags enumeration values.
88 */
89 int GetFlags() const;
90
91 /**
92 Return the string to replace the search string with (only for replace and
93 replace all events).
94 */
95 const wxString& GetReplaceString() const;
96 };
97
98 wxEventType wxEVT_COMMAND_FIND;
99 wxEventType wxEVT_COMMAND_FIND_NEXT;
100 wxEventType wxEVT_COMMAND_FIND_REPLACE;
101 wxEventType wxEVT_COMMAND_FIND_REPLACE_ALL;
102 wxEventType wxEVT_COMMAND_FIND_CLOSE;
103
104
105
106 /**
107 @class wxFindReplaceData
108
109 wxFindReplaceData holds the data for wxFindReplaceDialog.
110
111 It is used to initialize the dialog with the default values and will keep the
112 last values from the dialog when it is closed. It is also updated each time a
113 wxFindDialogEvent is generated so instead of using the wxFindDialogEvent
114 methods you can also directly query this object.
115
116 Note that all @c SetXXX() methods may only be called before showing the
117 dialog and calling them has no effect later.
118
119 @library{wxcore}
120 @category{cmndlg,data}
121 */
122 class wxFindReplaceData : public wxObject
123 {
124 public:
125 /**
126 Constructor initializes the flags to default value (0).
127 */
128 wxFindReplaceData(wxUint32 flags = 0);
129
130 /**
131 Get the string to find.
132 */
133 const wxString& GetFindString();
134
135 /**
136 Get the combination of @c wxFindReplaceFlags values.
137 */
138 int GetFlags() const;
139
140 /**
141 Get the replacement string.
142 */
143 const wxString& GetReplaceString();
144
145 /**
146 Set the string to find (used as initial value by the dialog).
147 */
148 void SetFindString(const wxString& str);
149
150 /**
151 Set the flags to use to initialize the controls of the dialog.
152 */
153 void SetFlags(wxUint32 flags);
154
155 /**
156 Set the replacement string (used as initial value by the dialog).
157 */
158 void SetReplaceString(const wxString& str);
159 };
160
161
162
163 /**
164 @class wxFindReplaceDialog
165
166 wxFindReplaceDialog is a standard modeless dialog which is used to allow the
167 user to search for some text (and possibly replace it with something else).
168
169 The actual searching is supposed to be done in the owner window which is the
170 parent of this dialog. Note that it means that unlike for the other standard
171 dialogs this one @b must have a parent window. Also note that there is no
172 way to use this dialog in a modal way; it is always, by design and
173 implementation, modeless.
174
175 Please see the @ref page_samples_dialogs sample for an example of using it.
176
177 @library{wxcore}
178 @category{cmndlg}
179 */
180 class wxFindReplaceDialog : public wxDialog
181 {
182 public:
183 wxFindReplaceDialog();
184
185 /**
186 After using default constructor Create() must be called.
187
188 The @a parent and @a data parameters must be non-@NULL.
189 */
190 wxFindReplaceDialog(wxWindow* parent,
191 wxFindReplaceData* data,
192 const wxString& title,
193 int style = 0);
194
195 /**
196 Destructor.
197 */
198 virtual ~wxFindReplaceDialog();
199
200 /**
201 Creates the dialog; use wxWindow::Show to show it on screen.
202
203 The @a parent and @a data parameters must be non-@NULL.
204 */
205 bool Create(wxWindow* parent, wxFindReplaceData* data,
206 const wxString& title, int style = 0);
207
208 /**
209 Get the wxFindReplaceData object used by this dialog.
210 */
211 const wxFindReplaceData* GetData() const;
212 };
213