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