]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/cmndlgs.i
fixed bug with using wxCommandEvent::GetInt() instead of GetId()
[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 %}
22
23 //----------------------------------------------------------------------
24
25 %include typemaps.i
26 %include my_typemaps.i
27
28 // Import some definitions of other classes, etc.
29 %import _defs.i
30 %import misc.i
31 %import gdi.i
32 %import windows.i
33 %import frames.i
34
35 %pragma(python) code = "import wx"
36
37 //----------------------------------------------------------------------
38
39 class wxColourData : public wxObject {
40 public:
41 wxColourData();
42 ~wxColourData();
43
44 bool GetChooseFull();
45 wxColour GetColour();
46 wxColour GetCustomColour(int i);
47 void SetChooseFull(int flag);
48 void SetColour(const wxColour& colour);
49 void SetCustomColour(int i, const wxColour& colour);
50 };
51
52
53 class wxColourDialog : public wxDialog {
54 public:
55 wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
56
57 %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
58
59 wxColourData& GetColourData();
60 int ShowModal();
61 };
62
63
64 //----------------------------------------------------------------------
65
66 class wxDirDialog : public wxDialog {
67 public:
68 wxDirDialog(wxWindow* parent,
69 char* message = "Choose a directory",
70 char* defaultPath = "",
71 long style = 0,
72 const wxPoint& pos = wxDefaultPosition);
73
74 %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
75
76 wxString GetPath();
77 wxString GetMessage();
78 long GetStyle();
79 void SetMessage(const wxString& message);
80 void SetPath(const wxString& path);
81 int ShowModal();
82 };
83
84 //----------------------------------------------------------------------
85
86 class wxFileDialog : public wxDialog {
87 public:
88 wxFileDialog(wxWindow* parent,
89 char* message = "Choose a file",
90 char* defaultDir = "",
91 char* defaultFile = "",
92 char* wildcard = "*.*",
93 long style = 0,
94 const wxPoint& pos = wxDefaultPosition);
95
96 %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
97
98 wxString GetDirectory();
99 wxString GetFilename();
100 int GetFilterIndex();
101 wxString GetMessage();
102 wxString GetPath();
103 long GetStyle();
104 wxString GetWildcard();
105 void SetDirectory(const wxString& directory);
106 void SetFilename(const wxString& setfilename);
107 void SetFilterIndex(int filterIndex);
108 void SetMessage(const wxString& message);
109 void SetPath(const wxString& path);
110 void SetStyle(long style);
111 void SetWildcard(const wxString& wildCard);
112 int ShowModal();
113
114 %addmethods {
115 PyObject* GetFilenames() {
116 wxArrayString arr;
117 self->GetFilenames(arr);
118 size_t count = arr.GetCount();
119 PyObject* listObj = PyList_New(0);
120 for(size_t x=0; x<count; x++) {
121 PyObject* name = PyString_FromString(arr[x]);
122 PyList_Append(listObj, name);
123 }
124 return listObj;
125 }
126
127 PyObject* GetPaths() {
128 wxArrayString arr;
129 self->GetPaths(arr);
130 size_t count = arr.GetCount();
131 PyObject* listObj = PyList_New(0);
132 for(size_t x=0; x<count; x++) {
133 PyObject* name = PyString_FromString(arr[x]);
134 PyList_Append(listObj, name);
135 }
136 return listObj;
137 }
138 }
139 };
140
141
142 //----------------------------------------------------------------------
143
144 //TODO: wxMultipleChoiceDialog
145
146 //----------------------------------------------------------------------
147
148 class wxSingleChoiceDialog : public wxDialog {
149 public:
150 %addmethods {
151 // TODO: ignoring clientData for now...
152 // SWIG is messing up the &/*'s for some reason.
153 wxSingleChoiceDialog(wxWindow* parent,
154 wxString* message,
155 wxString* caption,
156 int LCOUNT, wxString* choices,
157 //char** clientData = NULL,
158 long style = wxOK | wxCANCEL | wxCENTRE,
159 wxPoint* pos = &wxDefaultPosition) {
160 return new wxSingleChoiceDialog(parent, *message, *caption,
161 LCOUNT, choices, NULL, style, *pos);
162 }
163 }
164
165 %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
166
167 int GetSelection();
168 wxString GetStringSelection();
169 void SetSelection(int sel);
170 int ShowModal();
171 };
172
173
174 //----------------------------------------------------------------------
175
176 class wxTextEntryDialog : public wxDialog {
177 public:
178 wxTextEntryDialog(wxWindow* parent,
179 char* message,
180 char* caption = "Input Text",
181 char* defaultValue = "",
182 long style = wxOK | wxCANCEL | wxCENTRE,
183 const wxPoint& pos = wxDefaultPosition);
184
185 %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
186
187 wxString GetValue();
188 void SetValue(const wxString& value);
189 int ShowModal();
190 };
191
192 //----------------------------------------------------------------------
193
194 class wxFontData : public wxObject {
195 public:
196 wxFontData();
197 ~wxFontData();
198
199 void EnableEffects(bool enable);
200 bool GetAllowSymbols();
201 wxColour GetColour();
202 wxFont GetChosenFont();
203 bool GetEnableEffects();
204 wxFont GetInitialFont();
205 bool GetShowHelp();
206 void SetAllowSymbols(bool allowSymbols);
207 void SetChosenFont(const wxFont& font);
208 void SetColour(const wxColour& colour);
209 void SetInitialFont(const wxFont& font);
210 void SetRange(int min, int max);
211 void SetShowHelp(bool showHelp);
212 };
213
214
215 class wxFontDialog : public wxDialog {
216 public:
217 wxFontDialog(wxWindow* parent, wxFontData* data);
218
219 %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
220
221 wxFontData& GetFontData();
222 int ShowModal();
223 };
224
225
226 //----------------------------------------------------------------------
227
228 class wxMessageDialog : public wxDialog {
229 public:
230 wxMessageDialog(wxWindow* parent,
231 char* message,
232 char* caption = "Message box",
233 long style = wxOK | wxCANCEL | wxCENTRE,
234 const wxPoint& pos = wxDefaultPosition);
235
236 %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)"
237
238 int ShowModal();
239 };
240
241 //----------------------------------------------------------------------
242
243 class wxProgressDialog : public wxFrame {
244 public:
245 wxProgressDialog(const wxString& title,
246 const wxString& message,
247 int maximum = 100,
248 wxWindow* parent = NULL,
249 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
250
251
252 bool Update(int value = -1, const char* newmsg = NULL);
253 void Resume();
254 }
255
256 //----------------------------------------------------------------------