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