]>
Commit | Line | Data |
---|---|---|
7bf85405 | 1 | ///////////////////////////////////////////////////////////////////////////// |
d14a1e28 RD |
2 | // Name: _cmndlgs.i |
3 | // Purpose: SWIG interface for the "Common Dialog" classes | |
7bf85405 RD |
4 | // |
5 | // Author: Robin Dunn | |
6 | // | |
d14a1e28 | 7 | // Created: 25-July-1998 |
7bf85405 | 8 | // RCS-ID: $Id$ |
d14a1e28 | 9 | // Copyright: (c) 2003 by Total Control Software |
7bf85405 RD |
10 | // Licence: wxWindows license |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
d14a1e28 | 13 | // Not a %module |
7bf85405 | 14 | |
7bf85405 | 15 | |
d14a1e28 RD |
16 | //--------------------------------------------------------------------------- |
17 | %newgroup | |
7bf85405 | 18 | |
b2dc1044 RD |
19 | MAKE_CONST_WXSTRING(FileSelectorPromptStr); |
20 | MAKE_CONST_WXSTRING(DirSelectorPromptStr); | |
21 | MAKE_CONST_WXSTRING(DirDialogNameStr); | |
22 | MAKE_CONST_WXSTRING(FileSelectorDefaultWildcardStr); | |
23 | MAKE_CONST_WXSTRING(GetTextFromUserPromptStr); | |
24 | MAKE_CONST_WXSTRING(MessageBoxCaptionStr); | |
137b5242 | 25 | |
d14a1e28 RD |
26 | //--------------------------------------------------------------------------- |
27 | ||
137b5242 | 28 | |
fcafa8a9 | 29 | DocStr(wxColourData, |
dce2bd22 RD |
30 | "This class holds a variety of information related to the colour |
31 | chooser dialog, used to transfer settings and results to and from the | |
d07d2bc9 | 32 | `wx.ColourDialog`.", ""); |
d0e2ede0 | 33 | |
9416aa89 | 34 | class wxColourData : public wxObject { |
7bf85405 | 35 | public: |
fcafa8a9 RD |
36 | DocCtorStr( |
37 | wxColourData(), | |
d07d2bc9 | 38 | "Constructor, sets default values.", ""); |
d0e2ede0 | 39 | |
7bf85405 RD |
40 | ~wxColourData(); |
41 | ||
d0e2ede0 | 42 | |
fcafa8a9 RD |
43 | DocDeclStr( |
44 | bool , GetChooseFull(), | |
dce2bd22 RD |
45 | "Under Windows, determines whether the Windows colour dialog will |
46 | display the full dialog with custom colour selection controls. Has no | |
d07d2bc9 | 47 | meaning under other platforms. The default value is true.", ""); |
d0e2ede0 | 48 | |
fcafa8a9 RD |
49 | DocDeclStr( |
50 | wxColour , GetColour(), | |
d07d2bc9 | 51 | "Gets the colour (pre)selected by the dialog.", ""); |
d0e2ede0 | 52 | |
fcafa8a9 RD |
53 | DocDeclStr( |
54 | wxColour , GetCustomColour(int i), | |
dce2bd22 RD |
55 | "Gets the i'th custom colour associated with the colour dialog. i |
56 | should be an integer between 0 and 15. The default custom colours are | |
da397248 | 57 | all invalid colours.", ""); |
d0e2ede0 | 58 | |
fcafa8a9 RD |
59 | DocDeclStr( |
60 | void , SetChooseFull(int flag), | |
dce2bd22 RD |
61 | "Under Windows, tells the Windows colour dialog to display the full |
62 | dialog with custom colour selection controls. Under other platforms, | |
d07d2bc9 | 63 | has no effect. The default value is true.", ""); |
d0e2ede0 | 64 | |
fcafa8a9 RD |
65 | DocDeclStr( |
66 | void , SetColour(const wxColour& colour), | |
dce2bd22 | 67 | "Sets the default colour for the colour dialog. The default colour is |
d07d2bc9 | 68 | black.", ""); |
d0e2ede0 | 69 | |
fcafa8a9 RD |
70 | DocDeclStr( |
71 | void , SetCustomColour(int i, const wxColour& colour), | |
dce2bd22 | 72 | "Sets the i'th custom colour for the colour dialog. i should be an |
da397248 | 73 | integer between 0 and 15. The default custom colours are all invalid colours.", ""); |
d0e2ede0 | 74 | |
0eae5d09 RD |
75 | |
76 | %property(ChooseFull, GetChooseFull, SetChooseFull, doc="See `GetChooseFull` and `SetChooseFull`"); | |
77 | %property(Colour, GetColour, SetColour, doc="See `GetColour` and `SetColour`"); | |
78 | %property(CustomColour, GetCustomColour, SetCustomColour, doc="See `GetCustomColour` and `SetCustomColour`"); | |
79 | ||
7bf85405 RD |
80 | }; |
81 | ||
82 | ||
dce2bd22 RD |
83 | |
84 | ||
fcafa8a9 | 85 | DocStr(wxColourDialog, |
d07d2bc9 | 86 | "This class represents the colour chooser dialog.", ""); |
fcafa8a9 | 87 | |
ab1f7d2a RD |
88 | MustHaveApp(wxColourDialog); |
89 | ||
7bf85405 RD |
90 | class wxColourDialog : public wxDialog { |
91 | public: | |
2b9048c5 | 92 | %pythonAppend wxColourDialog "self._setOORInfo(self)" |
7bf85405 | 93 | |
fcafa8a9 RD |
94 | DocCtorStr( |
95 | wxColourDialog(wxWindow* parent, wxColourData* data = NULL), | |
dce2bd22 RD |
96 | "Constructor. Pass a parent window, and optionally a `wx.ColourData`, |
97 | which will be copied to the colour dialog's internal ColourData | |
d07d2bc9 | 98 | instance.", ""); |
0122b7e3 | 99 | |
fcafa8a9 RD |
100 | DocDeclStr( |
101 | wxColourData& , GetColourData(), | |
d07d2bc9 | 102 | "Returns a reference to the `wx.ColourData` used by the dialog.", ""); |
0eae5d09 RD |
103 | |
104 | %property(ColourData, GetColourData, doc="See `GetColourData`"); | |
7bf85405 RD |
105 | }; |
106 | ||
107 | ||
1979aa58 RD |
108 | wxColour wxGetColourFromUser(wxWindow *parent = (wxWindow *)NULL, |
109 | const wxColour& colInit = wxNullColour, | |
110 | const wxString& caption = wxPyEmptyString); | |
111 | ||
112 | ||
d14a1e28 | 113 | //-------------------------------------------------------------------------------- |
7bf85405 | 114 | |
d0e2ede0 | 115 | enum { |
cbfc9df6 RD |
116 | wxDD_CHANGE_DIR, |
117 | wxDD_DIR_MUST_EXIST, | |
d0e2ede0 RD |
118 | wxDD_NEW_DIR_BUTTON, |
119 | wxDD_DEFAULT_STYLE, | |
d0e2ede0 | 120 | }; |
fcafa8a9 RD |
121 | |
122 | DocStr(wxDirDialog, | |
dce2bd22 | 123 | "wx.DirDialog allows the user to select a directory by browising the |
d07d2bc9 | 124 | file system.", " |
dce2bd22 RD |
125 | |
126 | Window Styles | |
127 | -------------- | |
128 | ==================== ========================================== | |
d0e2ede0 RD |
129 | wx.DD_DEFAULT_STYLE Equivalent to a combination of |
130 | wx.DEFAULT_DIALOG_STYLE, wx.DD_NEW_DIR_BUTTON | |
131 | and wx.RESIZE_BORDER. | |
132 | ||
cbfc9df6 RD |
133 | wx.DD_DIR_MUST_EXIST The dialog will allow the user to choose only an |
134 | existing folder. When this style is not given, a | |
135 | 'Create new directory' button is added to the dialog | |
136 | (on Windows) or some other way is provided to the | |
137 | user to type the name of a new folder. | |
138 | Use this instead of deprecated wx.DD_NEW_DIR_BUTTON. | |
d0e2ede0 RD |
139 | |
140 | wx.DD_CHANGE_DIR Change the current working directory to the | |
141 | directory chosen by the user. | |
dce2bd22 RD |
142 | ==================== ========================================== |
143 | "); | |
fcafa8a9 | 144 | |
ab1f7d2a RD |
145 | MustHaveApp(wxDirDialog); |
146 | ||
7bf85405 RD |
147 | class wxDirDialog : public wxDialog { |
148 | public: | |
2b9048c5 | 149 | %pythonAppend wxDirDialog "self._setOORInfo(self)" |
41d4305c | 150 | %pythonAppend wxDirDialog() "" |
d0e2ede0 | 151 | |
fcafa8a9 RD |
152 | DocCtorStr( |
153 | wxDirDialog(wxWindow* parent, | |
154 | const wxString& message = wxPyDirSelectorPromptStr, | |
155 | const wxString& defaultPath = wxPyEmptyString, | |
d0e2ede0 | 156 | long style = wxDD_DEFAULT_STYLE, |
fcafa8a9 RD |
157 | const wxPoint& pos = wxDefaultPosition, |
158 | const wxSize& size = wxDefaultSize, | |
159 | const wxString& name = wxPyDirDialogNameStr), | |
d07d2bc9 | 160 | "Constructor. Use ShowModal method to show the dialog.", ""); |
fcafa8a9 | 161 | |
2daad280 RD |
162 | // %RenameCtor(PreDirDialog, wxDirDialog()); |
163 | ||
164 | // bool Create(wxWindow *parent, | |
165 | // const wxString& title = wxDirSelectorPromptStr, | |
166 | // const wxString& defaultPath = wxEmptyString, | |
167 | // long style = wxDD_DEFAULT_STYLE, | |
168 | // const wxPoint& pos = wxDefaultPosition, | |
169 | // const wxSize& sz = wxDefaultSize, | |
170 | // const wxString& name = wxPyDirDialogNameStr); | |
fcafa8a9 RD |
171 | |
172 | DocDeclStr( | |
173 | wxString , GetPath(), | |
d07d2bc9 | 174 | "Returns the default or user-selected path.", ""); |
d0e2ede0 | 175 | |
fcafa8a9 RD |
176 | DocDeclStr( |
177 | wxString , GetMessage(), | |
d07d2bc9 | 178 | "Returns the message that will be displayed on the dialog.", ""); |
d0e2ede0 | 179 | |
fcafa8a9 RD |
180 | DocDeclStr( |
181 | void , SetMessage(const wxString& message), | |
d07d2bc9 | 182 | "Sets the message that will be displayed on the dialog.", ""); |
d0e2ede0 | 183 | |
fcafa8a9 RD |
184 | DocDeclStr( |
185 | void , SetPath(const wxString& path), | |
d07d2bc9 | 186 | "Sets the default path.", ""); |
d0e2ede0 | 187 | |
0eae5d09 RD |
188 | %property(Message, GetMessage, SetMessage, doc="See `GetMessage` and `SetMessage`"); |
189 | %property(Path, GetPath, SetPath, doc="See `GetPath` and `SetPath`"); | |
7bf85405 RD |
190 | }; |
191 | ||
68320e40 | 192 | |
d14a1e28 | 193 | //--------------------------------------------------------------------------- |
7bf85405 | 194 | |
16182b7b RD |
195 | %{ |
196 | // for compatibility only | |
197 | #define wxHIDE_READONLY 0 | |
198 | %} | |
199 | ||
d0e2ede0 | 200 | enum { |
d0e2ede0 RD |
201 | wxFD_OPEN, |
202 | wxFD_SAVE, | |
203 | wxFD_OVERWRITE_PROMPT, | |
204 | wxFD_FILE_MUST_EXIST, | |
205 | wxFD_MULTIPLE, | |
206 | wxFD_CHANGE_DIR, | |
6aaca5ba | 207 | wxFD_PREVIEW, |
d0e2ede0 RD |
208 | wxFD_DEFAULT_STYLE, |
209 | }; | |
210 | ||
cbfc9df6 RD |
211 | %pythoncode { |
212 | %# deprecated names | |
213 | OPEN = FD_OPEN, | |
214 | SAVE = FD_SAVE, | |
215 | OVERWRITE_PROMPT = FD_OVERWRITE_PROMPT, | |
216 | FILE_MUST_EXIST = FD_FILE_MUST_EXIST, | |
217 | MULTIPLE = FD_MULTIPLE, | |
218 | CHANGE_DIR = FD_CHANGE_DIR | |
219 | } | |
220 | ||
221 | ||
fcafa8a9 | 222 | DocStr(wxFileDialog, |
dce2bd22 | 223 | "wx.FileDialog allows the user to select one or more files from the |
d07d2bc9 | 224 | filesystem.", " |
dce2bd22 RD |
225 | |
226 | In Windows, this is the common file selector dialog. On X based | |
227 | platforms a generic alternative is used. The path and filename are | |
228 | distinct elements of a full file pathname. If path is \"\", the | |
229 | current directory will be used. If filename is \"\", no default | |
230 | filename will be supplied. The wildcard determines what files are | |
231 | displayed in the file selector, and file extension supplies a type | |
232 | extension for the required filename. | |
233 | ||
234 | Both the X and Windows versions implement a wildcard filter. Typing a | |
d07d2bc9 | 235 | filename containing wildcards (\*, ?) in the filename text item, and |
dce2bd22 RD |
236 | clicking on Ok, will result in only those files matching the pattern |
237 | being displayed. The wildcard may be a specification for multiple | |
238 | types of file with a description for each, such as:: | |
fcafa8a9 RD |
239 | |
240 | \"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif\" | |
241 | ||
dce2bd22 RD |
242 | |
243 | Window Styles | |
244 | -------------- | |
d0e2ede0 RD |
245 | ====================== ========================================== |
246 | wx.FD_OPEN This is an open dialog. | |
fcafa8a9 | 247 | |
d0e2ede0 | 248 | wx.FD_SAVE This is a save dialog. |
fcafa8a9 | 249 | |
d0e2ede0 RD |
250 | wx.FD_OVERWRITE_PROMPT For save dialog only: prompt for a confirmation |
251 | if a file will be overwritten. | |
fcafa8a9 | 252 | |
d0e2ede0 RD |
253 | wx.FD_MULTIPLE For open dialog only: allows selecting multiple |
254 | files. | |
fcafa8a9 | 255 | |
d0e2ede0 RD |
256 | wx.FD_CHANGE_DIR Change the current working directory to the |
257 | directory where the file(s) chosen by the user | |
258 | are. | |
259 | ====================== ========================================== | |
fcafa8a9 RD |
260 | "); |
261 | ||
262 | ||
263 | ||
ab1f7d2a RD |
264 | MustHaveApp(wxFileDialog); |
265 | ||
7bf85405 RD |
266 | class wxFileDialog : public wxDialog { |
267 | public: | |
2b9048c5 | 268 | %pythonAppend wxFileDialog "self._setOORInfo(self)" |
fcafa8a9 RD |
269 | |
270 | DocCtorStr( | |
271 | wxFileDialog(wxWindow* parent, | |
272 | const wxString& message = wxPyFileSelectorPromptStr, | |
273 | const wxString& defaultDir = wxPyEmptyString, | |
274 | const wxString& defaultFile = wxPyEmptyString, | |
275 | const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr, | |
d0e2ede0 | 276 | long style = wxFD_DEFAULT_STYLE, |
fcafa8a9 | 277 | const wxPoint& pos = wxDefaultPosition), |
d07d2bc9 | 278 | "Constructor. Use ShowModal method to show the dialog.", ""); |
fcafa8a9 RD |
279 | |
280 | ||
281 | DocDeclStr( | |
282 | void , SetMessage(const wxString& message), | |
d07d2bc9 | 283 | "Sets the message that will be displayed on the dialog.", ""); |
d0e2ede0 | 284 | |
fcafa8a9 RD |
285 | DocDeclStr( |
286 | void , SetPath(const wxString& path), | |
dce2bd22 | 287 | "Sets the path (the combined directory and filename that will be |
d07d2bc9 | 288 | returned when the dialog is dismissed).", ""); |
d0e2ede0 | 289 | |
fcafa8a9 RD |
290 | DocDeclStr( |
291 | void , SetDirectory(const wxString& dir), | |
d07d2bc9 | 292 | "Sets the default directory.", ""); |
d0e2ede0 | 293 | |
fcafa8a9 RD |
294 | DocDeclStr( |
295 | void , SetFilename(const wxString& name), | |
d07d2bc9 | 296 | "Sets the default filename.", ""); |
d0e2ede0 | 297 | |
fcafa8a9 RD |
298 | DocDeclStr( |
299 | void , SetWildcard(const wxString& wildCard), | |
dce2bd22 RD |
300 | "Sets the wildcard, which can contain multiple file types, for |
301 | example:: | |
302 | ||
303 | \"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif\" | |
d07d2bc9 | 304 | ", ""); |
d0e2ede0 | 305 | |
fcafa8a9 RD |
306 | DocDeclStr( |
307 | void , SetFilterIndex(int filterIndex), | |
d07d2bc9 | 308 | "Sets the default filter index, starting from zero.", ""); |
d0e2ede0 | 309 | |
fcafa8a9 RD |
310 | DocDeclStr( |
311 | wxString , GetMessage() const, | |
d07d2bc9 | 312 | "Returns the message that will be displayed on the dialog.", ""); |
d0e2ede0 | 313 | |
fcafa8a9 RD |
314 | DocDeclStr( |
315 | wxString , GetPath() const, | |
d07d2bc9 | 316 | "Returns the full path (directory and filename) of the selected file.", ""); |
d0e2ede0 | 317 | |
fcafa8a9 RD |
318 | DocDeclStr( |
319 | wxString , GetDirectory() const, | |
d07d2bc9 | 320 | "Returns the default directory.", ""); |
d0e2ede0 | 321 | |
fcafa8a9 RD |
322 | DocDeclStr( |
323 | wxString , GetFilename() const, | |
d07d2bc9 | 324 | "Returns the default filename.", ""); |
d0e2ede0 | 325 | |
fcafa8a9 RD |
326 | DocDeclStr( |
327 | wxString , GetWildcard() const, | |
d07d2bc9 | 328 | "Returns the file dialog wildcard.", ""); |
d0e2ede0 | 329 | |
fcafa8a9 RD |
330 | DocDeclStr( |
331 | int , GetFilterIndex() const, | |
dce2bd22 RD |
332 | "Returns the index into the list of filters supplied, optionally, in |
333 | the wildcard parameter. Before the dialog is shown, this is the index | |
334 | which will be used when the dialog is first displayed. After the | |
d07d2bc9 | 335 | dialog is shown, this is the index selected by the user.", ""); |
f6bcfd97 | 336 | |
fcafa8a9 | 337 | |
214c4fbe RD |
338 | %extend { |
339 | DocStr(GetFilenames, | |
340 | "Returns a list of filenames chosen in the dialog. This function | |
dce2bd22 | 341 | should only be used with the dialogs which have wx.MULTIPLE style, use |
d07d2bc9 | 342 | GetFilename for the others.", ""); |
f6bcfd97 BP |
343 | PyObject* GetFilenames() { |
344 | wxArrayString arr; | |
345 | self->GetFilenames(arr); | |
b37c7e1d | 346 | return wxArrayString2PyList_helper(arr); |
f6bcfd97 BP |
347 | } |
348 | ||
214c4fbe RD |
349 | DocStr(GetPaths, |
350 | "Fills the array paths with the full paths of the files chosen. This | |
351 | function should only be used with the dialogs which have wx.MULTIPLE | |
d0e2ede0 RD |
352 | style, use GetPath for the others.", ""); |
353 | ||
f6bcfd97 BP |
354 | PyObject* GetPaths() { |
355 | wxArrayString arr; | |
356 | self->GetPaths(arr); | |
b37c7e1d | 357 | return wxArrayString2PyList_helper(arr); |
f6bcfd97 BP |
358 | } |
359 | } | |
3ef86e32 RD |
360 | |
361 | // TODO | |
362 | // // Utility functions | |
363 | ||
364 | // // Parses the wildCard, returning the number of filters. | |
365 | // // Returns 0 if none or if there's a problem, | |
366 | // // The arrays will contain an equal number of items found before the error. | |
367 | // // wildCard is in the form: | |
368 | // // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" | |
369 | // static int ParseWildcard(const wxString& wildCard, | |
370 | // wxArrayString& descriptions, | |
371 | // wxArrayString& filters); | |
372 | ||
373 | // // Append first extension to filePath from a ';' separated extensionList | |
374 | // // if filePath = "path/foo.bar" just return it as is | |
375 | // // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg" | |
376 | // // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath | |
377 | // static wxString AppendExtension(const wxString &filePath, | |
378 | // const wxString &extensionList); | |
379 | ||
380 | ||
42e2bbb9 RD |
381 | %property(Directory, GetDirectory, SetDirectory, doc="See `GetDirectory` and `SetDirectory`"); |
382 | %property(Filename, GetFilename, SetFilename, doc="See `GetFilename` and `SetFilename`"); | |
383 | %property(Filenames, GetFilenames, doc="See `GetFilenames`"); | |
384 | %property(FilterIndex, GetFilterIndex, SetFilterIndex, doc="See `GetFilterIndex` and `SetFilterIndex`"); | |
385 | %property(Message, GetMessage, SetMessage, doc="See `GetMessage` and `SetMessage`"); | |
386 | %property(Path, GetPath, SetPath, doc="See `GetPath` and `SetPath`"); | |
387 | %property(Paths, GetPaths, doc="See `GetPaths`"); | |
388 | %property(Wildcard, GetWildcard, SetWildcard, doc="See `GetWildcard` and `SetWildcard`"); | |
389 | ||
7bf85405 RD |
390 | }; |
391 | ||
392 | ||
d14a1e28 | 393 | //--------------------------------------------------------------------------- |
7bf85405 | 394 | |
293a0a86 RD |
395 | enum { wxCHOICEDLG_STYLE }; |
396 | ||
e5868095 RD |
397 | |
398 | DocStr(wxMultiChoiceDialog, | |
d07d2bc9 | 399 | "A simple dialog with a multi selection listbox.", ""); |
e5868095 | 400 | |
ab1f7d2a RD |
401 | MustHaveApp(wxMultiChoiceDialog); |
402 | ||
293a0a86 RD |
403 | class wxMultiChoiceDialog : public wxDialog |
404 | { | |
405 | public: | |
2b9048c5 | 406 | %pythonAppend wxMultiChoiceDialog "self._setOORInfo(self)" |
293a0a86 | 407 | |
e5868095 RD |
408 | DocCtorAStr( |
409 | wxMultiChoiceDialog(wxWindow *parent, | |
410 | const wxString& message, | |
411 | const wxString& caption, | |
d5573410 | 412 | int choices=0, wxString* choices_array=NULL, |
e5868095 RD |
413 | long style = wxCHOICEDLG_STYLE, |
414 | const wxPoint& pos = wxDefaultPosition), | |
870b7ef0 | 415 | "__init__(self, Window parent, String message, String caption, |
40a0d6ca | 416 | List choices=EmptyList, long style=CHOICEDLG_STYLE, |
dce2bd22 | 417 | Point pos=DefaultPosition) -> MultiChoiceDialog", |
870b7ef0 RD |
418 | "Constructor. Use the `ShowModal` method to show the dialog. |
419 | ||
420 | :param parent: The parent window. | |
421 | :param message: Text to display above the list of selections. | |
422 | :param caption: Text to use in the title bar of the dialog. | |
423 | :param choices: A list of strings or unicode objects that the | |
424 | user is allowed to choose from. | |
425 | :param style: Styles to apply to the dialog. The default value is | |
426 | equivallent to wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.OK|wx.CANCEL|wx.CENTER. | |
427 | :param pos: Where to position the dialog (not used on Windows) | |
428 | ||
429 | ", ""); | |
e5868095 | 430 | |
d0e2ede0 | 431 | |
e5868095 RD |
432 | DocDeclAStr( |
433 | void, SetSelections(const wxArrayInt& selections), | |
434 | "SetSelections(List selections)", | |
dce2bd22 | 435 | "Specify the items in the list that should be selected, using a list of |
870b7ef0 RD |
436 | integers. The list should specify the indexes of the items that |
437 | should be selected.", ""); | |
293a0a86 | 438 | |
e5868095 RD |
439 | DocAStr(GetSelections, |
440 | "GetSelections() -> [selections]", | |
870b7ef0 RD |
441 | "Returns a list of integers representing the items that are selected. |
442 | If an item is selected then its index will appear in the list.", ""); | |
d14a1e28 | 443 | %extend { |
293a0a86 RD |
444 | PyObject* GetSelections() { |
445 | return wxArrayInt2PyList_helper(self->GetSelections()); | |
446 | } | |
447 | } | |
203bfdca RD |
448 | |
449 | %property(Selections, GetSelections, SetSelections, doc="See `GetSelections` and `SetSelections`"); | |
293a0a86 RD |
450 | }; |
451 | ||
7bf85405 | 452 | |
d14a1e28 | 453 | //--------------------------------------------------------------------------- |
7bf85405 | 454 | |
e5868095 | 455 | DocStr(wxSingleChoiceDialog, |
d07d2bc9 | 456 | "A simple dialog with a single selection listbox.", ""); |
e5868095 | 457 | |
ab1f7d2a RD |
458 | MustHaveApp(wxSingleChoiceDialog); |
459 | ||
7bf85405 RD |
460 | class wxSingleChoiceDialog : public wxDialog { |
461 | public: | |
2b9048c5 | 462 | %pythonAppend wxSingleChoiceDialog "self._setOORInfo(self)" |
e5868095 RD |
463 | |
464 | DocAStr(wxSingleChoiceDialog, | |
dce2bd22 | 465 | "__init__(Window parent, String message, String caption, |
40a0d6ca | 466 | List choices=EmptyList, long style=CHOICEDLG_STYLE, |
dce2bd22 | 467 | Point pos=DefaultPosition) -> SingleChoiceDialog", |
d07d2bc9 | 468 | "Constructor. Use ShowModal method to show the dialog.", ""); |
e5868095 | 469 | |
d14a1e28 RD |
470 | %extend { |
471 | // TODO: ignoring clientData for now... FIX THIS | |
7bf85405 RD |
472 | // SWIG is messing up the &/*'s for some reason. |
473 | wxSingleChoiceDialog(wxWindow* parent, | |
d14a1e28 RD |
474 | const wxString& message, |
475 | const wxString& caption, | |
476 | int choices, wxString* choices_array, | |
7bf85405 | 477 | //char** clientData = NULL, |
293a0a86 | 478 | long style = wxCHOICEDLG_STYLE, |
d14a1e28 RD |
479 | const wxPoint& pos = wxDefaultPosition) { |
480 | return new wxSingleChoiceDialog(parent, message, caption, | |
481 | choices, choices_array, NULL, style, pos); | |
7bf85405 | 482 | } |
09f3d4e6 | 483 | } |
9c039d08 | 484 | |
e5868095 RD |
485 | DocDeclStr( |
486 | int , GetSelection(), | |
6aaca5ba | 487 | "Get the index of the currently selected item.", ""); |
d0e2ede0 | 488 | |
e5868095 RD |
489 | DocDeclStr( |
490 | wxString , GetStringSelection(), | |
d07d2bc9 | 491 | "Returns the string value of the currently selected item", ""); |
d0e2ede0 | 492 | |
e5868095 RD |
493 | DocDeclStr( |
494 | void , SetSelection(int sel), | |
d07d2bc9 | 495 | "Set the current selected item to sel", ""); |
7012bb9f RD |
496 | |
497 | %property(Selection, GetSelection, SetSelection, doc="See `GetSelection` and `SetSelection`"); | |
498 | %property(StringSelection, GetStringSelection, doc="See `GetStringSelection`"); | |
7bf85405 RD |
499 | }; |
500 | ||
501 | ||
d14a1e28 | 502 | //--------------------------------------------------------------------------- |
7bf85405 | 503 | |
e5868095 | 504 | DocStr(wxTextEntryDialog, |
d07d2bc9 | 505 | "A dialog with text control, [ok] and [cancel] buttons", ""); |
e5868095 | 506 | |
ab1f7d2a RD |
507 | MustHaveApp(wxTextEntryDialog); |
508 | ||
f63a6e0c RD |
509 | enum { wxTextEntryDialogStyle }; |
510 | ||
7bf85405 RD |
511 | class wxTextEntryDialog : public wxDialog { |
512 | public: | |
2b9048c5 | 513 | %pythonAppend wxTextEntryDialog "self._setOORInfo(self)" |
7bf85405 | 514 | |
e5868095 RD |
515 | DocCtorStr( |
516 | wxTextEntryDialog(wxWindow* parent, | |
517 | const wxString& message, | |
518 | const wxString& caption = wxPyGetTextFromUserPromptStr, | |
519 | const wxString& defaultValue = wxPyEmptyString, | |
7aada1e0 | 520 | long style = wxTextEntryDialogStyle, |
e5868095 | 521 | const wxPoint& pos = wxDefaultPosition), |
d07d2bc9 | 522 | "Constructor. Use ShowModal method to show the dialog.", ""); |
e5868095 RD |
523 | |
524 | DocDeclStr( | |
525 | wxString , GetValue(), | |
dce2bd22 | 526 | "Returns the text that the user has entered if the user has pressed OK, |
d07d2bc9 | 527 | or the original value if the user has pressed Cancel.", ""); |
d0e2ede0 | 528 | |
e5868095 RD |
529 | DocDeclStr( |
530 | void , SetValue(const wxString& value), | |
d07d2bc9 | 531 | "Sets the default text value.", ""); |
994453b8 RD |
532 | |
533 | %property(Value, GetValue, SetValue, doc="See `GetValue` and `SetValue`"); | |
7bf85405 RD |
534 | }; |
535 | ||
d14a1e28 | 536 | //--------------------------------------------------------------------------- |
7bf85405 | 537 | |
7aada1e0 RD |
538 | MAKE_CONST_WXSTRING(GetPasswordFromUserPromptStr); |
539 | ||
540 | class wxPasswordEntryDialog : public wxTextEntryDialog | |
541 | { | |
542 | public: | |
543 | wxPasswordEntryDialog(wxWindow *parent, | |
544 | const wxString& message, | |
545 | const wxString& caption = wxPyGetPasswordFromUserPromptStr, | |
546 | const wxString& value = wxPyEmptyString, | |
547 | long style = wxTextEntryDialogStyle, | |
548 | const wxPoint& pos = wxDefaultPosition); | |
549 | }; | |
550 | ||
551 | //--------------------------------------------------------------------------- | |
552 | ||
9165401f RD |
553 | DocStr( wxNumberEntryDialog, |
554 | "A dialog with spin control, ok and cancel buttons.", "") | |
555 | ||
556 | MustHaveApp(wxNumberEntryDialog); | |
557 | ||
558 | class wxNumberEntryDialog : public wxDialog | |
559 | { | |
560 | public: | |
561 | %pythonAppend wxNumberEntryDialog "self._setOORInfo(self)" | |
562 | ||
563 | DocCtorStr( | |
564 | wxNumberEntryDialog(wxWindow *parent, | |
565 | const wxString& message, | |
566 | const wxString& prompt, | |
567 | const wxString& caption, | |
568 | long value, long min, long max, | |
569 | const wxPoint& pos = wxDefaultPosition), | |
570 | "Constructor. Use ShowModal method to show the dialog.", ""); | |
571 | ||
572 | long GetValue(); | |
203bfdca RD |
573 | |
574 | %property(Value, GetValue, doc="See `GetValue`"); | |
575 | ||
9165401f RD |
576 | }; |
577 | ||
578 | //--------------------------------------------------------------------------- | |
579 | ||
e5868095 RD |
580 | |
581 | DocStr(wxFontData, | |
dce2bd22 | 582 | "This class holds a variety of information related to font dialogs and |
d07d2bc9 | 583 | is used to transfer settings to and results from a `wx.FontDialog`.", ""); |
e5868095 RD |
584 | |
585 | ||
9416aa89 | 586 | class wxFontData : public wxObject { |
7bf85405 RD |
587 | public: |
588 | wxFontData(); | |
589 | ~wxFontData(); | |
590 | ||
e5868095 RD |
591 | DocDeclStr( |
592 | void , EnableEffects(bool enable), | |
dce2bd22 RD |
593 | "Enables or disables 'effects' under MS Windows only. This refers to |
594 | the controls for manipulating colour, strikeout and underline | |
d07d2bc9 | 595 | properties. The default value is true.", ""); |
d0e2ede0 | 596 | |
e5868095 RD |
597 | DocDeclStr( |
598 | bool , GetAllowSymbols(), | |
dce2bd22 RD |
599 | "Under MS Windows, returns a flag determining whether symbol fonts can |
600 | be selected. Has no effect on other platforms. The default value is | |
d07d2bc9 | 601 | true.", ""); |
d0e2ede0 | 602 | |
e5868095 RD |
603 | DocDeclStr( |
604 | wxColour , GetColour(), | |
dce2bd22 | 605 | "Gets the colour associated with the font dialog. The default value is |
d07d2bc9 | 606 | black.", ""); |
d0e2ede0 | 607 | |
e5868095 RD |
608 | DocDeclStr( |
609 | wxFont , GetChosenFont(), | |
d07d2bc9 | 610 | "Gets the font chosen by the user.", ""); |
d0e2ede0 | 611 | |
e5868095 RD |
612 | DocDeclStr( |
613 | bool , GetEnableEffects(), | |
d07d2bc9 | 614 | "Determines whether 'effects' are enabled under Windows.", ""); |
d0e2ede0 | 615 | |
e5868095 RD |
616 | DocDeclStr( |
617 | wxFont , GetInitialFont(), | |
dce2bd22 | 618 | "Gets the font that will be initially used by the font dialog. This |
d07d2bc9 | 619 | should have previously been set by the application.", ""); |
d0e2ede0 | 620 | |
e5868095 RD |
621 | DocDeclStr( |
622 | bool , GetShowHelp(), | |
dce2bd22 | 623 | "Returns true if the Help button will be shown (Windows only). The |
d07d2bc9 | 624 | default value is false.", ""); |
d0e2ede0 | 625 | |
e5868095 RD |
626 | DocDeclStr( |
627 | void , SetAllowSymbols(bool allowSymbols), | |
dce2bd22 | 628 | "Under MS Windows, determines whether symbol fonts can be selected. Has |
d07d2bc9 | 629 | no effect on other platforms. The default value is true.", ""); |
d0e2ede0 | 630 | |
e5868095 RD |
631 | DocDeclStr( |
632 | void , SetChosenFont(const wxFont& font), | |
dce2bd22 | 633 | "Sets the font that will be returned to the user (normally for internal |
d07d2bc9 | 634 | use only).", ""); |
d0e2ede0 | 635 | |
e5868095 RD |
636 | DocDeclStr( |
637 | void , SetColour(const wxColour& colour), | |
dce2bd22 | 638 | "Sets the colour that will be used for the font foreground colour. The |
d07d2bc9 | 639 | default colour is black.", ""); |
d0e2ede0 | 640 | |
e5868095 RD |
641 | DocDeclStr( |
642 | void , SetInitialFont(const wxFont& font), | |
d07d2bc9 | 643 | "Sets the font that will be initially used by the font dialog.", ""); |
d0e2ede0 | 644 | |
e5868095 RD |
645 | DocDeclStr( |
646 | void , SetRange(int min, int max), | |
dce2bd22 | 647 | "Sets the valid range for the font point size (Windows only). The |
d07d2bc9 | 648 | default is 0, 0 (unrestricted range).", ""); |
d0e2ede0 | 649 | |
e5868095 RD |
650 | DocDeclStr( |
651 | void , SetShowHelp(bool showHelp), | |
dce2bd22 | 652 | "Determines whether the Help button will be displayed in the font |
d07d2bc9 | 653 | dialog (Windows only). The default value is false.", ""); |
42e2bbb9 RD |
654 | |
655 | %property(AllowSymbols, GetAllowSymbols, SetAllowSymbols, doc="See `GetAllowSymbols` and `SetAllowSymbols`"); | |
656 | %property(ChosenFont, GetChosenFont, SetChosenFont, doc="See `GetChosenFont` and `SetChosenFont`"); | |
657 | %property(Colour, GetColour, SetColour, doc="See `GetColour` and `SetColour`"); | |
d1cf7e2a | 658 | // %property(EnableEffects, GetEnableEffects, doc="See `GetEnableEffects`"); |
42e2bbb9 RD |
659 | %property(InitialFont, GetInitialFont, SetInitialFont, doc="See `GetInitialFont` and `SetInitialFont`"); |
660 | %property(ShowHelp, GetShowHelp, SetShowHelp, doc="See `GetShowHelp` and `SetShowHelp`"); | |
661 | ||
7bf85405 RD |
662 | }; |
663 | ||
664 | ||
e5868095 RD |
665 | |
666 | ||
667 | DocStr(wxFontDialog, | |
dce2bd22 RD |
668 | "wx.FontDialog allows the user to select a system font and its attributes. |
669 | ||
670 | :see: `wx.FontData` | |
d07d2bc9 | 671 | ", ""); |
e5868095 | 672 | |
ab1f7d2a RD |
673 | MustHaveApp(wxFontDialog); |
674 | ||
7bf85405 RD |
675 | class wxFontDialog : public wxDialog { |
676 | public: | |
2b9048c5 | 677 | %pythonAppend wxFontDialog "self._setOORInfo(self)" |
e5868095 RD |
678 | |
679 | DocStr(wxFontDialog, | |
dce2bd22 RD |
680 | "Constructor. Pass a parent window and the `wx.FontData` object to be |
681 | used to initialize the dialog controls. Call `ShowModal` to display | |
682 | the dialog. If ShowModal returns ``wx.ID_OK`` then you can fetch the | |
d07d2bc9 | 683 | results with via the `wx.FontData` returned by `GetFontData`.", ""); |
557a93b9 | 684 | wxFontDialog(wxWindow* parent, const wxFontData& data); |
7bf85405 | 685 | |
d0e2ede0 | 686 | |
e5868095 RD |
687 | DocDeclStr( |
688 | wxFontData& , GetFontData(), | |
dce2bd22 | 689 | "Returns a reference to the internal `wx.FontData` used by the |
d0e2ede0 | 690 | wx.FontDialog.", ""); |
42e2bbb9 RD |
691 | |
692 | %property(FontData, GetFontData, doc="See `GetFontData`"); | |
7bf85405 RD |
693 | }; |
694 | ||
695 | ||
1979aa58 RD |
696 | wxFont wxGetFontFromUser(wxWindow *parent = NULL, |
697 | const wxFont& fontInit = wxNullFont, | |
698 | const wxString& caption = wxPyEmptyString); | |
699 | ||
700 | ||
d14a1e28 | 701 | //--------------------------------------------------------------------------- |
7bf85405 | 702 | |
e5868095 RD |
703 | |
704 | DocStr(wxMessageDialog, | |
dce2bd22 | 705 | "This class provides a simple dialog that shows a single or multi-line |
d07d2bc9 | 706 | message, with a choice of OK, Yes, No and/or Cancel buttons.", " |
dce2bd22 RD |
707 | |
708 | Window Styles | |
709 | -------------- | |
d07d2bc9 RD |
710 | =================== ============================================= |
711 | wx.OK Show an OK button. | |
712 | wx.CANCEL Show a Cancel button. | |
713 | wx.YES_NO Show Yes and No buttons. | |
714 | wx.YES_DEFAULT Used with wxYES_NO, makes Yes button the | |
715 | default - which is the default behaviour. | |
716 | wx.NO_DEFAULT Used with wxYES_NO, makes No button the default. | |
717 | wx.ICON_EXCLAMATION Shows an exclamation mark icon. | |
718 | wx.ICON_HAND Shows an error icon. | |
719 | wx.ICON_ERROR Shows an error icon - the same as wxICON_HAND. | |
720 | wx.ICON_QUESTION Shows a question mark icon. | |
721 | wx.ICON_INFORMATION Shows an information (i) icon. | |
722 | wx.STAY_ON_TOP The message box stays on top of all other | |
723 | window, even those of the other applications | |
724 | (Windows only). | |
725 | =================== ============================================= | |
e5868095 RD |
726 | "); |
727 | ||
728 | ||
ab1f7d2a RD |
729 | MustHaveApp(wxMessageDialog); |
730 | ||
7bf85405 RD |
731 | class wxMessageDialog : public wxDialog { |
732 | public: | |
2b9048c5 | 733 | %pythonAppend wxMessageDialog "self._setOORInfo(self)" |
d0e2ede0 | 734 | |
dce2bd22 RD |
735 | DocCtorStr( |
736 | wxMessageDialog(wxWindow* parent, | |
737 | const wxString& message, | |
738 | const wxString& caption = wxPyMessageBoxCaptionStr, | |
739 | long style = wxOK | wxCANCEL | wxCENTRE, | |
740 | const wxPoint& pos = wxDefaultPosition), | |
d07d2bc9 | 741 | "Constructor, use `ShowModal` to display the dialog.", ""); |
7bf85405 | 742 | |
7bf85405 RD |
743 | }; |
744 | ||
d14a1e28 | 745 | //--------------------------------------------------------------------------- |
7bf85405 | 746 | |
e81851eb RD |
747 | enum { |
748 | wxPD_AUTO_HIDE, | |
749 | wxPD_APP_MODAL, | |
750 | wxPD_CAN_ABORT, | |
751 | wxPD_ELAPSED_TIME, | |
752 | wxPD_ESTIMATED_TIME, | |
753 | wxPD_REMAINING_TIME, | |
754 | wxPD_SMOOTH, | |
755 | wxPD_CAN_SKIP | |
756 | }; | |
757 | ||
e5868095 RD |
758 | |
759 | DocStr(wxProgressDialog, | |
dce2bd22 | 760 | "A dialog that shows a short message and a progress bar. Optionally, it |
d07d2bc9 | 761 | can display an ABORT button.", " |
dce2bd22 RD |
762 | |
763 | Window Styles | |
764 | -------------- | |
d07d2bc9 RD |
765 | ==================== ============================================= |
766 | wx.PD_APP_MODAL Make the progress dialog modal. If this flag is | |
767 | not given, it is only \"locally\" modal - | |
768 | that is the input to the parent window is | |
769 | disabled, but not to the other ones. | |
770 | ||
771 | wx.PD_AUTO_HIDE Causes the progress dialog to disappear from | |
772 | screen as soon as the maximum value of the | |
773 | progress meter has been reached. | |
774 | ||
775 | wx.PD_CAN_ABORT This flag tells the dialog that it should have | |
776 | a \"Cancel\" button which the user may press. If | |
777 | this happens, the next call to Update() will | |
4ba3af91 RD |
778 | return False in the first component of its return |
779 | value. | |
780 | ||
781 | wx.PD_CAN_SKIP This flag tells the dialog that it should have a | |
782 | \"Skip\" button which the user may press. If this | |
783 | happens, the next call to Update() will return | |
784 | True in the second component of its return value. | |
d07d2bc9 RD |
785 | |
786 | wx.PD_ELAPSED_TIME This flag tells the dialog that it should show | |
787 | elapsed time (since creating the dialog). | |
788 | ||
789 | wx.PD_ESTIMATED_TIME This flag tells the dialog that it should show | |
790 | estimated time. | |
791 | ||
792 | wx.PD_REMAINING_TIME This flag tells the dialog that it should show | |
793 | remaining time. | |
191dea6d RD |
794 | |
795 | wx.PD_SMOOTH Uses the wx.GA_SMOOTH style on the embedded | |
796 | wx.Gauge widget. | |
d07d2bc9 | 797 | ==================== ============================================= |
e5868095 RD |
798 | "); |
799 | ||
800 | ||
191dea6d RD |
801 | // TODO: wxPD_CAN_SKIP |
802 | ||
ab1f7d2a RD |
803 | MustHaveApp(wxProgressDialog); |
804 | ||
bb0054cd RD |
805 | class wxProgressDialog : public wxFrame { |
806 | public: | |
2b9048c5 | 807 | %pythonAppend wxProgressDialog "self._setOORInfo(self)" |
7bf85405 | 808 | |
e5868095 RD |
809 | DocCtorStr( |
810 | wxProgressDialog(const wxString& title, | |
811 | const wxString& message, | |
812 | int maximum = 100, | |
813 | wxWindow* parent = NULL, | |
814 | int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL ), | |
dce2bd22 RD |
815 | "Constructor. Creates the dialog, displays it and disables user input |
816 | for other windows, or, if wx.PD_APP_MODAL flag is not given, for its | |
d07d2bc9 | 817 | parent window only.", ""); |
e5868095 | 818 | |
191dea6d RD |
819 | // TODO: support getting the skipped value back in the return value, but |
820 | // only if style is set. This is so the API doesn't change for existing | |
821 | // users... | |
4ba3af91 | 822 | DocDeclAStr( |
e81851eb RD |
823 | virtual bool , Update(int value, |
824 | const wxString& newmsg = wxPyEmptyString, | |
4ba3af91 RD |
825 | bool *OUTPUT), |
826 | "Update(self, int value, String newmsg) --> (continue, skip)", | |
dce2bd22 | 827 | "Updates the dialog, setting the progress bar to the new value and, if |
e4836488 RD |
828 | given changes the message above it. The value given should be less |
829 | than or equal to the maximum value given to the constructor and the | |
4ba3af91 RD |
830 | dialog is closed if it is equal to the maximum. Returns a tuple of |
831 | boolean values, ``(continue, skip)`` where ``continue`` is ``True`` | |
832 | unless the Cancel button has been pressed, and ``skip`` is ``False`` | |
833 | unless the Skip button (if any) has been pressed. | |
834 | ||
dba7934c | 835 | If the ``continue`` return value is ``False``, the application can either |
4ba3af91 RD |
836 | immediately destroy the dialog or ask the user for confirmation, and if the |
837 | abort is not confirmed the dialog may be resumed with `Resume` function. | |
838 | ", ""); | |
d0e2ede0 | 839 | |
e81851eb RD |
840 | |
841 | DocDeclAStr( | |
175f93c3 | 842 | virtual bool , Pulse(const wxString& newmsg = wxPyEmptyString, |
e81851eb | 843 | bool *OUTPUT), |
175f93c3 | 844 | "Pulse(self, String newmsg) --> (continue, skip)", |
e81851eb RD |
845 | "Just like `Update` but switches the dialog to use a gauge in |
846 | interminante mode and calls `wx.Gauge.Pulse` to show the user a bit of | |
847 | progress.", ""); | |
175f93c3 | 848 | %pythoncode { UpdatePulse = Pulse } |
e81851eb | 849 | |
e5868095 RD |
850 | DocDeclStr( |
851 | void , Resume(), | |
dce2bd22 | 852 | "Can be used to continue with the dialog, after the user had chosen to |
d07d2bc9 | 853 | abort.", ""); |
d0e2ede0 | 854 | |
d14a1e28 | 855 | }; |
bb0054cd | 856 | |
d14a1e28 | 857 | //--------------------------------------------------------------------------- |
0122b7e3 RD |
858 | |
859 | enum wxFindReplaceFlags | |
860 | { | |
861 | // downward search/replace selected (otherwise - upwards) | |
862 | wxFR_DOWN = 1, | |
863 | ||
864 | // whole word search/replace selected | |
865 | wxFR_WHOLEWORD = 2, | |
866 | ||
867 | // case sensitive search/replace selected (otherwise - case insensitive) | |
868 | wxFR_MATCHCASE = 4 | |
869 | }; | |
870 | ||
871 | ||
872 | enum wxFindReplaceDialogStyles | |
873 | { | |
874 | // replace dialog (otherwise find dialog) | |
875 | wxFR_REPLACEDIALOG = 1, | |
876 | ||
877 | // don't allow changing the search direction | |
878 | wxFR_NOUPDOWN = 2, | |
879 | ||
880 | // don't allow case sensitive searching | |
881 | wxFR_NOMATCHCASE = 4, | |
882 | ||
883 | // don't allow whole word searching | |
884 | wxFR_NOWHOLEWORD = 8 | |
885 | }; | |
886 | ||
0122b7e3 | 887 | |
0122b7e3 | 888 | |
d14a1e28 RD |
889 | %constant wxEventType wxEVT_COMMAND_FIND; |
890 | %constant wxEventType wxEVT_COMMAND_FIND_NEXT; | |
891 | %constant wxEventType wxEVT_COMMAND_FIND_REPLACE; | |
892 | %constant wxEventType wxEVT_COMMAND_FIND_REPLACE_ALL; | |
893 | %constant wxEventType wxEVT_COMMAND_FIND_CLOSE; | |
0122b7e3 | 894 | |
0122b7e3 | 895 | |
d14a1e28 RD |
896 | %pythoncode { |
897 | EVT_FIND = wx.PyEventBinder( wxEVT_COMMAND_FIND, 1 ) | |
898 | EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_COMMAND_FIND_NEXT, 1 ) | |
899 | EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE, 1 ) | |
900 | EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE_ALL, 1 ) | |
901 | EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_FIND_CLOSE, 1 ) | |
0122b7e3 | 902 | |
d14a1e28 | 903 | %# For backwards compatibility. Should they be removed? |
d0e2ede0 | 904 | EVT_COMMAND_FIND = EVT_FIND |
d14a1e28 RD |
905 | EVT_COMMAND_FIND_NEXT = EVT_FIND_NEXT |
906 | EVT_COMMAND_FIND_REPLACE = EVT_FIND_REPLACE | |
907 | EVT_COMMAND_FIND_REPLACE_ALL = EVT_FIND_REPLACE_ALL | |
d0e2ede0 | 908 | EVT_COMMAND_FIND_CLOSE = EVT_FIND_CLOSE |
d14a1e28 | 909 | } |
0122b7e3 | 910 | |
0122b7e3 | 911 | |
e5868095 | 912 | DocStr(wxFindDialogEvent, |
d07d2bc9 | 913 | "Events for the FindReplaceDialog", ""); |
e5868095 | 914 | |
0122b7e3 RD |
915 | class wxFindDialogEvent : public wxCommandEvent |
916 | { | |
917 | public: | |
918 | wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0); | |
d0e2ede0 | 919 | |
e5868095 RD |
920 | DocDeclStr( |
921 | int , GetFlags(), | |
dce2bd22 | 922 | "Get the currently selected flags: this is the combination of |
d07d2bc9 | 923 | wx.FR_DOWN, wx.FR_WHOLEWORD and wx.FR_MATCHCASE flags.", ""); |
d0e2ede0 | 924 | |
e5868095 RD |
925 | DocDeclStr( |
926 | const wxString& , GetFindString(), | |
d07d2bc9 | 927 | "Return the string to find (never empty).", ""); |
d0e2ede0 | 928 | |
e5868095 RD |
929 | DocDeclStr( |
930 | const wxString& , GetReplaceString(), | |
dce2bd22 | 931 | "Return the string to replace the search string with (only for replace |
d07d2bc9 | 932 | and replace all events).", ""); |
d0e2ede0 | 933 | |
e5868095 RD |
934 | DocDeclStr( |
935 | wxFindReplaceDialog *, GetDialog(), | |
d07d2bc9 | 936 | "Return the pointer to the dialog which generated this event.", ""); |
d0e2ede0 | 937 | |
e5868095 RD |
938 | DocDeclStr( |
939 | void , SetFlags(int flags), | |
d07d2bc9 | 940 | "", ""); |
d0e2ede0 | 941 | |
e5868095 RD |
942 | DocDeclStr( |
943 | void , SetFindString(const wxString& str), | |
d07d2bc9 | 944 | "", ""); |
d0e2ede0 | 945 | |
e5868095 RD |
946 | DocDeclStr( |
947 | void , SetReplaceString(const wxString& str), | |
d07d2bc9 | 948 | "", ""); |
42e2bbb9 RD |
949 | |
950 | %property(Dialog, GetDialog, doc="See `GetDialog`"); | |
951 | %property(FindString, GetFindString, SetFindString, doc="See `GetFindString` and `SetFindString`"); | |
952 | %property(Flags, GetFlags, SetFlags, doc="See `GetFlags` and `SetFlags`"); | |
953 | %property(ReplaceString, GetReplaceString, SetReplaceString, doc="See `GetReplaceString` and `SetReplaceString`"); | |
0122b7e3 RD |
954 | }; |
955 | ||
956 | ||
957 | ||
d0e2ede0 | 958 | DocStr(wxFindReplaceData, |
dce2bd22 RD |
959 | "wx.FindReplaceData holds the data for wx.FindReplaceDialog. It is used |
960 | to initialize the dialog with the default values and will keep the | |
961 | last values from the dialog when it is closed. It is also updated each | |
962 | time a `wx.FindDialogEvent` is generated so instead of using the | |
963 | `wx.FindDialogEvent` methods you can also directly query this object. | |
964 | ||
965 | Note that all SetXXX() methods may only be called before showing the | |
d07d2bc9 | 966 | dialog and calling them has no effect later.", " |
dce2bd22 RD |
967 | |
968 | Flags | |
969 | ----- | |
d0e2ede0 | 970 | ================ =============================================== |
dce2bd22 RD |
971 | wx.FR_DOWN Downward search/replace selected (otherwise, |
972 | upwards) | |
973 | ||
974 | wx.FR_WHOLEWORD Whole word search/replace selected | |
975 | ||
976 | wx.FR_MATCHCASE Case sensitive search/replace selected | |
977 | (otherwise, case insensitive) | |
d0e2ede0 | 978 | ================ =============================================== |
e5868095 RD |
979 | "); |
980 | ||
981 | ||
982 | ||
983 | ||
0122b7e3 RD |
984 | class wxFindReplaceData : public wxObject |
985 | { | |
986 | public: | |
e5868095 RD |
987 | DocCtorStr( |
988 | wxFindReplaceData(int flags=0), | |
d07d2bc9 | 989 | "Constuctor initializes the flags to default value (0).", ""); |
d0e2ede0 | 990 | |
0122b7e3 | 991 | ~wxFindReplaceData(); |
d0e2ede0 | 992 | |
0122b7e3 | 993 | |
e5868095 RD |
994 | DocDeclStr( |
995 | const wxString& , GetFindString(), | |
d07d2bc9 | 996 | "Get the string to find.", ""); |
d0e2ede0 | 997 | |
e5868095 RD |
998 | DocDeclStr( |
999 | const wxString& , GetReplaceString(), | |
d07d2bc9 | 1000 | "Get the replacement string.", ""); |
d0e2ede0 | 1001 | |
e5868095 RD |
1002 | DocDeclStr( |
1003 | int , GetFlags(), | |
d07d2bc9 | 1004 | "Get the combination of flag values.", ""); |
d0e2ede0 | 1005 | |
e5868095 RD |
1006 | DocDeclStr( |
1007 | void , SetFlags(int flags), | |
d07d2bc9 | 1008 | "Set the flags to use to initialize the controls of the dialog.", ""); |
d0e2ede0 | 1009 | |
e5868095 RD |
1010 | DocDeclStr( |
1011 | void , SetFindString(const wxString& str), | |
d07d2bc9 | 1012 | "Set the string to find (used as initial value by the dialog).", ""); |
d0e2ede0 | 1013 | |
e5868095 RD |
1014 | DocDeclStr( |
1015 | void , SetReplaceString(const wxString& str), | |
d07d2bc9 | 1016 | "Set the replacement string (used as initial value by the dialog).", ""); |
d0e2ede0 | 1017 | |
42e2bbb9 RD |
1018 | %property(FindString, GetFindString, SetFindString, doc="See `GetFindString` and `SetFindString`"); |
1019 | %property(Flags, GetFlags, SetFlags, doc="See `GetFlags` and `SetFlags`"); | |
1020 | %property(ReplaceString, GetReplaceString, SetReplaceString, doc="See `GetReplaceString` and `SetReplaceString`"); | |
0122b7e3 RD |
1021 | }; |
1022 | ||
1023 | ||
e5868095 RD |
1024 | |
1025 | ||
1026 | DocStr(wxFindReplaceDialog, | |
dce2bd22 RD |
1027 | "wx.FindReplaceDialog is a standard modeless dialog which is used to |
1028 | allow the user to search for some text (and possibly replace it with | |
1029 | something else). The actual searching is supposed to be done in the | |
1030 | owner window which is the parent of this dialog. Note that it means | |
1031 | that unlike for the other standard dialogs this one must have a parent | |
1032 | window. Also note that there is no way to use this dialog in a modal | |
d07d2bc9 | 1033 | way; it is always, by design and implementation, modeless.", " |
dce2bd22 RD |
1034 | |
1035 | ||
1036 | Window Styles | |
1037 | ------------- | |
e5868095 | 1038 | |
dce2bd22 RD |
1039 | ===================== ========================================= |
1040 | wx.FR_REPLACEDIALOG replace dialog (otherwise find dialog) | |
e5868095 | 1041 | |
dce2bd22 | 1042 | wx.FR_NOUPDOWN don't allow changing the search direction |
e5868095 | 1043 | |
dce2bd22 | 1044 | wx.FR_NOMATCHCASE don't allow case sensitive searching |
e5868095 | 1045 | |
dce2bd22 RD |
1046 | wx.FR_NOWHOLEWORD don't allow whole word searching |
1047 | ===================== ========================================= | |
e5868095 RD |
1048 | "); |
1049 | ||
ab1f7d2a RD |
1050 | MustHaveApp(wxFindReplaceDialog); |
1051 | ||
0122b7e3 RD |
1052 | class wxFindReplaceDialog : public wxDialog { |
1053 | public: | |
2b9048c5 RD |
1054 | %pythonAppend wxFindReplaceDialog "self._setOORInfo(self)" |
1055 | %pythonAppend wxFindReplaceDialog() "" | |
d14a1e28 | 1056 | |
e5868095 RD |
1057 | DocCtorStr( |
1058 | wxFindReplaceDialog(wxWindow *parent, | |
1059 | wxFindReplaceData *data, | |
1060 | const wxString &title, | |
1061 | int style = 0), | |
dce2bd22 | 1062 | "Create a FindReplaceDialog. The parent and data parameters must be |
d07d2bc9 | 1063 | non-None. Use Show to display the dialog.", ""); |
e5868095 RD |
1064 | |
1065 | DocCtorStrName( | |
1066 | wxFindReplaceDialog(), | |
d07d2bc9 | 1067 | "Precreate a FindReplaceDialog for 2-phase creation", "", |
e5868095 | 1068 | PreFindReplaceDialog); |
0122b7e3 | 1069 | |
d0e2ede0 | 1070 | |
e5868095 | 1071 | DocDeclStr( |
dce2bd22 RD |
1072 | bool , Create(wxWindow *parent, wxFindReplaceData *data, |
1073 | const wxString &title, int style = 0), | |
d07d2bc9 | 1074 | "Create the dialog, for 2-phase create.", ""); |
d0e2ede0 | 1075 | |
0122b7e3 | 1076 | |
e5868095 RD |
1077 | DocDeclStr( |
1078 | const wxFindReplaceData *, GetData(), | |
d07d2bc9 | 1079 | "Get the FindReplaceData object used by this dialog.", ""); |
d0e2ede0 | 1080 | |
e5868095 RD |
1081 | DocDeclStr( |
1082 | void , SetData(wxFindReplaceData *data), | |
d07d2bc9 | 1083 | "Set the FindReplaceData object used by this dialog.", ""); |
d0e2ede0 | 1084 | |
42e2bbb9 | 1085 | %property(Data, GetData, SetData, doc="See `GetData` and `SetData`"); |
0122b7e3 RD |
1086 | }; |
1087 | ||
d14a1e28 RD |
1088 | //--------------------------------------------------------------------------- |
1089 | //--------------------------------------------------------------------------- |