]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/cmndlgs.i
compilation error fix (trailing comma in an enum)
[wxWidgets.git] / wxPython / src / cmndlgs.i
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 wxString GetDirectory();
118 wxString GetFilename();
119 int GetFilterIndex();
120 wxString GetMessage();
121 wxString GetPath();
122 long GetStyle();
123 wxString GetWildcard();
124 void SetDirectory(const wxString& directory);
125 void SetFilename(const wxString& setfilename);
126 void SetFilterIndex(int filterIndex);
127 void SetMessage(const wxString& message);
128 void SetPath(const wxString& path);
129 void SetStyle(long style);
130 void SetWildcard(const wxString& wildCard);
131 int ShowModal();
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
148
149 //----------------------------------------------------------------------
150
151 enum { wxCHOICEDLG_STYLE };
152
153 class wxMultiChoiceDialog : public wxDialog
154 {
155 public:
156 wxMultiChoiceDialog(wxWindow *parent,
157 const wxString& message,
158 const wxString& caption,
159 int LCOUNT, wxString *choices,
160 long style = wxCHOICEDLG_STYLE,
161 const wxPoint& pos = wxDefaultPosition);
162
163 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
164
165 void SetSelections(const wxArrayInt& selections);
166
167 // wxArrayInt GetSelections() const;
168 %addmethods {
169 PyObject* GetSelections() {
170 return wxArrayInt2PyList_helper(self->GetSelections());
171 }
172 }
173 };
174
175
176 //----------------------------------------------------------------------
177
178 class wxSingleChoiceDialog : public wxDialog {
179 public:
180 %addmethods {
181 // TODO: ignoring clientData for now...
182 // SWIG is messing up the &/*'s for some reason.
183 wxSingleChoiceDialog(wxWindow* parent,
184 wxString* message,
185 wxString* caption,
186 int LCOUNT, wxString* choices,
187 //char** clientData = NULL,
188 long style = wxCHOICEDLG_STYLE,
189 wxPoint* pos = &wxDefaultPosition) {
190 return new wxSingleChoiceDialog(parent, *message, *caption,
191 LCOUNT, choices, NULL, style, *pos);
192 }
193 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
194
195 }
196
197 int GetSelection();
198 wxString GetStringSelection();
199 void SetSelection(int sel);
200 int ShowModal();
201 };
202
203
204 //----------------------------------------------------------------------
205
206 class wxTextEntryDialog : public wxDialog {
207 public:
208 wxTextEntryDialog(wxWindow* parent,
209 const wxString& message,
210 const wxString& caption = wxPyGetTextFromUserPromptStr,
211 const wxString& defaultValue = wxPyEmptyString,
212 long style = wxOK | wxCANCEL | wxCENTRE,
213 const wxPoint& pos = wxDefaultPosition);
214
215 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
216
217 wxString GetValue();
218 void SetValue(const wxString& value);
219 int ShowModal();
220 };
221
222 //----------------------------------------------------------------------
223
224 class wxFontData : public wxObject {
225 public:
226 wxFontData();
227 ~wxFontData();
228
229 void EnableEffects(bool enable);
230 bool GetAllowSymbols();
231 wxColour GetColour();
232 wxFont GetChosenFont();
233 bool GetEnableEffects();
234 wxFont GetInitialFont();
235 bool GetShowHelp();
236 void SetAllowSymbols(bool allowSymbols);
237 void SetChosenFont(const wxFont& font);
238 void SetColour(const wxColour& colour);
239 void SetInitialFont(const wxFont& font);
240 void SetRange(int min, int max);
241 void SetShowHelp(bool showHelp);
242 };
243
244
245 class wxFontDialog : public wxDialog {
246 public:
247 wxFontDialog(wxWindow* parent, const wxFontData& data);
248 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
249
250 wxFontData& GetFontData();
251 int ShowModal();
252 };
253
254
255 //----------------------------------------------------------------------
256
257 class wxMessageDialog : public wxDialog {
258 public:
259 wxMessageDialog(wxWindow* parent,
260 const wxString& message,
261 const wxString& caption = wxPyMessageBoxCaptionStr,
262 long style = wxOK | wxCANCEL | wxCENTRE,
263 const wxPoint& pos = wxDefaultPosition);
264 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
265
266 int ShowModal();
267 };
268
269 //----------------------------------------------------------------------
270
271 class wxProgressDialog : public wxFrame {
272 public:
273 wxProgressDialog(const wxString& title,
274 const wxString& message,
275 int maximum = 100,
276 wxWindow* parent = NULL,
277 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
278 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
279
280 bool Update(int value, const wxString& newmsg = wxPyEmptyString);
281 void Resume();
282 }
283
284 //----------------------------------------------------------------------
285
286 enum wxFindReplaceFlags
287 {
288 // downward search/replace selected (otherwise - upwards)
289 wxFR_DOWN = 1,
290
291 // whole word search/replace selected
292 wxFR_WHOLEWORD = 2,
293
294 // case sensitive search/replace selected (otherwise - case insensitive)
295 wxFR_MATCHCASE = 4
296 };
297
298
299 enum wxFindReplaceDialogStyles
300 {
301 // replace dialog (otherwise find dialog)
302 wxFR_REPLACEDIALOG = 1,
303
304 // don't allow changing the search direction
305 wxFR_NOUPDOWN = 2,
306
307 // don't allow case sensitive searching
308 wxFR_NOMATCHCASE = 4,
309
310 // don't allow whole word searching
311 wxFR_NOWHOLEWORD = 8
312 };
313
314 enum {
315 wxEVT_COMMAND_FIND,
316 wxEVT_COMMAND_FIND_NEXT,
317 wxEVT_COMMAND_FIND_REPLACE,
318 wxEVT_COMMAND_FIND_REPLACE_ALL,
319 wxEVT_COMMAND_FIND_CLOSE,
320 };
321
322 %pragma(python) code = "
323
324 def EVT_COMMAND_FIND(win, id, func):
325 win.Connect(id, -1, wxEVT_COMMAND_FIND, func)
326
327 def EVT_COMMAND_FIND_NEXT(win, id, func):
328 win.Connect(id, -1, wxEVT_COMMAND_FIND_NEXT, func)
329
330 def EVT_COMMAND_FIND_REPLACE(win, id, func):
331 win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE, func)
332
333 def EVT_COMMAND_FIND_REPLACE_ALL(win, id, func):
334 win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE_ALL, func)
335
336 def EVT_COMMAND_FIND_CLOSE(win, id, func):
337 win.Connect(id, -1, wxEVT_COMMAND_FIND_CLOSE, func)
338
339 "
340
341 class wxFindDialogEvent : public wxCommandEvent
342 {
343 public:
344 wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
345 int GetFlags();
346 wxString GetFindString();
347 const wxString& GetReplaceString();
348 wxFindReplaceDialog *GetDialog();
349 void SetFlags(int flags);
350 void SetFindString(const wxString& str);
351 void SetReplaceString(const wxString& str);
352 };
353
354
355
356 class wxFindReplaceData : public wxObject
357 {
358 public:
359 wxFindReplaceData(int flags=0);
360 ~wxFindReplaceData();
361
362 const wxString& GetFindString();
363 const wxString& GetReplaceString();
364 int GetFlags();
365 void SetFlags(int flags);
366 void SetFindString(const wxString& str);
367 void SetReplaceString(const wxString& str);
368 };
369
370
371 class wxFindReplaceDialog : public wxDialog {
372 public:
373 wxFindReplaceDialog(wxWindow *parent,
374 wxFindReplaceData *data,
375 const wxString &title,
376 int style = 0);
377 %name(wxPreFindReplaceDialog)wxFindReplaceDialog();
378
379 bool Create(wxWindow *parent,
380 wxFindReplaceData *data,
381 const wxString &title,
382 int style = 0);
383
384 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
385 %pragma(python) addtomethod = "wxPreFindReplaceDialog:val._setOORInfo(val)"
386
387 const wxFindReplaceData *GetData();
388 void SetData(wxFindReplaceData *data);
389 };
390
391 //----------------------------------------------------------------------