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