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