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