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