]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wxp.i | |
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 | ||
2f90df85 | 57 | |
de20db99 | 58 | #define __version__ "0.0.0" // The real value is now in setup.py... |
7bf85405 | 59 | |
35d60de2 | 60 | %readonly |
b68dc582 RD |
61 | wxPoint wxDefaultPosition; |
62 | wxSize wxDefaultSize; | |
35d60de2 | 63 | %readwrite |
7bf85405 RD |
64 | |
65 | //--------------------------------------------------------------------------- | |
66 | //--------------------------------------------------------------------------- | |
67 | ||
68 | class wxPyApp : public wxEvtHandler { | |
69 | public: | |
70 | %addmethods { | |
71 | wxPyApp() { | |
72 | wxPythonApp = new wxPyApp(); | |
73 | return wxPythonApp; | |
74 | } | |
75 | } | |
76 | ||
8bf5d46e | 77 | ~wxPyApp(); |
7bf85405 RD |
78 | |
79 | wxString GetAppName(); | |
853b255a | 80 | #ifdef __WXMSW__ |
7bf85405 | 81 | bool GetAuto3D(); |
853b255a | 82 | #endif |
7bf85405 RD |
83 | wxString GetClassName(); |
84 | bool GetExitOnFrameDelete(); | |
85 | int GetPrintMode(); | |
86 | wxWindow * GetTopWindow(); | |
87 | wxString GetVendorName(); | |
f6bcfd97 | 88 | bool GetUseBestVisual(); |
7bf85405 RD |
89 | |
90 | void Dispatch(); | |
91 | void ExitMainLoop(); | |
92 | bool Initialized(); | |
93 | int MainLoop(); | |
94 | bool Pending(); | |
8bf5d46e | 95 | bool ProcessIdle(); |
7bf85405 RD |
96 | |
97 | void SetAppName(const wxString& name); | |
853b255a | 98 | #ifdef __WXMSW__ |
7bf85405 | 99 | void SetAuto3D(bool auto3D); |
853b255a | 100 | #endif |
7bf85405 RD |
101 | void SetClassName(const wxString& name); |
102 | void SetExitOnFrameDelete(bool flag); | |
103 | void SetPrintMode(int mode); | |
104 | void SetTopWindow(wxWindow* window); | |
105 | void SetVendorName(const wxString& name); | |
f6bcfd97 | 106 | void SetUseBestVisual(bool flag); |
8bf5d46e RD |
107 | }; |
108 | ||
c368d904 RD |
109 | %inline %{ |
110 | wxPyApp* wxGetApp() { | |
19e30148 | 111 | //return wxPythonApp; |
a2426843 | 112 | return (wxPyApp*)wxTheApp; |
c368d904 RD |
113 | } |
114 | %} | |
8bf5d46e | 115 | |
c5943253 | 116 | |
8bf5d46e | 117 | //---------------------------------------------------------------------- |
b1462dfa | 118 | // this is used to cleanup after wxWindows when Python shuts down. |
8bf5d46e | 119 | |
b1462dfa RD |
120 | %inline %{ |
121 | void wxApp_CleanUp() { | |
7ff49f0c | 122 | __wxCleanup(); |
b1462dfa | 123 | } |
8bf5d46e RD |
124 | %} |
125 | ||
7bf85405 RD |
126 | //---------------------------------------------------------------------- |
127 | // This code gets added to the module initialization function | |
128 | //---------------------------------------------------------------------- | |
129 | ||
130 | %{ | |
1e7ecb7b RD |
131 | |
132 | ||
1d99702e RD |
133 | extern "C" SWIGEXPORT(void) initwindowsc(); |
134 | extern "C" SWIGEXPORT(void) initwindows2c(); | |
135 | extern "C" SWIGEXPORT(void) initeventsc(); | |
136 | extern "C" SWIGEXPORT(void) initmiscc(); | |
137 | extern "C" SWIGEXPORT(void) initmisc2c(); | |
138 | extern "C" SWIGEXPORT(void) initgdic(); | |
139 | extern "C" SWIGEXPORT(void) initmdic(); | |
140 | extern "C" SWIGEXPORT(void) initcontrolsc(); | |
141 | extern "C" SWIGEXPORT(void) initcontrols2c(); | |
142 | extern "C" SWIGEXPORT(void) initcmndlgsc(); | |
143 | extern "C" SWIGEXPORT(void) initstattoolc(); | |
144 | extern "C" SWIGEXPORT(void) initframesc(); | |
145 | extern "C" SWIGEXPORT(void) initwindows3c(); | |
146 | extern "C" SWIGEXPORT(void) initimagec(); | |
147 | extern "C" SWIGEXPORT(void) initprintfwc(); | |
2f90df85 | 148 | extern "C" SWIGEXPORT(void) initsizersc(); |
b1462dfa | 149 | extern "C" SWIGEXPORT(void) initclip_dndc(); |
c368d904 RD |
150 | extern "C" SWIGEXPORT(void) initstreamsc(); |
151 | extern "C" SWIGEXPORT(void) initfilesysc(); | |
96e5ef76 | 152 | extern "C" SWIGEXPORT(void) initutilsc(); |
68bc8549 | 153 | extern "C" SWIGEXPORT(void) initfontsc(); |
c368d904 | 154 | |
1e7ecb7b RD |
155 | |
156 | ||
157 | // Export a C API in a struct. Other modules will be able to load this from | |
158 | // the wxc module and will then have safe access to these functions, even if | |
159 | // in another shared library. | |
160 | static wxPyCoreAPI API = { | |
bc5f2236 RD |
161 | (p_SWIG_MakePtr_t)SWIG_MakePtr, |
162 | (p_SWIG_GetPtr_t)SWIG_GetPtr, | |
163 | (p_SWIG_GetPtrObj_t)SWIG_GetPtrObj, | |
164 | (p_SWIG_RegisterMapping_t)SWIG_RegisterMapping, | |
165 | (p_SWIG_addvarlink_t)SWIG_addvarlink, | |
166 | (p_SWIG_newvarlink_t)SWIG_newvarlink, | |
1e7ecb7b | 167 | |
4268f798 RD |
168 | wxPyBeginAllowThreads, |
169 | wxPyEndAllowThreads, | |
19a97bd6 RD |
170 | wxPyBeginBlockThreads, |
171 | wxPyEndBlockThreads, | |
172 | ||
1e7ecb7b RD |
173 | wxPyConstructObject, |
174 | wxPy_ConvertList, | |
175 | ||
c8bc7bb8 | 176 | wxString_in_helper, |
a541c325 RD |
177 | Py2wxString, |
178 | wx2PyString, | |
179 | ||
1e7ecb7b RD |
180 | byte_LIST_helper, |
181 | int_LIST_helper, | |
182 | long_LIST_helper, | |
183 | string_LIST_helper, | |
184 | wxPoint_LIST_helper, | |
185 | wxBitmap_LIST_helper, | |
186 | wxString_LIST_helper, | |
187 | wxAcceleratorEntry_LIST_helper, | |
188 | ||
189 | wxSize_helper, | |
190 | wxPoint_helper, | |
191 | wxRealPoint_helper, | |
192 | wxRect_helper, | |
193 | wxColour_helper, | |
194 | ||
0122b7e3 | 195 | wxPyCBH_setCallbackInfo, |
1e7ecb7b RD |
196 | wxPyCBH_findCallback, |
197 | wxPyCBH_callCallback, | |
198 | wxPyCBH_callCallbackObj, | |
199 | wxPyCBH_delete, | |
9416aa89 RD |
200 | |
201 | wxPyClassExists, | |
202 | wxPyMake_wxObject, | |
2f4e9287 | 203 | wxPyMake_wxSizer, |
9416aa89 | 204 | wxPyPtrTypeMap_Add, |
293a0a86 | 205 | wxArrayString2PyList_helper, |
4acff284 RD |
206 | wxArrayInt2PyList_helper, |
207 | ||
208 | wxPyClientData_dtor, | |
209 | wxPyUserData_dtor, | |
249a57f4 RD |
210 | wxPyOORClientData_dtor, |
211 | ||
212 | wxPyCBInputStream_create | |
1e7ecb7b RD |
213 | }; |
214 | ||
9416aa89 | 215 | |
0699c864 | 216 | %} |
08127323 | 217 | |
7bf85405 | 218 | |
7bf85405 RD |
219 | |
220 | %init %{ | |
1e7ecb7b RD |
221 | // Make our API structure a CObject so other modules can import it |
222 | // from this module. | |
223 | PyObject* v = PyCObject_FromVoidPtr(&API, NULL); | |
224 | PyDict_SetItemString(d,"wxPyCoreAPI", v); | |
225 | Py_XDECREF(v); | |
226 | ||
7bf85405 | 227 | |
0d6f9504 | 228 | __wxPreStart(); // initialize the GUI toolkit, if needed. |
7bf85405 | 229 | |
7bf85405 RD |
230 | |
231 | // Since these modules are all linked together, initialize them now | |
f6bcfd97 | 232 | // because Python won't be able to find their shared library files, |
7bf85405 RD |
233 | // (since there isn't any.) |
234 | initwindowsc(); | |
235 | initwindows2c(); | |
236 | initeventsc(); | |
237 | initmiscc(); | |
bb0054cd | 238 | initmisc2c(); |
7bf85405 RD |
239 | initgdic(); |
240 | initmdic(); | |
241 | initcontrolsc(); | |
242 | initcontrols2c(); | |
243 | initcmndlgsc(); | |
9c039d08 RD |
244 | initstattoolc(); |
245 | initframesc(); | |
08127323 | 246 | initwindows3c(); |
cf694132 | 247 | initimagec(); |
bb0054cd | 248 | initprintfwc(); |
2f90df85 | 249 | initsizersc(); |
b1462dfa | 250 | initclip_dndc(); |
c368d904 RD |
251 | initstreamsc(); |
252 | initfilesysc(); | |
96e5ef76 | 253 | initutilsc(); |
68bc8549 | 254 | initfontsc(); |
f6bcfd97 | 255 | |
a3fbed81 RD |
256 | |
257 | PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION )); | |
258 | PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION )); | |
259 | PyDict_SetItemString(d,"wxRELEASE_NUMBER", PyInt_FromLong((long)wxRELEASE_NUMBER )); | |
260 | PyDict_SetItemString(d,"wxVERSION_NUMBER", PyInt_FromLong((long)wxVERSION_NUMBER )); | |
c8bc7bb8 RD |
261 | #if wxUSE_UNICODE |
262 | wxString tempStr(wxVERSION_STRING); | |
263 | PyDict_SetItemString(d,"wxVERSION_STRING", PyUnicode_FromUnicode(tempStr.c_str(), tempStr.Len())); | |
264 | #else | |
a3fbed81 | 265 | PyDict_SetItemString(d,"wxVERSION_STRING", PyString_FromString(wxVERSION_STRING)); |
c8bc7bb8 | 266 | #endif |
a3fbed81 RD |
267 | |
268 | ||
7bf85405 RD |
269 | %} |
270 | ||
271 | //---------------------------------------------------------------------- | |
272 | // And this gets appended to the shadow class file. | |
273 | //---------------------------------------------------------------------- | |
274 | ||
275 | %pragma(python) include="_extras.py"; | |
276 |