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