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