]>
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 | |
7bf85405 RD |
53 | |
54 | %native(_wxStart) __wxStart; | |
55 | %native(_wxSetDictionary) __wxSetDictionary; | |
56 | ||
57 | //--------------------------------------------------------------------------- | |
58 | ||
2f90df85 | 59 | |
de20db99 | 60 | #define __version__ "0.0.0" // The real value is now in setup.py... |
7bf85405 | 61 | |
35d60de2 | 62 | %readonly |
b68dc582 RD |
63 | wxPoint wxDefaultPosition; |
64 | wxSize wxDefaultSize; | |
35d60de2 | 65 | %readwrite |
7bf85405 RD |
66 | |
67 | //--------------------------------------------------------------------------- | |
68 | //--------------------------------------------------------------------------- | |
69 | ||
70 | class wxPyApp : public wxEvtHandler { | |
71 | public: | |
72 | %addmethods { | |
73 | wxPyApp() { | |
74 | wxPythonApp = new wxPyApp(); | |
75 | return wxPythonApp; | |
76 | } | |
77 | } | |
78 | ||
8bf5d46e | 79 | ~wxPyApp(); |
7bf85405 RD |
80 | |
81 | wxString GetAppName(); | |
853b255a | 82 | #ifdef __WXMSW__ |
7bf85405 | 83 | bool GetAuto3D(); |
853b255a | 84 | #endif |
7bf85405 RD |
85 | wxString GetClassName(); |
86 | bool GetExitOnFrameDelete(); | |
87 | int GetPrintMode(); | |
88 | wxWindow * GetTopWindow(); | |
89 | wxString GetVendorName(); | |
f6bcfd97 | 90 | bool GetUseBestVisual(); |
7bf85405 RD |
91 | |
92 | void Dispatch(); | |
93 | void ExitMainLoop(); | |
94 | bool Initialized(); | |
95 | int MainLoop(); | |
96 | bool Pending(); | |
8bf5d46e | 97 | bool ProcessIdle(); |
7bf85405 RD |
98 | |
99 | void SetAppName(const wxString& name); | |
853b255a | 100 | #ifdef __WXMSW__ |
7bf85405 | 101 | void SetAuto3D(bool auto3D); |
853b255a | 102 | #endif |
7bf85405 RD |
103 | void SetClassName(const wxString& name); |
104 | void SetExitOnFrameDelete(bool flag); | |
105 | void SetPrintMode(int mode); | |
106 | void SetTopWindow(wxWindow* window); | |
107 | void SetVendorName(const wxString& name); | |
f6bcfd97 | 108 | void SetUseBestVisual(bool flag); |
8bf5d46e RD |
109 | wxIcon GetStdIcon(int which); |
110 | ||
111 | ||
112 | }; | |
113 | ||
c368d904 RD |
114 | %inline %{ |
115 | wxPyApp* wxGetApp() { | |
116 | return wxPythonApp; | |
117 | } | |
118 | %} | |
8bf5d46e | 119 | |
c5943253 RD |
120 | |
121 | ||
8bf5d46e | 122 | //---------------------------------------------------------------------- |
b1462dfa | 123 | // this is used to cleanup after wxWindows when Python shuts down. |
8bf5d46e | 124 | |
b1462dfa RD |
125 | %inline %{ |
126 | void wxApp_CleanUp() { | |
7ff49f0c | 127 | __wxCleanup(); |
b1462dfa | 128 | } |
8bf5d46e RD |
129 | %} |
130 | ||
7bf85405 RD |
131 | //---------------------------------------------------------------------- |
132 | // This code gets added to the module initialization function | |
133 | //---------------------------------------------------------------------- | |
134 | ||
135 | %{ | |
1e7ecb7b RD |
136 | |
137 | ||
1d99702e RD |
138 | extern "C" SWIGEXPORT(void) initwindowsc(); |
139 | extern "C" SWIGEXPORT(void) initwindows2c(); | |
140 | extern "C" SWIGEXPORT(void) initeventsc(); | |
141 | extern "C" SWIGEXPORT(void) initmiscc(); | |
142 | extern "C" SWIGEXPORT(void) initmisc2c(); | |
143 | extern "C" SWIGEXPORT(void) initgdic(); | |
144 | extern "C" SWIGEXPORT(void) initmdic(); | |
145 | extern "C" SWIGEXPORT(void) initcontrolsc(); | |
146 | extern "C" SWIGEXPORT(void) initcontrols2c(); | |
147 | extern "C" SWIGEXPORT(void) initcmndlgsc(); | |
148 | extern "C" SWIGEXPORT(void) initstattoolc(); | |
149 | extern "C" SWIGEXPORT(void) initframesc(); | |
150 | extern "C" SWIGEXPORT(void) initwindows3c(); | |
151 | extern "C" SWIGEXPORT(void) initimagec(); | |
152 | extern "C" SWIGEXPORT(void) initprintfwc(); | |
2f90df85 | 153 | extern "C" SWIGEXPORT(void) initsizersc(); |
b1462dfa | 154 | extern "C" SWIGEXPORT(void) initclip_dndc(); |
c368d904 RD |
155 | extern "C" SWIGEXPORT(void) initstreamsc(); |
156 | extern "C" SWIGEXPORT(void) initfilesysc(); | |
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 | ||
19a97bd6 RD |
171 | wxPyBeginBlockThreads, |
172 | wxPyEndBlockThreads, | |
173 | ||
1e7ecb7b RD |
174 | wxPyConstructObject, |
175 | wxPy_ConvertList, | |
176 | ||
177 | byte_LIST_helper, | |
178 | int_LIST_helper, | |
179 | long_LIST_helper, | |
180 | string_LIST_helper, | |
181 | wxPoint_LIST_helper, | |
182 | wxBitmap_LIST_helper, | |
183 | wxString_LIST_helper, | |
184 | wxAcceleratorEntry_LIST_helper, | |
185 | ||
186 | wxSize_helper, | |
187 | wxPoint_helper, | |
188 | wxRealPoint_helper, | |
189 | wxRect_helper, | |
190 | wxColour_helper, | |
191 | ||
0122b7e3 | 192 | wxPyCBH_setCallbackInfo, |
1e7ecb7b RD |
193 | wxPyCBH_findCallback, |
194 | wxPyCBH_callCallback, | |
195 | wxPyCBH_callCallbackObj, | |
196 | wxPyCBH_delete, | |
9416aa89 RD |
197 | |
198 | wxPyClassExists, | |
199 | wxPyMake_wxObject, | |
2f4e9287 | 200 | wxPyMake_wxSizer, |
9416aa89 | 201 | wxPyPtrTypeMap_Add, |
7b7ac0ab | 202 | wxArrayString2PyList_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(); | |
f6bcfd97 | 243 | |
a3fbed81 RD |
244 | |
245 | PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION )); | |
246 | PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION )); | |
247 | PyDict_SetItemString(d,"wxRELEASE_NUMBER", PyInt_FromLong((long)wxRELEASE_NUMBER )); | |
248 | PyDict_SetItemString(d,"wxVERSION_NUMBER", PyInt_FromLong((long)wxVERSION_NUMBER )); | |
249 | PyDict_SetItemString(d,"wxVERSION_STRING", PyString_FromString(wxVERSION_STRING)); | |
250 | ||
251 | ||
7bf85405 RD |
252 | %} |
253 | ||
254 | //---------------------------------------------------------------------- | |
255 | // And this gets appended to the shadow class file. | |
256 | //---------------------------------------------------------------------- | |
257 | ||
258 | %pragma(python) include="_extras.py"; | |
259 | ||
260 |