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