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