]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: _cmndlgs.i | |
3 | // Purpose: SWIG interface for the "Common Dialog" classes | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 25-July-1998 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | %newgroup | |
18 | ||
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); | |
25 | ||
26 | //--------------------------------------------------------------------------- | |
27 | ||
28 | ||
29 | DocStr(wxColourData, | |
30 | "This class holds a variety of information related to colour dialogs."); | |
31 | ||
32 | class wxColourData : public wxObject { | |
33 | public: | |
34 | DocCtorStr( | |
35 | wxColourData(), | |
36 | "Constructor, sets default values."); | |
37 | ||
38 | ~wxColourData(); | |
39 | ||
40 | ||
41 | DocDeclStr( | |
42 | bool , GetChooseFull(), | |
43 | "Under Windows, determines whether the Windows colour dialog will display\n" | |
44 | "the full dialog with custom colour selection controls. Has no meaning\n" | |
45 | "under other platforms. The default value is true."); | |
46 | ||
47 | DocDeclStr( | |
48 | wxColour , GetColour(), | |
49 | "Gets the colour (pre)selected by the dialog."); | |
50 | ||
51 | DocDeclStr( | |
52 | wxColour , GetCustomColour(int i), | |
53 | "Gets the i'th custom colour associated with the colour dialog. i should\n" | |
54 | "be an integer between 0 and 15. The default custom colours are all white."); | |
55 | ||
56 | DocDeclStr( | |
57 | void , SetChooseFull(int flag), | |
58 | "Under Windows, tells the Windows colour dialog to display the full dialog\n" | |
59 | "with custom colour selection controls. Under other platforms, has no effect.\n" | |
60 | "The default value is true."); | |
61 | ||
62 | DocDeclStr( | |
63 | void , SetColour(const wxColour& colour), | |
64 | "Sets the default colour for the colour dialog. The default colour is black."); | |
65 | ||
66 | DocDeclStr( | |
67 | void , SetCustomColour(int i, const wxColour& colour), | |
68 | "Sets the i'th custom colour for the colour dialog. i should be an integer\n" | |
69 | "between 0 and 15. The default custom colours are all white."); | |
70 | ||
71 | }; | |
72 | ||
73 | ||
74 | DocStr(wxColourDialog, | |
75 | "This class represents the colour chooser dialog."); | |
76 | ||
77 | class wxColourDialog : public wxDialog { | |
78 | public: | |
79 | %pythonAppend wxColourDialog "self._setOORInfo(self)" | |
80 | ||
81 | DocCtorStr( | |
82 | wxColourDialog(wxWindow* parent, wxColourData* data = NULL), | |
83 | "Constructor. Pass a parent window, and optionally a ColourData, which\n" | |
84 | "will be copied to the colour dialog's internal ColourData instance."); | |
85 | ||
86 | DocDeclStr( | |
87 | wxColourData& , GetColourData(), | |
88 | "Returns a reference to the ColourData used by the dialog."); | |
89 | }; | |
90 | ||
91 | ||
92 | //-------------------------------------------------------------------------------- | |
93 | ||
94 | ||
95 | DocStr(wxDirDialog, | |
96 | "This class represents the directory chooser dialog."); | |
97 | ||
98 | RefDoc(wxDirDialog, " | |
99 | Styles | |
100 | wxDD_NEW_DIR_BUTTON Add \"Create new directory\" button and allow | |
101 | directory names to be editable. On Windows the new | |
102 | directory button is only available with recent | |
103 | versions of the common dialogs."); | |
104 | ||
105 | class wxDirDialog : public wxDialog { | |
106 | public: | |
107 | %pythonAppend wxDirDialog "self._setOORInfo(self)" | |
108 | ||
109 | RefDoc(wxDirDialog, ""); // turn it off for the ctors | |
110 | ||
111 | DocCtorStr( | |
112 | wxDirDialog(wxWindow* parent, | |
113 | const wxString& message = wxPyDirSelectorPromptStr, | |
114 | const wxString& defaultPath = wxPyEmptyString, | |
115 | long style = 0, | |
116 | const wxPoint& pos = wxDefaultPosition, | |
117 | const wxSize& size = wxDefaultSize, | |
118 | const wxString& name = wxPyDirDialogNameStr), | |
119 | "Constructor. Use ShowModal method to show the dialog."); | |
120 | ||
121 | ||
122 | DocDeclStr( | |
123 | wxString , GetPath(), | |
124 | "Returns the default or user-selected path."); | |
125 | ||
126 | DocDeclStr( | |
127 | wxString , GetMessage(), | |
128 | "Returns the message that will be displayed on the dialog."); | |
129 | ||
130 | DocDeclStr( | |
131 | long , GetStyle(), | |
132 | "Returns the dialog style."); | |
133 | ||
134 | DocDeclStr( | |
135 | void , SetMessage(const wxString& message), | |
136 | "Sets the message that will be displayed on the dialog."); | |
137 | ||
138 | DocDeclStr( | |
139 | void , SetPath(const wxString& path), | |
140 | "Sets the default path."); | |
141 | ||
142 | }; | |
143 | ||
144 | ||
145 | //--------------------------------------------------------------------------- | |
146 | ||
147 | DocStr(wxFileDialog, | |
148 | "This class represents the file chooser dialog."); | |
149 | ||
150 | RefDoc(wxFileDialog, " | |
151 | In Windows, this is the common file selector dialog. In X, this is a file | |
152 | selector box with somewhat less functionality. The path and filename are | |
153 | distinct elements of a full file pathname. If path is \"\", the current | |
154 | directory will be used. If filename is \"\", no default filename will be | |
155 | supplied. The wildcard determines what files are displayed in the file | |
156 | selector, and file extension supplies a type extension for the required | |
157 | filename. | |
158 | ||
159 | Both the X and Windows versions implement a wildcard filter. Typing a filename | |
160 | containing wildcards (*, ?) in the filename text item, and clicking on Ok, | |
161 | will result in only those files matching the pattern being displayed. The | |
162 | wildcard may be a specification for multiple types of file with a description | |
163 | for each, such as: | |
164 | ||
165 | \"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif\" | |
166 | ||
167 | Styles | |
168 | wx.OPEN This is an open dialog. | |
169 | ||
170 | wx.SAVE This is a save dialog. | |
171 | ||
172 | wx.HIDE_READONLY For open dialog only: hide the checkbox allowing to | |
173 | open the file in read-only mode. | |
174 | ||
175 | wx.OVERWRITE_PROMPT For save dialog only: prompt for a confirmation if a | |
176 | file will be overwritten. | |
177 | ||
178 | wx.MULTIPLE For open dialog only: allows selecting multiple files. | |
179 | ||
180 | wx.CHANGE_DIR Change the current working directory to the directory | |
181 | where the file(s) chosen by the user are. | |
182 | "); | |
183 | ||
184 | ||
185 | ||
186 | class wxFileDialog : public wxDialog { | |
187 | public: | |
188 | %pythonAppend wxFileDialog "self._setOORInfo(self)" | |
189 | ||
190 | RefDoc(wxFileDialog, ""); // turn it off for the ctors | |
191 | ||
192 | DocCtorStr( | |
193 | wxFileDialog(wxWindow* parent, | |
194 | const wxString& message = wxPyFileSelectorPromptStr, | |
195 | const wxString& defaultDir = wxPyEmptyString, | |
196 | const wxString& defaultFile = wxPyEmptyString, | |
197 | const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr, | |
198 | long style = 0, | |
199 | const wxPoint& pos = wxDefaultPosition), | |
200 | "Constructor. Use ShowModal method to show the dialog."); | |
201 | ||
202 | ||
203 | DocDeclStr( | |
204 | void , SetMessage(const wxString& message), | |
205 | "Sets the message that will be displayed on the dialog."); | |
206 | ||
207 | DocDeclStr( | |
208 | void , SetPath(const wxString& path), | |
209 | "Sets the path (the combined directory and filename that will\n" | |
210 | "be returned when the dialog is dismissed)."); | |
211 | ||
212 | DocDeclStr( | |
213 | void , SetDirectory(const wxString& dir), | |
214 | "Sets the default directory."); | |
215 | ||
216 | DocDeclStr( | |
217 | void , SetFilename(const wxString& name), | |
218 | "Sets the default filename."); | |
219 | ||
220 | DocDeclStr( | |
221 | void , SetWildcard(const wxString& wildCard), | |
222 | "Sets the wildcard, which can contain multiple file types, for example:\n" | |
223 | " \"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif\""); | |
224 | ||
225 | DocDeclStr( | |
226 | void , SetStyle(long style), | |
227 | "Sets the dialog style."); | |
228 | ||
229 | DocDeclStr( | |
230 | void , SetFilterIndex(int filterIndex), | |
231 | "Sets the default filter index, starting from zero."); | |
232 | ||
233 | ||
234 | DocDeclStr( | |
235 | wxString , GetMessage() const, | |
236 | "Returns the message that will be displayed on the dialog."); | |
237 | ||
238 | DocDeclStr( | |
239 | wxString , GetPath() const, | |
240 | "Returns the full path (directory and filename) of the selected file."); | |
241 | ||
242 | DocDeclStr( | |
243 | wxString , GetDirectory() const, | |
244 | "Returns the default directory."); | |
245 | ||
246 | DocDeclStr( | |
247 | wxString , GetFilename() const, | |
248 | "Returns the default filename."); | |
249 | ||
250 | DocDeclStr( | |
251 | wxString , GetWildcard() const, | |
252 | "Returns the file dialog wildcard."); | |
253 | ||
254 | DocDeclStr( | |
255 | long , GetStyle() const, | |
256 | "Returns the dialog style."); | |
257 | ||
258 | DocDeclStr( | |
259 | int , GetFilterIndex() const, | |
260 | "Returns the index into the list of filters supplied, optionally, in\n" | |
261 | "the wildcard parameter. Before the dialog is shown, this is the index\n" | |
262 | "which will be used when the dialog is first displayed. After the dialog\n" | |
263 | "is shown, this is the index selected by the user."); | |
264 | ||
265 | ||
266 | DocStr(GetFilenames, | |
267 | "Returns a list of filenames chosen in the dialog. This function should\n" | |
268 | "only be used with the dialogs which have wx.MULTIPLE style, use\n" | |
269 | "GetFilename for the others."); | |
270 | ||
271 | DocStr(GetPaths, | |
272 | "Fills the array paths with the full paths of the files chosen. This\n" | |
273 | "function should only be used with the dialogs which have wx.MULTIPLE style,\n" | |
274 | "use GetPath for the others."); | |
275 | ||
276 | %extend { | |
277 | PyObject* GetFilenames() { | |
278 | wxArrayString arr; | |
279 | self->GetFilenames(arr); | |
280 | return wxArrayString2PyList_helper(arr); | |
281 | } | |
282 | ||
283 | PyObject* GetPaths() { | |
284 | wxArrayString arr; | |
285 | self->GetPaths(arr); | |
286 | return wxArrayString2PyList_helper(arr); | |
287 | } | |
288 | } | |
289 | ||
290 | // TODO | |
291 | // // Utility functions | |
292 | ||
293 | // // Parses the wildCard, returning the number of filters. | |
294 | // // Returns 0 if none or if there's a problem, | |
295 | // // The arrays will contain an equal number of items found before the error. | |
296 | // // wildCard is in the form: | |
297 | // // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" | |
298 | // static int ParseWildcard(const wxString& wildCard, | |
299 | // wxArrayString& descriptions, | |
300 | // wxArrayString& filters); | |
301 | ||
302 | // // Append first extension to filePath from a ';' separated extensionList | |
303 | // // if filePath = "path/foo.bar" just return it as is | |
304 | // // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg" | |
305 | // // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath | |
306 | // static wxString AppendExtension(const wxString &filePath, | |
307 | // const wxString &extensionList); | |
308 | ||
309 | ||
310 | }; | |
311 | ||
312 | ||
313 | //--------------------------------------------------------------------------- | |
314 | ||
315 | enum { wxCHOICEDLG_STYLE }; | |
316 | ||
317 | ||
318 | DocStr(wxMultiChoiceDialog, | |
319 | "A simple dialog with a multi selection listbox."); | |
320 | ||
321 | class wxMultiChoiceDialog : public wxDialog | |
322 | { | |
323 | public: | |
324 | %pythonAppend wxMultiChoiceDialog "self._setOORInfo(self)" | |
325 | ||
326 | DocCtorAStr( | |
327 | wxMultiChoiceDialog(wxWindow *parent, | |
328 | const wxString& message, | |
329 | const wxString& caption, | |
330 | int choices=0, wxString* choices_array, | |
331 | long style = wxCHOICEDLG_STYLE, | |
332 | const wxPoint& pos = wxDefaultPosition), | |
333 | "__init__(Window parent, String message, String caption,\n" | |
334 | " List choices=[], long style=CHOICEDLG_STYLE,\n" | |
335 | " Point pos=DefaultPosition) -> MultiChoiceDialog", | |
336 | "Constructor. Use ShowModal method to show the dialog."); | |
337 | ||
338 | ||
339 | DocDeclAStr( | |
340 | void, SetSelections(const wxArrayInt& selections), | |
341 | "SetSelections(List selections)", | |
342 | "Specify the items in the list that shoudl be selected, using a list of integers."); | |
343 | ||
344 | DocAStr(GetSelections, | |
345 | "GetSelections() -> [selections]", | |
346 | "Returns a list of integers representing the items that are selected."); | |
347 | %extend { | |
348 | PyObject* GetSelections() { | |
349 | return wxArrayInt2PyList_helper(self->GetSelections()); | |
350 | } | |
351 | } | |
352 | }; | |
353 | ||
354 | ||
355 | //--------------------------------------------------------------------------- | |
356 | ||
357 | DocStr(wxSingleChoiceDialog, | |
358 | "A simple dialog with a single selection listbox."); | |
359 | ||
360 | class wxSingleChoiceDialog : public wxDialog { | |
361 | public: | |
362 | %pythonAppend wxSingleChoiceDialog "self._setOORInfo(self)" | |
363 | ||
364 | DocAStr(wxSingleChoiceDialog, | |
365 | "__init__(Window parent, String message, String caption,\n" | |
366 | " List choices=[], long style=CHOICEDLG_STYLE,\n" | |
367 | " Point pos=DefaultPosition) -> SingleChoiceDialog", | |
368 | "Constructor. Use ShowModal method to show the dialog."); | |
369 | ||
370 | %extend { | |
371 | // TODO: ignoring clientData for now... FIX THIS | |
372 | // SWIG is messing up the &/*'s for some reason. | |
373 | wxSingleChoiceDialog(wxWindow* parent, | |
374 | const wxString& message, | |
375 | const wxString& caption, | |
376 | int choices, wxString* choices_array, | |
377 | //char** clientData = NULL, | |
378 | long style = wxCHOICEDLG_STYLE, | |
379 | const wxPoint& pos = wxDefaultPosition) { | |
380 | return new wxSingleChoiceDialog(parent, message, caption, | |
381 | choices, choices_array, NULL, style, pos); | |
382 | } | |
383 | } | |
384 | ||
385 | DocDeclStr( | |
386 | int , GetSelection(), | |
387 | "Get the index of teh currently selected item."); | |
388 | ||
389 | DocDeclStr( | |
390 | wxString , GetStringSelection(), | |
391 | "Returns the string value of the currently selected item"); | |
392 | ||
393 | DocDeclStr( | |
394 | void , SetSelection(int sel), | |
395 | "Set the current selected item to sel"); | |
396 | }; | |
397 | ||
398 | ||
399 | //--------------------------------------------------------------------------- | |
400 | ||
401 | DocStr(wxTextEntryDialog, | |
402 | "A dialog with text control, [ok] and [cancel] buttons"); | |
403 | ||
404 | class wxTextEntryDialog : public wxDialog { | |
405 | public: | |
406 | %pythonAppend wxTextEntryDialog "self._setOORInfo(self)" | |
407 | ||
408 | DocCtorStr( | |
409 | wxTextEntryDialog(wxWindow* parent, | |
410 | const wxString& message, | |
411 | const wxString& caption = wxPyGetTextFromUserPromptStr, | |
412 | const wxString& defaultValue = wxPyEmptyString, | |
413 | long style = wxOK | wxCANCEL | wxCENTRE, | |
414 | const wxPoint& pos = wxDefaultPosition), | |
415 | "Constructor. Use ShowModal method to show the dialog."); | |
416 | ||
417 | DocDeclStr( | |
418 | wxString , GetValue(), | |
419 | "Returns the text that the user has entered if the user has pressed OK,\n" | |
420 | "or the original value if the user has pressed Cancel."); | |
421 | ||
422 | DocDeclStr( | |
423 | void , SetValue(const wxString& value), | |
424 | "Sets the default text value."); | |
425 | }; | |
426 | ||
427 | //--------------------------------------------------------------------------- | |
428 | ||
429 | ||
430 | DocStr(wxFontData, | |
431 | "This class holds a variety of information related to font dialogs."); | |
432 | ||
433 | ||
434 | class wxFontData : public wxObject { | |
435 | public: | |
436 | wxFontData(); | |
437 | ~wxFontData(); | |
438 | ||
439 | DocDeclStr( | |
440 | void , EnableEffects(bool enable), | |
441 | "Enables or disables 'effects' under MS Windows only. This refers\n" | |
442 | "to the controls for manipulating colour, strikeout and underline\n" | |
443 | "properties. The default value is true."); | |
444 | ||
445 | DocDeclStr( | |
446 | bool , GetAllowSymbols(), | |
447 | "Under MS Windows, returns a flag determining whether symbol fonts can be\n" | |
448 | "selected. Has no effect on other platforms. The default value is true."); | |
449 | ||
450 | DocDeclStr( | |
451 | wxColour , GetColour(), | |
452 | "Gets the colour associated with the font dialog. The default value is black."); | |
453 | ||
454 | DocDeclStr( | |
455 | wxFont , GetChosenFont(), | |
456 | "Gets the font chosen by the user."); | |
457 | ||
458 | DocDeclStr( | |
459 | bool , GetEnableEffects(), | |
460 | "Determines whether 'effects' are enabled under Windows."); | |
461 | ||
462 | DocDeclStr( | |
463 | wxFont , GetInitialFont(), | |
464 | "Gets the font that will be initially used by the font dialog. This should have\n" | |
465 | "previously been set by the application."); | |
466 | ||
467 | DocDeclStr( | |
468 | bool , GetShowHelp(), | |
469 | "Returns true if the Help button will be shown (Windows only). The default\n" | |
470 | "value is false."); | |
471 | ||
472 | DocDeclStr( | |
473 | void , SetAllowSymbols(bool allowSymbols), | |
474 | "Under MS Windows, determines whether symbol fonts can be selected. Has no\n" | |
475 | "effect on other platforms. The default value is true."); | |
476 | ||
477 | DocDeclStr( | |
478 | void , SetChosenFont(const wxFont& font), | |
479 | "Sets the font that will be returned to the user (for internal use only)."); | |
480 | ||
481 | DocDeclStr( | |
482 | void , SetColour(const wxColour& colour), | |
483 | "Sets the colour that will be used for the font foreground colour. The default\n" | |
484 | "colour is black."); | |
485 | ||
486 | DocDeclStr( | |
487 | void , SetInitialFont(const wxFont& font), | |
488 | "Sets the font that will be initially used by the font dialog."); | |
489 | ||
490 | DocDeclStr( | |
491 | void , SetRange(int min, int max), | |
492 | "Sets the valid range for the font point size (Windows only). The default is\n" | |
493 | "0, 0 (unrestricted range)."); | |
494 | ||
495 | DocDeclStr( | |
496 | void , SetShowHelp(bool showHelp), | |
497 | "Determines whether the Help button will be displayed in the font dialog\n" | |
498 | "(Windows only). The default value is false."); | |
499 | }; | |
500 | ||
501 | ||
502 | ||
503 | ||
504 | DocStr(wxFontDialog, | |
505 | "This class represents the font chooser dialog."); | |
506 | ||
507 | class wxFontDialog : public wxDialog { | |
508 | public: | |
509 | %pythonAppend wxFontDialog "self._setOORInfo(self)" | |
510 | ||
511 | DocStr(wxFontDialog, | |
512 | "Constructor. Pass a parent window and the FontData object to be\n" | |
513 | "used to initialize the dialog controls."); | |
514 | wxFontDialog(wxWindow* parent, const wxFontData& data); | |
515 | ||
516 | ||
517 | DocDeclStr( | |
518 | wxFontData& , GetFontData(), | |
519 | "Returns a reference to the internal FontData used by the FontDialog."); | |
520 | }; | |
521 | ||
522 | ||
523 | //--------------------------------------------------------------------------- | |
524 | ||
525 | ||
526 | DocStr(wxMessageDialog, | |
527 | "This class provides a dialog that shows a single or multi-line message, with\n" | |
528 | "a choice of OK, Yes, No and Cancel buttons."); | |
529 | ||
530 | RefDoc(wxMessageDialog, " | |
531 | Styles | |
532 | wx.OK: Show an OK button. | |
533 | ||
534 | wx.CANCEL: Show a Cancel button. | |
535 | ||
536 | wx.YES_NO: Show Yes and No buttons. | |
537 | ||
538 | wx.YES_DEFAULT: Used with wxYES_NO, makes Yes button the default - which is the default behaviour. | |
539 | ||
540 | wx.NO_DEFAULT: Used with wxYES_NO, makes No button the default. | |
541 | ||
542 | wx.ICON_EXCLAMATION: Shows an exclamation mark icon. | |
543 | ||
544 | wx.ICON_HAND: Shows an error icon. | |
545 | ||
546 | wx.ICON_ERROR: Shows an error icon - the same as wxICON_HAND. | |
547 | ||
548 | wx.ICON_QUESTION: Shows a question mark icon. | |
549 | ||
550 | wx.ICON_INFORMATION: Shows an information (i) icon. | |
551 | ||
552 | wx.STAY_ON_TOP: The message box stays on top of all other window, even those of the other applications (Windows only). | |
553 | "); | |
554 | ||
555 | ||
556 | class wxMessageDialog : public wxDialog { | |
557 | public: | |
558 | %pythonAppend wxMessageDialog "self._setOORInfo(self)" | |
559 | ||
560 | RefDoc(wxMessageDialog, ""); // turn it off for the ctors | |
561 | ||
562 | wxMessageDialog(wxWindow* parent, | |
563 | const wxString& message, | |
564 | const wxString& caption = wxPyMessageBoxCaptionStr, | |
565 | long style = wxOK | wxCANCEL | wxCENTRE, | |
566 | const wxPoint& pos = wxDefaultPosition); | |
567 | ||
568 | }; | |
569 | ||
570 | //--------------------------------------------------------------------------- | |
571 | ||
572 | ||
573 | DocStr(wxProgressDialog, | |
574 | "A dialog that shows a short message and a progress bar. Optionally, it can\n" | |
575 | "display an ABORT button."); | |
576 | ||
577 | RefDoc(wxProgressDialog, " | |
578 | Styles | |
579 | ||
580 | wx.PD_APP_MODAL: Make the progress dialog modal. If this flag is | |
581 | not given, it is only \"locally\" modal - that is | |
582 | the input to the parent window is disabled, | |
583 | but not to the other ones. | |
584 | ||
585 | wx.PD_AUTO_HIDE: Causes the progress dialog to disappear from screen | |
586 | as soon as the maximum value of the progress | |
587 | meter has been reached. | |
588 | ||
589 | wx.PD_CAN_ABORT: This flag tells the dialog that it should have | |
590 | a \"Cancel\" button which the user may press. If | |
591 | this happens, the next call to Update() will | |
592 | return false. | |
593 | ||
594 | wx.PD_ELAPSED_TIME: This flag tells the dialog that it should show | |
595 | elapsed time (since creating the dialog). | |
596 | ||
597 | wx.PD_ESTIMATED_TIME: This flag tells the dialog that it should show | |
598 | estimated time. | |
599 | ||
600 | wx.PD_REMAINING_TIME: This flag tells the dialog that it should show | |
601 | remaining time. | |
602 | "); | |
603 | ||
604 | ||
605 | class wxProgressDialog : public wxFrame { | |
606 | public: | |
607 | %pythonAppend wxProgressDialog "self._setOORInfo(self)" | |
608 | ||
609 | RefDoc(wxProgressDialog, ""); // turn it off for the ctors | |
610 | ||
611 | DocCtorStr( | |
612 | wxProgressDialog(const wxString& title, | |
613 | const wxString& message, | |
614 | int maximum = 100, | |
615 | wxWindow* parent = NULL, | |
616 | int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL ), | |
617 | "Constructor. Creates the dialog, displays it and disables user input for other\n" | |
618 | "windows, or, if wxPD_APP_MODAL flag is not given, for its parent window only."); | |
619 | ||
620 | DocDeclStr( | |
621 | bool , Update(int value, const wxString& newmsg = wxPyEmptyString), | |
622 | "Updates the dialog, setting the progress bar to the new value and, if given\n" | |
623 | "changes the message above it. Returns true unless the Cancel button has been\n" | |
624 | "pressed.\n\n" | |
625 | "If false is returned, the application can either immediately destroy the\n" | |
626 | "dialog or ask the user for the confirmation and if the abort is not confirmed\n" | |
627 | "the dialog may be resumed with Resume function."); | |
628 | ||
629 | DocDeclStr( | |
630 | void , Resume(), | |
631 | "Can be used to continue with the dialog, after the user had chosen to abort."); | |
632 | ||
633 | }; | |
634 | ||
635 | //--------------------------------------------------------------------------- | |
636 | ||
637 | enum wxFindReplaceFlags | |
638 | { | |
639 | // downward search/replace selected (otherwise - upwards) | |
640 | wxFR_DOWN = 1, | |
641 | ||
642 | // whole word search/replace selected | |
643 | wxFR_WHOLEWORD = 2, | |
644 | ||
645 | // case sensitive search/replace selected (otherwise - case insensitive) | |
646 | wxFR_MATCHCASE = 4 | |
647 | }; | |
648 | ||
649 | ||
650 | enum wxFindReplaceDialogStyles | |
651 | { | |
652 | // replace dialog (otherwise find dialog) | |
653 | wxFR_REPLACEDIALOG = 1, | |
654 | ||
655 | // don't allow changing the search direction | |
656 | wxFR_NOUPDOWN = 2, | |
657 | ||
658 | // don't allow case sensitive searching | |
659 | wxFR_NOMATCHCASE = 4, | |
660 | ||
661 | // don't allow whole word searching | |
662 | wxFR_NOWHOLEWORD = 8 | |
663 | }; | |
664 | ||
665 | ||
666 | ||
667 | %constant wxEventType wxEVT_COMMAND_FIND; | |
668 | %constant wxEventType wxEVT_COMMAND_FIND_NEXT; | |
669 | %constant wxEventType wxEVT_COMMAND_FIND_REPLACE; | |
670 | %constant wxEventType wxEVT_COMMAND_FIND_REPLACE_ALL; | |
671 | %constant wxEventType wxEVT_COMMAND_FIND_CLOSE; | |
672 | ||
673 | ||
674 | %pythoncode { | |
675 | EVT_FIND = wx.PyEventBinder( wxEVT_COMMAND_FIND, 1 ) | |
676 | EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_COMMAND_FIND_NEXT, 1 ) | |
677 | EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE, 1 ) | |
678 | EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE_ALL, 1 ) | |
679 | EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_FIND_CLOSE, 1 ) | |
680 | ||
681 | %# For backwards compatibility. Should they be removed? | |
682 | EVT_COMMAND_FIND = EVT_FIND | |
683 | EVT_COMMAND_FIND_NEXT = EVT_FIND_NEXT | |
684 | EVT_COMMAND_FIND_REPLACE = EVT_FIND_REPLACE | |
685 | EVT_COMMAND_FIND_REPLACE_ALL = EVT_FIND_REPLACE_ALL | |
686 | EVT_COMMAND_FIND_CLOSE = EVT_FIND_CLOSE | |
687 | } | |
688 | ||
689 | ||
690 | DocStr(wxFindDialogEvent, | |
691 | "Events for the FindReplaceDialog"); | |
692 | ||
693 | class wxFindDialogEvent : public wxCommandEvent | |
694 | { | |
695 | public: | |
696 | wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0); | |
697 | ||
698 | DocDeclStr( | |
699 | int , GetFlags(), | |
700 | "Get the currently selected flags: this is the combination of\n" | |
701 | "wx.FR_DOWN, wx.FR_WHOLEWORD and wx.FR_MATCHCASE flags."); | |
702 | ||
703 | DocDeclStr( | |
704 | const wxString& , GetFindString(), | |
705 | "Return the string to find (never empty)."); | |
706 | ||
707 | DocDeclStr( | |
708 | const wxString& , GetReplaceString(), | |
709 | "Return the string to replace the search string with (only\n" | |
710 | "for replace and replace all events)."); | |
711 | ||
712 | DocDeclStr( | |
713 | wxFindReplaceDialog *, GetDialog(), | |
714 | "Return the pointer to the dialog which generated this event."); | |
715 | ||
716 | DocDeclStr( | |
717 | void , SetFlags(int flags), | |
718 | ""); | |
719 | ||
720 | DocDeclStr( | |
721 | void , SetFindString(const wxString& str), | |
722 | ""); | |
723 | ||
724 | DocDeclStr( | |
725 | void , SetReplaceString(const wxString& str), | |
726 | ""); | |
727 | }; | |
728 | ||
729 | ||
730 | ||
731 | DocStr(wxFindReplaceData, | |
732 | "FindReplaceData holds the data for FindReplaceDialog. It is used to initialize | |
733 | the dialog with the default values and will keep the last values from the | |
734 | dialog when it is closed. It is also updated each time a wxFindDialogEvent is | |
735 | generated so instead of using the wxFindDialogEvent methods you can also | |
736 | directly query this object. | |
737 | ||
738 | Note that all SetXXX() methods may only be called before showing the dialog | |
739 | and calling them has no effect later. | |
740 | ||
741 | Flags | |
742 | wxFR_DOWN: downward search/replace selected (otherwise, upwards) | |
743 | ||
744 | wxFR_WHOLEWORD: whole word search/replace selected | |
745 | ||
746 | wxFR_MATCHCASE: case sensitive search/replace selected (otherwise, | |
747 | case insensitive) | |
748 | "); | |
749 | ||
750 | ||
751 | ||
752 | ||
753 | class wxFindReplaceData : public wxObject | |
754 | { | |
755 | public: | |
756 | DocCtorStr( | |
757 | wxFindReplaceData(int flags=0), | |
758 | "Constuctor initializes the flags to default value (0)."); | |
759 | ||
760 | ~wxFindReplaceData(); | |
761 | ||
762 | ||
763 | DocDeclStr( | |
764 | const wxString& , GetFindString(), | |
765 | "Get the string to find."); | |
766 | ||
767 | DocDeclStr( | |
768 | const wxString& , GetReplaceString(), | |
769 | "Get the replacement string."); | |
770 | ||
771 | DocDeclStr( | |
772 | int , GetFlags(), | |
773 | "Get the combination of flag values."); | |
774 | ||
775 | DocDeclStr( | |
776 | void , SetFlags(int flags), | |
777 | "Set the flags to use to initialize the controls of the dialog."); | |
778 | ||
779 | DocDeclStr( | |
780 | void , SetFindString(const wxString& str), | |
781 | "Set the string to find (used as initial value by the dialog)."); | |
782 | ||
783 | DocDeclStr( | |
784 | void , SetReplaceString(const wxString& str), | |
785 | "Set the replacement string (used as initial value by the dialog)."); | |
786 | ||
787 | }; | |
788 | ||
789 | ||
790 | ||
791 | ||
792 | DocStr(wxFindReplaceDialog, | |
793 | "FindReplaceDialog is a standard modeless dialog which is used to allow the | |
794 | user to search for some text (and possibly replace it with something | |
795 | else). The actual searching is supposed to be done in the owner window which | |
796 | is the parent of this dialog. Note that it means that unlike for the other | |
797 | standard dialogs this one must have a parent window. Also note that there is | |
798 | no way to use this dialog in a modal way; it is always, by design and | |
799 | implementation, modeless."); | |
800 | ||
801 | RefDoc(wxFindReplaceDialog, " | |
802 | Styles | |
803 | wx.FR_REPLACEDIALOG: replace dialog (otherwise find dialog) | |
804 | ||
805 | wx.FR_NOUPDOWN: don't allow changing the search direction | |
806 | ||
807 | wx.FR_NOMATCHCASE: don't allow case sensitive searching | |
808 | ||
809 | wx.FR_NOWHOLEWORD: don't allow whole word searching | |
810 | "); | |
811 | ||
812 | class wxFindReplaceDialog : public wxDialog { | |
813 | public: | |
814 | %pythonAppend wxFindReplaceDialog "self._setOORInfo(self)" | |
815 | %pythonAppend wxFindReplaceDialog() "" | |
816 | ||
817 | RefDoc(wxFindReplaceDialog, ""); // turn it off for the ctors | |
818 | ||
819 | DocCtorStr( | |
820 | wxFindReplaceDialog(wxWindow *parent, | |
821 | wxFindReplaceData *data, | |
822 | const wxString &title, | |
823 | int style = 0), | |
824 | "Create a FindReplaceDialog. The parent and data parameters must be\n" | |
825 | "non-None. Use Show to display the dialog."); | |
826 | ||
827 | DocCtorStrName( | |
828 | wxFindReplaceDialog(), | |
829 | "Precreate a FindReplaceDialog for 2-phase creation", | |
830 | PreFindReplaceDialog); | |
831 | ||
832 | ||
833 | DocDeclStr( | |
834 | bool , Create(wxWindow *parent, | |
835 | wxFindReplaceData *data, | |
836 | const wxString &title, | |
837 | int style = 0), | |
838 | "Create the dialog, for 2-phase create."); | |
839 | ||
840 | ||
841 | DocDeclStr( | |
842 | const wxFindReplaceData *, GetData(), | |
843 | "Get the FindReplaceData object used by this dialog."); | |
844 | ||
845 | DocDeclStr( | |
846 | void , SetData(wxFindReplaceData *data), | |
847 | "Set the FindReplaceData object used by this dialog."); | |
848 | ||
849 | }; | |
850 | ||
851 | //--------------------------------------------------------------------------- | |
852 | //--------------------------------------------------------------------------- |