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