]>
Commit | Line | Data |
---|---|---|
7bf85405 | 1 | ///////////////////////////////////////////////////////////////////////////// |
d14a1e28 RD |
2 | // Name: _cmndlgs.i |
3 | // Purpose: SWIG interface for the "Common Dialog" classes | |
7bf85405 RD |
4 | // |
5 | // Author: Robin Dunn | |
6 | // | |
d14a1e28 | 7 | // Created: 25-July-1998 |
7bf85405 | 8 | // RCS-ID: $Id$ |
d14a1e28 | 9 | // Copyright: (c) 2003 by Total Control Software |
7bf85405 RD |
10 | // Licence: wxWindows license |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
d14a1e28 | 13 | // Not a %module |
7bf85405 | 14 | |
7bf85405 | 15 | |
d14a1e28 RD |
16 | //--------------------------------------------------------------------------- |
17 | %newgroup | |
7bf85405 | 18 | |
137b5242 | 19 | %{ |
d14a1e28 | 20 | |
137b5242 | 21 | DECLARE_DEF_STRING(FileSelectorPromptStr); |
daa3eac9 RD |
22 | DECLARE_DEF_STRING(DirSelectorPromptStr); |
23 | DECLARE_DEF_STRING(DirDialogNameStr); | |
137b5242 RD |
24 | DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr); |
25 | DECLARE_DEF_STRING(GetTextFromUserPromptStr); | |
26 | DECLARE_DEF_STRING(MessageBoxCaptionStr); | |
137b5242 RD |
27 | |
28 | %} | |
29 | ||
d14a1e28 RD |
30 | //--------------------------------------------------------------------------- |
31 | ||
137b5242 | 32 | |
9416aa89 | 33 | class wxColourData : public wxObject { |
7bf85405 RD |
34 | public: |
35 | wxColourData(); | |
36 | ~wxColourData(); | |
37 | ||
38 | bool GetChooseFull(); | |
25832b3f | 39 | wxColour GetColour(); |
fb5e0af0 | 40 | wxColour GetCustomColour(int i); |
7bf85405 RD |
41 | void SetChooseFull(int flag); |
42 | void SetColour(const wxColour& colour); | |
43 | void SetCustomColour(int i, const wxColour& colour); | |
44 | }; | |
45 | ||
46 | ||
47 | class wxColourDialog : public wxDialog { | |
48 | public: | |
d14a1e28 | 49 | %addtofunc wxColourDialog "self._setOORInfo(self)" |
7bf85405 | 50 | |
d14a1e28 | 51 | wxColourDialog(wxWindow* parent, wxColourData* data = NULL); |
0122b7e3 | 52 | |
7bf85405 RD |
53 | wxColourData& GetColourData(); |
54 | int ShowModal(); | |
55 | }; | |
56 | ||
57 | ||
d14a1e28 | 58 | //-------------------------------------------------------------------------------- |
7bf85405 RD |
59 | |
60 | class wxDirDialog : public wxDialog { | |
61 | public: | |
d14a1e28 RD |
62 | %addtofunc wxDirDialog "self._setOORInfo(self)" |
63 | ||
7bf85405 | 64 | wxDirDialog(wxWindow* parent, |
daa3eac9 | 65 | const wxString& message = wxPyDirSelectorPromptStr, |
137b5242 | 66 | const wxString& defaultPath = wxPyEmptyString, |
7bf85405 | 67 | long style = 0, |
daa3eac9 RD |
68 | const wxPoint& pos = wxDefaultPosition, |
69 | const wxSize& size = wxDefaultSize, | |
70 | const wxString& name = wxPyDirDialogNameStr); | |
7bf85405 | 71 | |
0122b7e3 | 72 | |
7bf85405 RD |
73 | wxString GetPath(); |
74 | wxString GetMessage(); | |
75 | long GetStyle(); | |
76 | void SetMessage(const wxString& message); | |
77 | void SetPath(const wxString& path); | |
78 | int ShowModal(); | |
79 | }; | |
80 | ||
68320e40 | 81 | |
d14a1e28 | 82 | //--------------------------------------------------------------------------- |
7bf85405 RD |
83 | |
84 | class wxFileDialog : public wxDialog { | |
85 | public: | |
d14a1e28 RD |
86 | %addtofunc wxFileDialog "self._setOORInfo(self)" |
87 | ||
7bf85405 | 88 | wxFileDialog(wxWindow* parent, |
137b5242 RD |
89 | const wxString& message = wxPyFileSelectorPromptStr, |
90 | const wxString& defaultDir = wxPyEmptyString, | |
91 | const wxString& defaultFile = wxPyEmptyString, | |
92 | const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr, | |
7bf85405 | 93 | long style = 0, |
b68dc582 | 94 | const wxPoint& pos = wxDefaultPosition); |
7bf85405 | 95 | |
0122b7e3 | 96 | |
7bf85405 RD |
97 | void SetMessage(const wxString& message); |
98 | void SetPath(const wxString& path); | |
3ef86e32 RD |
99 | void SetDirectory(const wxString& dir); |
100 | void SetFilename(const wxString& name); | |
7bf85405 | 101 | void SetWildcard(const wxString& wildCard); |
3ef86e32 RD |
102 | void SetStyle(long style); |
103 | void SetFilterIndex(int filterIndex); | |
104 | ||
105 | wxString GetMessage() const; | |
106 | wxString GetPath() const; | |
107 | wxString GetDirectory() const; | |
108 | wxString GetFilename() const; | |
109 | wxString GetWildcard() const; | |
110 | long GetStyle() const; | |
111 | int GetFilterIndex() const; | |
f6bcfd97 | 112 | |
d14a1e28 | 113 | %extend { |
f6bcfd97 BP |
114 | PyObject* GetFilenames() { |
115 | wxArrayString arr; | |
116 | self->GetFilenames(arr); | |
b37c7e1d | 117 | return wxArrayString2PyList_helper(arr); |
f6bcfd97 BP |
118 | } |
119 | ||
120 | PyObject* GetPaths() { | |
121 | wxArrayString arr; | |
122 | self->GetPaths(arr); | |
b37c7e1d | 123 | return wxArrayString2PyList_helper(arr); |
f6bcfd97 BP |
124 | } |
125 | } | |
3ef86e32 RD |
126 | |
127 | // TODO | |
128 | // // Utility functions | |
129 | ||
130 | // // Parses the wildCard, returning the number of filters. | |
131 | // // Returns 0 if none or if there's a problem, | |
132 | // // The arrays will contain an equal number of items found before the error. | |
133 | // // wildCard is in the form: | |
134 | // // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" | |
135 | // static int ParseWildcard(const wxString& wildCard, | |
136 | // wxArrayString& descriptions, | |
137 | // wxArrayString& filters); | |
138 | ||
139 | // // Append first extension to filePath from a ';' separated extensionList | |
140 | // // if filePath = "path/foo.bar" just return it as is | |
141 | // // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg" | |
142 | // // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath | |
143 | // static wxString AppendExtension(const wxString &filePath, | |
144 | // const wxString &extensionList); | |
145 | ||
146 | ||
7bf85405 RD |
147 | }; |
148 | ||
149 | ||
d14a1e28 | 150 | //--------------------------------------------------------------------------- |
7bf85405 | 151 | |
293a0a86 RD |
152 | enum { wxCHOICEDLG_STYLE }; |
153 | ||
154 | class wxMultiChoiceDialog : public wxDialog | |
155 | { | |
156 | public: | |
d14a1e28 RD |
157 | %addtofunc wxMultiChoiceDialog "self._setOORInfo(self)" |
158 | ||
293a0a86 RD |
159 | wxMultiChoiceDialog(wxWindow *parent, |
160 | const wxString& message, | |
161 | const wxString& caption, | |
162 | int LCOUNT, wxString *choices, | |
163 | long style = wxCHOICEDLG_STYLE, | |
164 | const wxPoint& pos = wxDefaultPosition); | |
165 | ||
293a0a86 RD |
166 | void SetSelections(const wxArrayInt& selections); |
167 | ||
168 | // wxArrayInt GetSelections() const; | |
d14a1e28 | 169 | %extend { |
293a0a86 RD |
170 | PyObject* GetSelections() { |
171 | return wxArrayInt2PyList_helper(self->GetSelections()); | |
172 | } | |
173 | } | |
174 | }; | |
175 | ||
7bf85405 | 176 | |
d14a1e28 | 177 | //--------------------------------------------------------------------------- |
7bf85405 RD |
178 | |
179 | class wxSingleChoiceDialog : public wxDialog { | |
180 | public: | |
d14a1e28 RD |
181 | %addtofunc wxSingleChoiceDialog "self._setOORInfo(self)" |
182 | ||
183 | %extend { | |
184 | // TODO: ignoring clientData for now... FIX THIS | |
7bf85405 RD |
185 | // SWIG is messing up the &/*'s for some reason. |
186 | wxSingleChoiceDialog(wxWindow* parent, | |
d14a1e28 RD |
187 | const wxString& message, |
188 | const wxString& caption, | |
189 | int choices, wxString* choices_array, | |
7bf85405 | 190 | //char** clientData = NULL, |
293a0a86 | 191 | long style = wxCHOICEDLG_STYLE, |
d14a1e28 RD |
192 | const wxPoint& pos = wxDefaultPosition) { |
193 | return new wxSingleChoiceDialog(parent, message, caption, | |
194 | choices, choices_array, NULL, style, pos); | |
7bf85405 | 195 | } |
09f3d4e6 | 196 | } |
9c039d08 | 197 | |
7bf85405 RD |
198 | int GetSelection(); |
199 | wxString GetStringSelection(); | |
200 | void SetSelection(int sel); | |
201 | int ShowModal(); | |
202 | }; | |
203 | ||
204 | ||
d14a1e28 | 205 | //--------------------------------------------------------------------------- |
7bf85405 RD |
206 | |
207 | class wxTextEntryDialog : public wxDialog { | |
208 | public: | |
d14a1e28 RD |
209 | %addtofunc wxTextEntryDialog "self._setOORInfo(self)" |
210 | ||
7bf85405 | 211 | wxTextEntryDialog(wxWindow* parent, |
137b5242 RD |
212 | const wxString& message, |
213 | const wxString& caption = wxPyGetTextFromUserPromptStr, | |
214 | const wxString& defaultValue = wxPyEmptyString, | |
7bf85405 | 215 | long style = wxOK | wxCANCEL | wxCENTRE, |
b68dc582 | 216 | const wxPoint& pos = wxDefaultPosition); |
7bf85405 RD |
217 | |
218 | wxString GetValue(); | |
219 | void SetValue(const wxString& value); | |
220 | int ShowModal(); | |
221 | }; | |
222 | ||
d14a1e28 | 223 | //--------------------------------------------------------------------------- |
7bf85405 | 224 | |
9416aa89 | 225 | class wxFontData : public wxObject { |
7bf85405 RD |
226 | public: |
227 | wxFontData(); | |
228 | ~wxFontData(); | |
229 | ||
230 | void EnableEffects(bool enable); | |
231 | bool GetAllowSymbols(); | |
25832b3f | 232 | wxColour GetColour(); |
7bf85405 RD |
233 | wxFont GetChosenFont(); |
234 | bool GetEnableEffects(); | |
235 | wxFont GetInitialFont(); | |
236 | bool GetShowHelp(); | |
237 | void SetAllowSymbols(bool allowSymbols); | |
238 | void SetChosenFont(const wxFont& font); | |
239 | void SetColour(const wxColour& colour); | |
240 | void SetInitialFont(const wxFont& font); | |
241 | void SetRange(int min, int max); | |
242 | void SetShowHelp(bool showHelp); | |
243 | }; | |
244 | ||
245 | ||
246 | class wxFontDialog : public wxDialog { | |
247 | public: | |
d14a1e28 RD |
248 | %addtofunc wxFontDialog "self._setOORInfo(self)" |
249 | ||
557a93b9 | 250 | wxFontDialog(wxWindow* parent, const wxFontData& data); |
7bf85405 RD |
251 | |
252 | wxFontData& GetFontData(); | |
253 | int ShowModal(); | |
254 | }; | |
255 | ||
256 | ||
d14a1e28 | 257 | //--------------------------------------------------------------------------- |
7bf85405 RD |
258 | |
259 | class wxMessageDialog : public wxDialog { | |
260 | public: | |
d14a1e28 RD |
261 | %addtofunc wxMessageDialog "self._setOORInfo(self)" |
262 | ||
7bf85405 | 263 | wxMessageDialog(wxWindow* parent, |
137b5242 RD |
264 | const wxString& message, |
265 | const wxString& caption = wxPyMessageBoxCaptionStr, | |
7bf85405 | 266 | long style = wxOK | wxCANCEL | wxCENTRE, |
b68dc582 | 267 | const wxPoint& pos = wxDefaultPosition); |
7bf85405 RD |
268 | |
269 | int ShowModal(); | |
270 | }; | |
271 | ||
d14a1e28 | 272 | //--------------------------------------------------------------------------- |
7bf85405 | 273 | |
bb0054cd RD |
274 | class wxProgressDialog : public wxFrame { |
275 | public: | |
d14a1e28 RD |
276 | %addtofunc wxProgressDialog "self._setOORInfo(self)" |
277 | ||
bb0054cd RD |
278 | wxProgressDialog(const wxString& title, |
279 | const wxString& message, | |
280 | int maximum = 100, | |
281 | wxWindow* parent = NULL, | |
282 | int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL ); | |
7bf85405 | 283 | |
137b5242 | 284 | bool Update(int value, const wxString& newmsg = wxPyEmptyString); |
bb0054cd | 285 | void Resume(); |
d14a1e28 | 286 | }; |
bb0054cd | 287 | |
d14a1e28 | 288 | //--------------------------------------------------------------------------- |
0122b7e3 RD |
289 | |
290 | enum wxFindReplaceFlags | |
291 | { | |
292 | // downward search/replace selected (otherwise - upwards) | |
293 | wxFR_DOWN = 1, | |
294 | ||
295 | // whole word search/replace selected | |
296 | wxFR_WHOLEWORD = 2, | |
297 | ||
298 | // case sensitive search/replace selected (otherwise - case insensitive) | |
299 | wxFR_MATCHCASE = 4 | |
300 | }; | |
301 | ||
302 | ||
303 | enum wxFindReplaceDialogStyles | |
304 | { | |
305 | // replace dialog (otherwise find dialog) | |
306 | wxFR_REPLACEDIALOG = 1, | |
307 | ||
308 | // don't allow changing the search direction | |
309 | wxFR_NOUPDOWN = 2, | |
310 | ||
311 | // don't allow case sensitive searching | |
312 | wxFR_NOMATCHCASE = 4, | |
313 | ||
314 | // don't allow whole word searching | |
315 | wxFR_NOWHOLEWORD = 8 | |
316 | }; | |
317 | ||
0122b7e3 | 318 | |
0122b7e3 | 319 | |
d14a1e28 RD |
320 | %constant wxEventType wxEVT_COMMAND_FIND; |
321 | %constant wxEventType wxEVT_COMMAND_FIND_NEXT; | |
322 | %constant wxEventType wxEVT_COMMAND_FIND_REPLACE; | |
323 | %constant wxEventType wxEVT_COMMAND_FIND_REPLACE_ALL; | |
324 | %constant wxEventType wxEVT_COMMAND_FIND_CLOSE; | |
0122b7e3 | 325 | |
0122b7e3 | 326 | |
d14a1e28 RD |
327 | %pythoncode { |
328 | EVT_FIND = wx.PyEventBinder( wxEVT_COMMAND_FIND, 1 ) | |
329 | EVT_FIND_NEXT = wx.PyEventBinder( wxEVT_COMMAND_FIND_NEXT, 1 ) | |
330 | EVT_FIND_REPLACE = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE, 1 ) | |
331 | EVT_FIND_REPLACE_ALL = wx.PyEventBinder( wxEVT_COMMAND_FIND_REPLACE_ALL, 1 ) | |
332 | EVT_FIND_CLOSE = wx.PyEventBinder( wxEVT_COMMAND_FIND_CLOSE, 1 ) | |
0122b7e3 | 333 | |
d14a1e28 RD |
334 | %# For backwards compatibility. Should they be removed? |
335 | EVT_COMMAND_FIND = EVT_FIND | |
336 | EVT_COMMAND_FIND_NEXT = EVT_FIND_NEXT | |
337 | EVT_COMMAND_FIND_REPLACE = EVT_FIND_REPLACE | |
338 | EVT_COMMAND_FIND_REPLACE_ALL = EVT_FIND_REPLACE_ALL | |
339 | EVT_COMMAND_FIND_CLOSE = EVT_FIND_CLOSE | |
340 | } | |
0122b7e3 | 341 | |
0122b7e3 RD |
342 | |
343 | class wxFindDialogEvent : public wxCommandEvent | |
344 | { | |
345 | public: | |
346 | wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0); | |
347 | int GetFlags(); | |
87c2245b | 348 | const wxString& GetFindString(); |
0122b7e3 RD |
349 | const wxString& GetReplaceString(); |
350 | wxFindReplaceDialog *GetDialog(); | |
351 | void SetFlags(int flags); | |
352 | void SetFindString(const wxString& str); | |
353 | void SetReplaceString(const wxString& str); | |
354 | }; | |
355 | ||
356 | ||
357 | ||
358 | class wxFindReplaceData : public wxObject | |
359 | { | |
360 | public: | |
361 | wxFindReplaceData(int flags=0); | |
362 | ~wxFindReplaceData(); | |
363 | ||
364 | const wxString& GetFindString(); | |
365 | const wxString& GetReplaceString(); | |
366 | int GetFlags(); | |
367 | void SetFlags(int flags); | |
368 | void SetFindString(const wxString& str); | |
369 | void SetReplaceString(const wxString& str); | |
370 | }; | |
371 | ||
372 | ||
373 | class wxFindReplaceDialog : public wxDialog { | |
374 | public: | |
d14a1e28 RD |
375 | %addtofunc wxFindReplaceDialog "self._setOORInfo(self)" |
376 | %addtofunc wxFindReplaceDialog() "" | |
377 | ||
0122b7e3 RD |
378 | wxFindReplaceDialog(wxWindow *parent, |
379 | wxFindReplaceData *data, | |
380 | const wxString &title, | |
381 | int style = 0); | |
d14a1e28 | 382 | %name(PreFindReplaceDialog)wxFindReplaceDialog(); |
0122b7e3 RD |
383 | |
384 | bool Create(wxWindow *parent, | |
385 | wxFindReplaceData *data, | |
386 | const wxString &title, | |
387 | int style = 0); | |
388 | ||
0122b7e3 RD |
389 | const wxFindReplaceData *GetData(); |
390 | void SetData(wxFindReplaceData *data); | |
391 | }; | |
392 | ||
d14a1e28 RD |
393 | //--------------------------------------------------------------------------- |
394 | //--------------------------------------------------------------------------- |