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