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