]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
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 | ||
03e9bead | 13 | %module cmndlgs |
7bf85405 | 14 | |
03e9bead | 15 | %{ |
7bf85405 RD |
16 | #include "helpers.h" |
17 | #include <wx/colordlg.h> | |
18 | #include <wx/dirdlg.h> | |
19 | #include <wx/fontdlg.h> | |
bb0054cd | 20 | #include <wx/progdlg.h> |
7bf85405 RD |
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 | |
bb0054cd | 33 | %import frames.i |
7bf85405 | 34 | |
b8b8dda7 | 35 | %pragma(python) code = "import wx" |
7bf85405 RD |
36 | |
37 | //---------------------------------------------------------------------- | |
38 | ||
39 | class wxColourData { | |
40 | public: | |
41 | wxColourData(); | |
42 | ~wxColourData(); | |
43 | ||
44 | bool GetChooseFull(); | |
45 | wxColour& GetColour(); | |
fb5e0af0 | 46 | wxColour GetCustomColour(int i); |
7bf85405 RD |
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 | ||
f6bcfd97 | 57 | %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" |
9c039d08 | 58 | |
7bf85405 RD |
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 = wxPyDefaultPosition); | |
73 | ||
f6bcfd97 | 74 | %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" |
9c039d08 | 75 | |
7bf85405 RD |
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 = wxPyDefaultPosition); | |
95 | ||
f6bcfd97 | 96 | %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" |
9c039d08 | 97 | |
7bf85405 RD |
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(); | |
f6bcfd97 BP |
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 | } | |
7bf85405 RD |
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, | |
eec92d76 | 156 | int LCOUNT, wxString* choices, |
7bf85405 RD |
157 | //char** clientData = NULL, |
158 | long style = wxOK | wxCANCEL | wxCENTRE, | |
159 | wxPoint* pos = &wxPyDefaultPosition) { | |
160 | return new wxSingleChoiceDialog(parent, *message, *caption, | |
eec92d76 | 161 | LCOUNT, choices, NULL, style, *pos); |
7bf85405 RD |
162 | } |
163 | } | |
164 | ||
f6bcfd97 | 165 | %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" |
9c039d08 | 166 | |
7bf85405 RD |
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 = wxPyDefaultPosition); | |
184 | ||
f6bcfd97 | 185 | %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" |
9c039d08 | 186 | |
7bf85405 RD |
187 | wxString GetValue(); |
188 | void SetValue(const wxString& value); | |
189 | int ShowModal(); | |
190 | }; | |
191 | ||
192 | //---------------------------------------------------------------------- | |
193 | ||
194 | class wxFontData { | |
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: | |
0c3d4bfd | 217 | wxFontDialog(wxWindow* parent, wxFontData* data); |
7bf85405 | 218 | |
f6bcfd97 | 219 | %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" |
9c039d08 | 220 | |
7bf85405 RD |
221 | wxFontData& GetFontData(); |
222 | int ShowModal(); | |
223 | }; | |
224 | ||
225 | ||
7bf85405 RD |
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 = wxPyDefaultPosition); | |
235 | ||
f6bcfd97 | 236 | %pragma(python) addtomethod = "__init__:#wx._StdDialogCallbacks(self)" |
9c039d08 | 237 | |
7bf85405 RD |
238 | int ShowModal(); |
239 | }; | |
240 | ||
241 | //---------------------------------------------------------------------- | |
242 | ||
bb0054cd RD |
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 ); | |
7bf85405 | 250 | |
7bf85405 | 251 | |
bb0054cd RD |
252 | bool Update(int value = -1, const char* newmsg = NULL); |
253 | void Resume(); | |
254 | } | |
255 | ||
256 | //---------------------------------------------------------------------- |