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