]>
Commit | Line | Data |
---|---|---|
7bf85405 | 1 | ///////////////////////////////////////////////////////////////////////////// |
1e4a197e | 2 | // Name: wx.i |
7bf85405 RD |
3 | // Purpose: SWIG interface file for a python wxWindows module |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 5/22/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
b8b8dda7 | 13 | %module wx |
03e9bead | 14 | |
203c2f9a | 15 | |
03e9bead | 16 | %{ |
7bf85405 RD |
17 | #include "helpers.h" |
18 | %} | |
19 | ||
20 | //---------------------------------------------------------------------- | |
21 | // This is where we include the other wrapper definition files for SWIG | |
22 | //---------------------------------------------------------------------- | |
23 | ||
24 | %include typemaps.i | |
25 | %include my_typemaps.i | |
26 | %include _defs.i | |
27 | ||
8bf5d46e RD |
28 | %include pointer.i |
29 | ||
7bf85405 | 30 | %import misc.i |
bb0054cd | 31 | %import misc2.i |
7bf85405 RD |
32 | %import windows.i |
33 | %import events.i | |
34 | %import gdi.i | |
35 | %import mdi.i | |
36 | %import controls.i | |
37 | %import controls2.i | |
38 | %import windows2.i | |
39 | %import cmndlgs.i | |
9c039d08 RD |
40 | %import stattool.i |
41 | %import frames.i | |
08127323 | 42 | %import windows3.i |
cf694132 | 43 | %import image.i |
bb0054cd | 44 | %import printfw.i |
2f90df85 | 45 | %import sizers.i |
c368d904 RD |
46 | %import streams.i |
47 | %import filesys.i | |
96e5ef76 | 48 | %import utils.i |
68bc8549 RD |
49 | %import fonts.i |
50 | ||
7bf85405 RD |
51 | |
52 | %native(_wxStart) __wxStart; | |
53 | %native(_wxSetDictionary) __wxSetDictionary; | |
54 | ||
55 | //--------------------------------------------------------------------------- | |
56 | ||
35d60de2 | 57 | %readonly |
b68dc582 RD |
58 | wxPoint wxDefaultPosition; |
59 | wxSize wxDefaultSize; | |
35d60de2 | 60 | %readwrite |
7bf85405 RD |
61 | |
62 | //--------------------------------------------------------------------------- | |
63 | //--------------------------------------------------------------------------- | |
64 | ||
1e4a197e RD |
65 | enum { |
66 | wxPYAPP_ASSERT_SUPPRESS = 1, | |
67 | wxPYAPP_ASSERT_EXCEPTION = 2, | |
68 | wxPYAPP_ASSERT_DIALOG = 4, | |
69 | wxPYAPP_ASSERT_LOG = 8 | |
70 | }; | |
71 | ||
72 | ||
7bf85405 RD |
73 | class wxPyApp : public wxEvtHandler { |
74 | public: | |
75 | %addmethods { | |
76 | wxPyApp() { | |
77 | wxPythonApp = new wxPyApp(); | |
78 | return wxPythonApp; | |
79 | } | |
80 | } | |
81 | ||
8bf5d46e | 82 | ~wxPyApp(); |
7bf85405 | 83 | |
1e4a197e RD |
84 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
85 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyApp)" | |
86 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
87 | ||
88 | ||
7bf85405 | 89 | wxString GetAppName(); |
853b255a | 90 | #ifdef __WXMSW__ |
7bf85405 | 91 | bool GetAuto3D(); |
853b255a | 92 | #endif |
7bf85405 RD |
93 | wxString GetClassName(); |
94 | bool GetExitOnFrameDelete(); | |
95 | int GetPrintMode(); | |
96 | wxWindow * GetTopWindow(); | |
97 | wxString GetVendorName(); | |
f6bcfd97 | 98 | bool GetUseBestVisual(); |
7bf85405 RD |
99 | |
100 | void Dispatch(); | |
101 | void ExitMainLoop(); | |
102 | bool Initialized(); | |
103 | int MainLoop(); | |
104 | bool Pending(); | |
8bf5d46e | 105 | bool ProcessIdle(); |
fd512ba2 | 106 | bool Yield(bool onlyIfNeeded = FALSE); |
7bf85405 RD |
107 | |
108 | void SetAppName(const wxString& name); | |
853b255a | 109 | #ifdef __WXMSW__ |
7bf85405 | 110 | void SetAuto3D(bool auto3D); |
853b255a | 111 | #endif |
7bf85405 RD |
112 | void SetClassName(const wxString& name); |
113 | void SetExitOnFrameDelete(bool flag); | |
114 | void SetPrintMode(int mode); | |
115 | void SetTopWindow(wxWindow* window); | |
116 | void SetVendorName(const wxString& name); | |
f6bcfd97 | 117 | void SetUseBestVisual(bool flag); |
1e4a197e RD |
118 | |
119 | int GetAssertMode(); | |
120 | void SetAssertMode(int mode); | |
121 | ||
122 | ||
123 | static bool GetMacDefaultEncodingIsPC(); | |
124 | static bool GetMacSupportPCMenuShortcuts(); | |
125 | static long GetMacAboutMenuItemId(); | |
126 | static long GetMacPreferencesMenuItemId(); | |
127 | static long GetMacExitMenuItemId(); | |
128 | static wxString GetMacHelpMenuTitleName(); | |
129 | ||
130 | static void SetMacDefaultEncodingIsPC(bool val); | |
131 | static void SetMacSupportPCMenuShortcuts(bool val); | |
132 | static void SetMacAboutMenuItemId(long val); | |
133 | static void SetMacPreferencesMenuItemId(long val); | |
134 | static void SetMacExitMenuItemId(long val); | |
135 | static void SetMacHelpMenuTitleName(const wxString& val); | |
8bf5d46e RD |
136 | }; |
137 | ||
c368d904 RD |
138 | %inline %{ |
139 | wxPyApp* wxGetApp() { | |
19e30148 | 140 | //return wxPythonApp; |
a2426843 | 141 | return (wxPyApp*)wxTheApp; |
c368d904 RD |
142 | } |
143 | %} | |
8bf5d46e | 144 | |
c5943253 | 145 | |
8bf5d46e | 146 | //---------------------------------------------------------------------- |
b1462dfa | 147 | // this is used to cleanup after wxWindows when Python shuts down. |
8bf5d46e | 148 | |
b1462dfa RD |
149 | %inline %{ |
150 | void wxApp_CleanUp() { | |
7ff49f0c | 151 | __wxCleanup(); |
b1462dfa | 152 | } |
8bf5d46e RD |
153 | %} |
154 | ||
7bf85405 RD |
155 | //---------------------------------------------------------------------- |
156 | // This code gets added to the module initialization function | |
157 | //---------------------------------------------------------------------- | |
158 | ||
159 | %{ | |
1e7ecb7b RD |
160 | |
161 | ||
1d99702e RD |
162 | extern "C" SWIGEXPORT(void) initwindowsc(); |
163 | extern "C" SWIGEXPORT(void) initwindows2c(); | |
164 | extern "C" SWIGEXPORT(void) initeventsc(); | |
165 | extern "C" SWIGEXPORT(void) initmiscc(); | |
166 | extern "C" SWIGEXPORT(void) initmisc2c(); | |
167 | extern "C" SWIGEXPORT(void) initgdic(); | |
168 | extern "C" SWIGEXPORT(void) initmdic(); | |
169 | extern "C" SWIGEXPORT(void) initcontrolsc(); | |
170 | extern "C" SWIGEXPORT(void) initcontrols2c(); | |
171 | extern "C" SWIGEXPORT(void) initcmndlgsc(); | |
172 | extern "C" SWIGEXPORT(void) initstattoolc(); | |
173 | extern "C" SWIGEXPORT(void) initframesc(); | |
174 | extern "C" SWIGEXPORT(void) initwindows3c(); | |
175 | extern "C" SWIGEXPORT(void) initimagec(); | |
176 | extern "C" SWIGEXPORT(void) initprintfwc(); | |
2f90df85 | 177 | extern "C" SWIGEXPORT(void) initsizersc(); |
b1462dfa | 178 | extern "C" SWIGEXPORT(void) initclip_dndc(); |
c368d904 RD |
179 | extern "C" SWIGEXPORT(void) initstreamsc(); |
180 | extern "C" SWIGEXPORT(void) initfilesysc(); | |
96e5ef76 | 181 | extern "C" SWIGEXPORT(void) initutilsc(); |
68bc8549 | 182 | extern "C" SWIGEXPORT(void) initfontsc(); |
c368d904 | 183 | |
1e7ecb7b RD |
184 | |
185 | ||
186 | // Export a C API in a struct. Other modules will be able to load this from | |
187 | // the wxc module and will then have safe access to these functions, even if | |
188 | // in another shared library. | |
189 | static wxPyCoreAPI API = { | |
bc5f2236 RD |
190 | (p_SWIG_MakePtr_t)SWIG_MakePtr, |
191 | (p_SWIG_GetPtr_t)SWIG_GetPtr, | |
192 | (p_SWIG_GetPtrObj_t)SWIG_GetPtrObj, | |
193 | (p_SWIG_RegisterMapping_t)SWIG_RegisterMapping, | |
194 | (p_SWIG_addvarlink_t)SWIG_addvarlink, | |
195 | (p_SWIG_newvarlink_t)SWIG_newvarlink, | |
1e7ecb7b | 196 | |
4268f798 RD |
197 | wxPyBeginAllowThreads, |
198 | wxPyEndAllowThreads, | |
19a97bd6 RD |
199 | wxPyBeginBlockThreads, |
200 | wxPyEndBlockThreads, | |
201 | ||
1e7ecb7b RD |
202 | wxPyConstructObject, |
203 | wxPy_ConvertList, | |
204 | ||
c8bc7bb8 | 205 | wxString_in_helper, |
a541c325 RD |
206 | Py2wxString, |
207 | wx2PyString, | |
208 | ||
1e7ecb7b RD |
209 | byte_LIST_helper, |
210 | int_LIST_helper, | |
211 | long_LIST_helper, | |
212 | string_LIST_helper, | |
213 | wxPoint_LIST_helper, | |
214 | wxBitmap_LIST_helper, | |
215 | wxString_LIST_helper, | |
216 | wxAcceleratorEntry_LIST_helper, | |
217 | ||
218 | wxSize_helper, | |
219 | wxPoint_helper, | |
220 | wxRealPoint_helper, | |
221 | wxRect_helper, | |
222 | wxColour_helper, | |
1e4a197e | 223 | wxPoint2DDouble_helper, |
1e7ecb7b | 224 | |
0122b7e3 | 225 | wxPyCBH_setCallbackInfo, |
1e7ecb7b RD |
226 | wxPyCBH_findCallback, |
227 | wxPyCBH_callCallback, | |
228 | wxPyCBH_callCallbackObj, | |
229 | wxPyCBH_delete, | |
9416aa89 RD |
230 | |
231 | wxPyClassExists, | |
232 | wxPyMake_wxObject, | |
2f4e9287 | 233 | wxPyMake_wxSizer, |
9416aa89 | 234 | wxPyPtrTypeMap_Add, |
293a0a86 | 235 | wxArrayString2PyList_helper, |
4acff284 RD |
236 | wxArrayInt2PyList_helper, |
237 | ||
238 | wxPyClientData_dtor, | |
239 | wxPyUserData_dtor, | |
249a57f4 RD |
240 | wxPyOORClientData_dtor, |
241 | ||
242 | wxPyCBInputStream_create | |
1e7ecb7b RD |
243 | }; |
244 | ||
9416aa89 | 245 | |
0699c864 | 246 | %} |
08127323 | 247 | |
7bf85405 | 248 | |
7bf85405 RD |
249 | |
250 | %init %{ | |
1e7ecb7b RD |
251 | // Make our API structure a CObject so other modules can import it |
252 | // from this module. | |
253 | PyObject* v = PyCObject_FromVoidPtr(&API, NULL); | |
254 | PyDict_SetItemString(d,"wxPyCoreAPI", v); | |
255 | Py_XDECREF(v); | |
256 | ||
7bf85405 | 257 | |
1e4a197e | 258 | __wxPreStart(d); // initialize the GUI toolkit, if needed. |
7bf85405 | 259 | |
7bf85405 RD |
260 | |
261 | // Since these modules are all linked together, initialize them now | |
f6bcfd97 | 262 | // because Python won't be able to find their shared library files, |
7bf85405 RD |
263 | // (since there isn't any.) |
264 | initwindowsc(); | |
265 | initwindows2c(); | |
266 | initeventsc(); | |
267 | initmiscc(); | |
bb0054cd | 268 | initmisc2c(); |
7bf85405 RD |
269 | initgdic(); |
270 | initmdic(); | |
271 | initcontrolsc(); | |
272 | initcontrols2c(); | |
273 | initcmndlgsc(); | |
9c039d08 RD |
274 | initstattoolc(); |
275 | initframesc(); | |
08127323 | 276 | initwindows3c(); |
cf694132 | 277 | initimagec(); |
bb0054cd | 278 | initprintfwc(); |
2f90df85 | 279 | initsizersc(); |
b1462dfa | 280 | initclip_dndc(); |
c368d904 RD |
281 | initstreamsc(); |
282 | initfilesysc(); | |
96e5ef76 | 283 | initutilsc(); |
68bc8549 | 284 | initfontsc(); |
f6bcfd97 | 285 | |
a3fbed81 | 286 | |
1fded56b RD |
287 | // Although these are redfined in __version__ they need to be here too so |
288 | // that an assert can be done to ensure that the wxPython and the wxWindows | |
289 | // versions match. | |
a3fbed81 RD |
290 | PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION )); |
291 | PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION )); | |
1fded56b | 292 | PyDict_SetItemString(d,"wxRELEASE_VERSION", PyInt_FromLong((long)wxRELEASE_NUMBER )); |
a3fbed81 | 293 | |
7bf85405 RD |
294 | %} |
295 | ||
296 | //---------------------------------------------------------------------- | |
297 | // And this gets appended to the shadow class file. | |
298 | //---------------------------------------------------------------------- | |
299 | ||
300 | %pragma(python) include="_extras.py"; | |
301 | ||
1e4a197e | 302 |