]> git.saurik.com Git - wxWidgets.git/blame - interface/fdrepdlg.h
first raw revision
[wxWidgets.git] / interface / fdrepdlg.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: fdrepdlg.h
0ce6d6c8 3// Purpose: interface of wxFindDialogEvent, wxFindReplaceDialog
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
0ce6d6c8
FM
9
10/**
11 See wxFindDialogEvent::GetFlags().
12*/
13enum 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*/
29enum 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
47 @wxheader{fdrepdlg.h}
7c913512 48
23324ae1 49 wxFindReplaceDialog events
7c913512 50
0ce6d6c8
FM
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
23324ae1
FM
64 @library{wxcore}
65 @category{events}
66*/
67class wxFindDialogEvent : public wxCommandEvent
68{
69public:
70 /**
71 Constuctor used by wxWidgets only.
72 */
4cc4bfaf 73 wxFindDialogEvent(wxEventType commandType = wxEVT_NULL,
23324ae1
FM
74 int id = 0);
75
76 /**
77 Return the pointer to the dialog which generated this event.
78 */
328f5751 79 wxFindReplaceDialog* GetDialog() const;
23324ae1
FM
80
81 /**
82 Return the string to find (never empty).
83 */
328f5751 84 wxString GetFindString() const;
23324ae1
FM
85
86 /**
0ce6d6c8
FM
87 Get the currently selected flags: this is the combination of
88 the ::wxFindReplaceFlags enumeration values.
23324ae1 89 */
328f5751 90 int GetFlags() const;
23324ae1
FM
91
92 /**
93 Return the string to replace the search string with (only for replace and
94 replace all events).
95 */
0ce6d6c8 96 const wxString& GetReplaceString() const;
23324ae1
FM
97};
98
99
e54c96f1 100
23324ae1
FM
101/**
102 @class wxFindReplaceData
103 @wxheader{fdrepdlg.h}
7c913512 104
0ce6d6c8
FM
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.
7c913512 111
23324ae1
FM
112 Note that all @c SetXXX() methods may only be called before showing the
113 dialog and calling them has no effect later.
7c913512 114
23324ae1 115 @library{wxcore}
0ce6d6c8 116 @category{data}
23324ae1
FM
117*/
118class wxFindReplaceData : public wxObject
119{
120public:
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 */
328f5751 134 int GetFlags() const;
23324ae1
FM
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
e54c96f1 158
23324ae1
FM
159/**
160 @class wxFindReplaceDialog
161 @wxheader{fdrepdlg.h}
7c913512 162
23324ae1
FM
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).
0ce6d6c8 165
23324ae1
FM
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.
7c913512 171
0ce6d6c8 172 Please see the @ref page_samples_dialogs sample for an example of using it.
7c913512 173
23324ae1
FM
174 @library{wxcore}
175 @category{cmndlg}
176*/
177class wxFindReplaceDialog : public wxDialog
178{
179public:
0ce6d6c8
FM
180 wxFindReplaceDialog();
181
23324ae1 182 /**
0ce6d6c8
FM
183 After using default constructor Create() must be called.
184
4cc4bfaf 185 The @a parent and @a data parameters must be non-@NULL.
23324ae1 186 */
4cc4bfaf 187 wxFindReplaceDialog(wxWindow* parent,
7c913512
FM
188 wxFindReplaceData* data,
189 const wxString& title,
190 int style = 0);
23324ae1
FM
191
192 /**
193 Destructor.
194 */
195 ~wxFindReplaceDialog();
196
197 /**
198 Creates the dialog; use wxWindow::Show to show it on screen.
0ce6d6c8 199
4cc4bfaf 200 The @a parent and @a data parameters must be non-@NULL.
23324ae1 201 */
4cc4bfaf 202 bool Create(wxWindow* parent, wxFindReplaceData* data,
23324ae1
FM
203 const wxString& title, int style = 0);
204
205 /**
0ce6d6c8 206 Get the wxFindReplaceData object used by this dialog.
23324ae1 207 */
328f5751 208 const wxFindReplaceData* GetData() const;
23324ae1 209};
e54c96f1 210