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