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