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