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