]>
Commit | Line | Data |
---|---|---|
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 | ||
13 | %module cmndlgs | |
14 | ||
15 | %{ | |
16 | #include "helpers.h" | |
17 | #include <wx/colordlg.h> | |
18 | #include <wx/dirdlg.h> | |
19 | #include <wx/fontdlg.h> | |
20 | #include <wx/progdlg.h> | |
21 | #include <wx/fdrepdlg.h> | |
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 | |
34 | %import events.i | |
35 | %import frames.i | |
36 | ||
37 | %pragma(python) code = "import wx" | |
38 | ||
39 | //---------------------------------------------------------------------- | |
40 | ||
41 | %{ | |
42 | // Put some wx default wxChar* values into wxStrings. | |
43 | DECLARE_DEF_STRING(FileSelectorPromptStr); | |
44 | DECLARE_DEF_STRING(DirSelectorPromptStr); | |
45 | DECLARE_DEF_STRING(DirDialogNameStr); | |
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 | ||
55 | class wxColourData : public wxObject { | |
56 | public: | |
57 | wxColourData(); | |
58 | ~wxColourData(); | |
59 | ||
60 | bool GetChooseFull(); | |
61 | wxColour GetColour(); | |
62 | wxColour GetCustomColour(int i); | |
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 | ||
73 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
74 | ||
75 | wxColourData& GetColourData(); | |
76 | int ShowModal(); | |
77 | }; | |
78 | ||
79 | ||
80 | //---------------------------------------------------------------------- | |
81 | ||
82 | class wxDirDialog : public wxDialog { | |
83 | public: | |
84 | wxDirDialog(wxWindow* parent, | |
85 | const wxString& message = wxPyDirSelectorPromptStr, | |
86 | const wxString& defaultPath = wxPyEmptyString, | |
87 | long style = 0, | |
88 | const wxPoint& pos = wxDefaultPosition, | |
89 | const wxSize& size = wxDefaultSize, | |
90 | const wxString& name = wxPyDirDialogNameStr); | |
91 | ||
92 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
93 | ||
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 | ||
102 | ||
103 | //---------------------------------------------------------------------- | |
104 | ||
105 | class wxFileDialog : public wxDialog { | |
106 | public: | |
107 | wxFileDialog(wxWindow* parent, | |
108 | const wxString& message = wxPyFileSelectorPromptStr, | |
109 | const wxString& defaultDir = wxPyEmptyString, | |
110 | const wxString& defaultFile = wxPyEmptyString, | |
111 | const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr, | |
112 | long style = 0, | |
113 | const wxPoint& pos = wxDefaultPosition); | |
114 | ||
115 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
116 | ||
117 | void SetMessage(const wxString& message); | |
118 | void SetPath(const wxString& path); | |
119 | void SetDirectory(const wxString& dir); | |
120 | void SetFilename(const wxString& name); | |
121 | void SetWildcard(const wxString& wildCard); | |
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; | |
132 | ||
133 | %addmethods { | |
134 | PyObject* GetFilenames() { | |
135 | wxArrayString arr; | |
136 | self->GetFilenames(arr); | |
137 | return wxArrayString2PyList_helper(arr); | |
138 | } | |
139 | ||
140 | PyObject* GetPaths() { | |
141 | wxArrayString arr; | |
142 | self->GetPaths(arr); | |
143 | return wxArrayString2PyList_helper(arr); | |
144 | } | |
145 | } | |
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 | ||
167 | }; | |
168 | ||
169 | ||
170 | //---------------------------------------------------------------------- | |
171 | ||
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 | ||
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, | |
207 | int LCOUNT, wxString* choices, | |
208 | //char** clientData = NULL, | |
209 | long style = wxCHOICEDLG_STYLE, | |
210 | wxPoint* pos = &wxDefaultPosition) { | |
211 | return new wxSingleChoiceDialog(parent, *message, *caption, | |
212 | LCOUNT, choices, NULL, style, *pos); | |
213 | } | |
214 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
215 | ||
216 | } | |
217 | ||
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, | |
230 | const wxString& message, | |
231 | const wxString& caption = wxPyGetTextFromUserPromptStr, | |
232 | const wxString& defaultValue = wxPyEmptyString, | |
233 | long style = wxOK | wxCANCEL | wxCENTRE, | |
234 | const wxPoint& pos = wxDefaultPosition); | |
235 | ||
236 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
237 | ||
238 | wxString GetValue(); | |
239 | void SetValue(const wxString& value); | |
240 | int ShowModal(); | |
241 | }; | |
242 | ||
243 | //---------------------------------------------------------------------- | |
244 | ||
245 | class wxFontData : public wxObject { | |
246 | public: | |
247 | wxFontData(); | |
248 | ~wxFontData(); | |
249 | ||
250 | void EnableEffects(bool enable); | |
251 | bool GetAllowSymbols(); | |
252 | wxColour GetColour(); | |
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: | |
268 | wxFontDialog(wxWindow* parent, const wxFontData& data); | |
269 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
270 | ||
271 | wxFontData& GetFontData(); | |
272 | int ShowModal(); | |
273 | }; | |
274 | ||
275 | ||
276 | //---------------------------------------------------------------------- | |
277 | ||
278 | class wxMessageDialog : public wxDialog { | |
279 | public: | |
280 | wxMessageDialog(wxWindow* parent, | |
281 | const wxString& message, | |
282 | const wxString& caption = wxPyMessageBoxCaptionStr, | |
283 | long style = wxOK | wxCANCEL | wxCENTRE, | |
284 | const wxPoint& pos = wxDefaultPosition); | |
285 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
286 | ||
287 | int ShowModal(); | |
288 | }; | |
289 | ||
290 | //---------------------------------------------------------------------- | |
291 | ||
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 ); | |
299 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
300 | ||
301 | bool Update(int value, const wxString& newmsg = wxPyEmptyString); | |
302 | void Resume(); | |
303 | } | |
304 | ||
305 | //---------------------------------------------------------------------- | |
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)" | |
406 | %pragma(python) addtomethod = "wxPreFindReplaceDialog:val._setOORInfo(val)" | |
407 | ||
408 | const wxFindReplaceData *GetData(); | |
409 | void SetData(wxFindReplaceData *data); | |
410 | }; | |
411 | ||
412 | //---------------------------------------------------------------------- |