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