]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/cmndlgs.i
wxUniversal fixes:
[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(FileSelectorDefaultWildcardStr);
45 DECLARE_DEF_STRING(GetTextFromUserPromptStr);
46 DECLARE_DEF_STRING(MessageBoxCaptionStr);
47 static const wxString wxPyEmptyString(wxT(""));
48
49 %}
50
51 //----------------------------------------------------------------------
52
53 class wxColourData : public wxObject {
54 public:
55 wxColourData();
56 ~wxColourData();
57
58 bool GetChooseFull();
59 wxColour GetColour();
60 wxColour GetCustomColour(int i);
61 void SetChooseFull(int flag);
62 void SetColour(const wxColour& colour);
63 void SetCustomColour(int i, const wxColour& colour);
64 };
65
66
67 class wxColourDialog : public wxDialog {
68 public:
69 wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
70
71 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
72
73 wxColourData& GetColourData();
74 int ShowModal();
75 };
76
77
78 //----------------------------------------------------------------------
79
80 class wxDirDialog : public wxDialog {
81 public:
82 wxDirDialog(wxWindow* parent,
83 const wxString& message = wxPyFileSelectorPromptStr,
84 const wxString& defaultPath = wxPyEmptyString,
85 long style = 0,
86 const wxPoint& pos = wxDefaultPosition);
87
88 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
89
90 wxString GetPath();
91 wxString GetMessage();
92 long GetStyle();
93 void SetMessage(const wxString& message);
94 void SetPath(const wxString& path);
95 int ShowModal();
96 };
97
98
99 //----------------------------------------------------------------------
100
101 class wxFileDialog : public wxDialog {
102 public:
103 wxFileDialog(wxWindow* parent,
104 const wxString& message = wxPyFileSelectorPromptStr,
105 const wxString& defaultDir = wxPyEmptyString,
106 const wxString& defaultFile = wxPyEmptyString,
107 const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
108 long style = 0,
109 const wxPoint& pos = wxDefaultPosition);
110
111 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
112
113 wxString GetDirectory();
114 wxString GetFilename();
115 int GetFilterIndex();
116 wxString GetMessage();
117 wxString GetPath();
118 long GetStyle();
119 wxString GetWildcard();
120 void SetDirectory(const wxString& directory);
121 void SetFilename(const wxString& setfilename);
122 void SetFilterIndex(int filterIndex);
123 void SetMessage(const wxString& message);
124 void SetPath(const wxString& path);
125 void SetStyle(long style);
126 void SetWildcard(const wxString& wildCard);
127 int ShowModal();
128
129 %addmethods {
130 PyObject* GetFilenames() {
131 wxArrayString arr;
132 self->GetFilenames(arr);
133 return wxArrayString2PyList_helper(arr);
134 }
135
136 PyObject* GetPaths() {
137 wxArrayString arr;
138 self->GetPaths(arr);
139 return wxArrayString2PyList_helper(arr);
140 }
141 }
142 };
143
144
145 //----------------------------------------------------------------------
146
147 enum { wxCHOICEDLG_STYLE };
148
149 class wxMultiChoiceDialog : public wxDialog
150 {
151 public:
152 wxMultiChoiceDialog(wxWindow *parent,
153 const wxString& message,
154 const wxString& caption,
155 int LCOUNT, wxString *choices,
156 long style = wxCHOICEDLG_STYLE,
157 const wxPoint& pos = wxDefaultPosition);
158
159 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
160
161 void SetSelections(const wxArrayInt& selections);
162
163 // wxArrayInt GetSelections() const;
164 %addmethods {
165 PyObject* GetSelections() {
166 return wxArrayInt2PyList_helper(self->GetSelections());
167 }
168 }
169 };
170
171
172 //----------------------------------------------------------------------
173
174 class wxSingleChoiceDialog : public wxDialog {
175 public:
176 %addmethods {
177 // TODO: ignoring clientData for now...
178 // SWIG is messing up the &/*'s for some reason.
179 wxSingleChoiceDialog(wxWindow* parent,
180 wxString* message,
181 wxString* caption,
182 int LCOUNT, wxString* choices,
183 //char** clientData = NULL,
184 long style = wxCHOICEDLG_STYLE,
185 wxPoint* pos = &wxDefaultPosition) {
186 return new wxSingleChoiceDialog(parent, *message, *caption,
187 LCOUNT, choices, NULL, style, *pos);
188 }
189 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
190
191 }
192
193 int GetSelection();
194 wxString GetStringSelection();
195 void SetSelection(int sel);
196 int ShowModal();
197 };
198
199
200 //----------------------------------------------------------------------
201
202 class wxTextEntryDialog : public wxDialog {
203 public:
204 wxTextEntryDialog(wxWindow* parent,
205 const wxString& message,
206 const wxString& caption = wxPyGetTextFromUserPromptStr,
207 const wxString& defaultValue = wxPyEmptyString,
208 long style = wxOK | wxCANCEL | wxCENTRE,
209 const wxPoint& pos = wxDefaultPosition);
210
211 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
212
213 wxString GetValue();
214 void SetValue(const wxString& value);
215 int ShowModal();
216 };
217
218 //----------------------------------------------------------------------
219
220 class wxFontData : public wxObject {
221 public:
222 wxFontData();
223 ~wxFontData();
224
225 void EnableEffects(bool enable);
226 bool GetAllowSymbols();
227 wxColour GetColour();
228 wxFont GetChosenFont();
229 bool GetEnableEffects();
230 wxFont GetInitialFont();
231 bool GetShowHelp();
232 void SetAllowSymbols(bool allowSymbols);
233 void SetChosenFont(const wxFont& font);
234 void SetColour(const wxColour& colour);
235 void SetInitialFont(const wxFont& font);
236 void SetRange(int min, int max);
237 void SetShowHelp(bool showHelp);
238 };
239
240
241 class wxFontDialog : public wxDialog {
242 public:
243 wxFontDialog(wxWindow* parent, wxFontData* data);
244 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
245
246 wxFontData& GetFontData();
247 int ShowModal();
248 };
249
250
251 //----------------------------------------------------------------------
252
253 class wxMessageDialog : public wxDialog {
254 public:
255 wxMessageDialog(wxWindow* parent,
256 const wxString& message,
257 const wxString& caption = wxPyMessageBoxCaptionStr,
258 long style = wxOK | wxCANCEL | wxCENTRE,
259 const wxPoint& pos = wxDefaultPosition);
260 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
261
262 int ShowModal();
263 };
264
265 //----------------------------------------------------------------------
266
267 class wxProgressDialog : public wxFrame {
268 public:
269 wxProgressDialog(const wxString& title,
270 const wxString& message,
271 int maximum = 100,
272 wxWindow* parent = NULL,
273 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
274 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
275
276 bool Update(int value, const wxString& newmsg = wxPyEmptyString);
277 void Resume();
278 }
279
280 //----------------------------------------------------------------------
281
282 enum wxFindReplaceFlags
283 {
284 // downward search/replace selected (otherwise - upwards)
285 wxFR_DOWN = 1,
286
287 // whole word search/replace selected
288 wxFR_WHOLEWORD = 2,
289
290 // case sensitive search/replace selected (otherwise - case insensitive)
291 wxFR_MATCHCASE = 4
292 };
293
294
295 enum wxFindReplaceDialogStyles
296 {
297 // replace dialog (otherwise find dialog)
298 wxFR_REPLACEDIALOG = 1,
299
300 // don't allow changing the search direction
301 wxFR_NOUPDOWN = 2,
302
303 // don't allow case sensitive searching
304 wxFR_NOMATCHCASE = 4,
305
306 // don't allow whole word searching
307 wxFR_NOWHOLEWORD = 8
308 };
309
310 enum {
311 wxEVT_COMMAND_FIND,
312 wxEVT_COMMAND_FIND_NEXT,
313 wxEVT_COMMAND_FIND_REPLACE,
314 wxEVT_COMMAND_FIND_REPLACE_ALL,
315 wxEVT_COMMAND_FIND_CLOSE,
316 };
317
318 %pragma(python) code = "
319
320 def EVT_COMMAND_FIND(win, id, func):
321 win.Connect(id, -1, wxEVT_COMMAND_FIND, func)
322
323 def EVT_COMMAND_FIND_NEXT(win, id, func):
324 win.Connect(id, -1, wxEVT_COMMAND_FIND_NEXT, func)
325
326 def EVT_COMMAND_FIND_REPLACE(win, id, func):
327 win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE, func)
328
329 def EVT_COMMAND_FIND_REPLACE_ALL(win, id, func):
330 win.Connect(id, -1, wxEVT_COMMAND_FIND_REPLACE_ALL, func)
331
332 def EVT_COMMAND_FIND_CLOSE(win, id, func):
333 win.Connect(id, -1, wxEVT_COMMAND_FIND_CLOSE, func)
334
335 "
336
337 class wxFindDialogEvent : public wxCommandEvent
338 {
339 public:
340 wxFindDialogEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
341 int GetFlags();
342 wxString GetFindString();
343 const wxString& GetReplaceString();
344 wxFindReplaceDialog *GetDialog();
345 void SetFlags(int flags);
346 void SetFindString(const wxString& str);
347 void SetReplaceString(const wxString& str);
348 };
349
350
351
352 class wxFindReplaceData : public wxObject
353 {
354 public:
355 wxFindReplaceData(int flags=0);
356 ~wxFindReplaceData();
357
358 const wxString& GetFindString();
359 const wxString& GetReplaceString();
360 int GetFlags();
361 void SetFlags(int flags);
362 void SetFindString(const wxString& str);
363 void SetReplaceString(const wxString& str);
364 };
365
366
367 class wxFindReplaceDialog : public wxDialog {
368 public:
369 wxFindReplaceDialog(wxWindow *parent,
370 wxFindReplaceData *data,
371 const wxString &title,
372 int style = 0);
373 %name(wxPreFindReplaceDialog)wxFindReplaceDialog();
374
375 bool Create(wxWindow *parent,
376 wxFindReplaceData *data,
377 const wxString &title,
378 int style = 0);
379
380 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
381 %pragma(python) addtomethod = "wxPreFindReplaceDialog:val._setOORInfo(val)"
382
383 const wxFindReplaceData *GetData();
384 void SetData(wxFindReplaceData *data);
385 };
386
387 //----------------------------------------------------------------------