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