]>
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 | ||
c5943253 RD |
19 | // %pragma(python) code=" |
20 | // # This gives this module's dictionary to the C++ extension code... | |
21 | // wxc._wxSetDictionary(vars()) | |
22 | // " | |
23 | ||
7bf85405 RD |
24 | //---------------------------------------------------------------------- |
25 | // This is where we include the other wrapper definition files for SWIG | |
26 | //---------------------------------------------------------------------- | |
27 | ||
28 | %include typemaps.i | |
29 | %include my_typemaps.i | |
30 | %include _defs.i | |
31 | ||
8bf5d46e RD |
32 | %include pointer.i |
33 | ||
7bf85405 | 34 | %import misc.i |
bb0054cd | 35 | %import misc2.i |
7bf85405 RD |
36 | %import windows.i |
37 | %import events.i | |
38 | %import gdi.i | |
39 | %import mdi.i | |
40 | %import controls.i | |
41 | %import controls2.i | |
42 | %import windows2.i | |
43 | %import cmndlgs.i | |
9c039d08 RD |
44 | %import stattool.i |
45 | %import frames.i | |
08127323 | 46 | %import windows3.i |
cf694132 | 47 | %import image.i |
bb0054cd | 48 | %import printfw.i |
2f90df85 | 49 | %import sizers.i |
c368d904 RD |
50 | %import streams.i |
51 | %import filesys.i | |
96e5ef76 | 52 | %import utils.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 | 109 | wxIcon GetStdIcon(int which); |
8bf5d46e RD |
110 | }; |
111 | ||
c368d904 RD |
112 | %inline %{ |
113 | wxPyApp* wxGetApp() { | |
114 | return wxPythonApp; | |
115 | } | |
116 | %} | |
8bf5d46e | 117 | |
c5943253 RD |
118 | |
119 | ||
8bf5d46e | 120 | //---------------------------------------------------------------------- |
b1462dfa | 121 | // this is used to cleanup after wxWindows when Python shuts down. |
8bf5d46e | 122 | |
b1462dfa RD |
123 | %inline %{ |
124 | void wxApp_CleanUp() { | |
7ff49f0c | 125 | __wxCleanup(); |
b1462dfa | 126 | } |
8bf5d46e RD |
127 | %} |
128 | ||
7bf85405 RD |
129 | //---------------------------------------------------------------------- |
130 | // This code gets added to the module initialization function | |
131 | //---------------------------------------------------------------------- | |
132 | ||
133 | %{ | |
1e7ecb7b RD |
134 | |
135 | ||
1d99702e RD |
136 | extern "C" SWIGEXPORT(void) initwindowsc(); |
137 | extern "C" SWIGEXPORT(void) initwindows2c(); | |
138 | extern "C" SWIGEXPORT(void) initeventsc(); | |
139 | extern "C" SWIGEXPORT(void) initmiscc(); | |
140 | extern "C" SWIGEXPORT(void) initmisc2c(); | |
141 | extern "C" SWIGEXPORT(void) initgdic(); | |
142 | extern "C" SWIGEXPORT(void) initmdic(); | |
143 | extern "C" SWIGEXPORT(void) initcontrolsc(); | |
144 | extern "C" SWIGEXPORT(void) initcontrols2c(); | |
145 | extern "C" SWIGEXPORT(void) initcmndlgsc(); | |
146 | extern "C" SWIGEXPORT(void) initstattoolc(); | |
147 | extern "C" SWIGEXPORT(void) initframesc(); | |
148 | extern "C" SWIGEXPORT(void) initwindows3c(); | |
149 | extern "C" SWIGEXPORT(void) initimagec(); | |
150 | extern "C" SWIGEXPORT(void) initprintfwc(); | |
2f90df85 | 151 | extern "C" SWIGEXPORT(void) initsizersc(); |
b1462dfa | 152 | extern "C" SWIGEXPORT(void) initclip_dndc(); |
c368d904 RD |
153 | extern "C" SWIGEXPORT(void) initstreamsc(); |
154 | extern "C" SWIGEXPORT(void) initfilesysc(); | |
96e5ef76 | 155 | extern "C" SWIGEXPORT(void) initutilsc(); |
c368d904 | 156 | |
1e7ecb7b RD |
157 | |
158 | ||
159 | // Export a C API in a struct. Other modules will be able to load this from | |
160 | // the wxc module and will then have safe access to these functions, even if | |
161 | // in another shared library. | |
162 | static wxPyCoreAPI API = { | |
163 | SWIG_MakePtr, | |
164 | SWIG_GetPtr, | |
165 | SWIG_GetPtrObj, | |
166 | SWIG_RegisterMapping, | |
167 | SWIG_addvarlink, | |
168 | SWIG_newvarlink, | |
169 | ||
4268f798 RD |
170 | wxPyBeginAllowThreads, |
171 | wxPyEndAllowThreads, | |
19a97bd6 RD |
172 | wxPyBeginBlockThreads, |
173 | wxPyEndBlockThreads, | |
174 | ||
1e7ecb7b RD |
175 | wxPyConstructObject, |
176 | wxPy_ConvertList, | |
177 | ||
178 | byte_LIST_helper, | |
179 | int_LIST_helper, | |
180 | long_LIST_helper, | |
181 | string_LIST_helper, | |
182 | wxPoint_LIST_helper, | |
183 | wxBitmap_LIST_helper, | |
184 | wxString_LIST_helper, | |
185 | wxAcceleratorEntry_LIST_helper, | |
186 | ||
187 | wxSize_helper, | |
188 | wxPoint_helper, | |
189 | wxRealPoint_helper, | |
190 | wxRect_helper, | |
191 | wxColour_helper, | |
192 | ||
0122b7e3 | 193 | wxPyCBH_setCallbackInfo, |
1e7ecb7b RD |
194 | wxPyCBH_findCallback, |
195 | wxPyCBH_callCallback, | |
196 | wxPyCBH_callCallbackObj, | |
197 | wxPyCBH_delete, | |
9416aa89 RD |
198 | |
199 | wxPyClassExists, | |
200 | wxPyMake_wxObject, | |
2f4e9287 | 201 | wxPyMake_wxSizer, |
9416aa89 | 202 | wxPyPtrTypeMap_Add, |
293a0a86 RD |
203 | wxArrayString2PyList_helper, |
204 | wxArrayInt2PyList_helper | |
1e7ecb7b RD |
205 | }; |
206 | ||
9416aa89 | 207 | |
0699c864 | 208 | %} |
08127323 | 209 | |
7bf85405 | 210 | |
7bf85405 RD |
211 | |
212 | %init %{ | |
1e7ecb7b RD |
213 | // Make our API structure a CObject so other modules can import it |
214 | // from this module. | |
215 | PyObject* v = PyCObject_FromVoidPtr(&API, NULL); | |
216 | PyDict_SetItemString(d,"wxPyCoreAPI", v); | |
217 | Py_XDECREF(v); | |
218 | ||
7bf85405 | 219 | |
0d6f9504 | 220 | __wxPreStart(); // initialize the GUI toolkit, if needed. |
7bf85405 | 221 | |
7bf85405 RD |
222 | |
223 | // Since these modules are all linked together, initialize them now | |
f6bcfd97 | 224 | // because Python won't be able to find their shared library files, |
7bf85405 RD |
225 | // (since there isn't any.) |
226 | initwindowsc(); | |
227 | initwindows2c(); | |
228 | initeventsc(); | |
229 | initmiscc(); | |
bb0054cd | 230 | initmisc2c(); |
7bf85405 RD |
231 | initgdic(); |
232 | initmdic(); | |
233 | initcontrolsc(); | |
234 | initcontrols2c(); | |
235 | initcmndlgsc(); | |
9c039d08 RD |
236 | initstattoolc(); |
237 | initframesc(); | |
08127323 | 238 | initwindows3c(); |
cf694132 | 239 | initimagec(); |
bb0054cd | 240 | initprintfwc(); |
2f90df85 | 241 | initsizersc(); |
b1462dfa | 242 | initclip_dndc(); |
c368d904 RD |
243 | initstreamsc(); |
244 | initfilesysc(); | |
96e5ef76 | 245 | initutilsc(); |
f6bcfd97 | 246 | |
a3fbed81 RD |
247 | |
248 | PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION )); | |
249 | PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION )); | |
250 | PyDict_SetItemString(d,"wxRELEASE_NUMBER", PyInt_FromLong((long)wxRELEASE_NUMBER )); | |
251 | PyDict_SetItemString(d,"wxVERSION_NUMBER", PyInt_FromLong((long)wxVERSION_NUMBER )); | |
252 | PyDict_SetItemString(d,"wxVERSION_STRING", PyString_FromString(wxVERSION_STRING)); | |
253 | ||
254 | ||
7bf85405 RD |
255 | %} |
256 | ||
257 | //---------------------------------------------------------------------- | |
258 | // And this gets appended to the shadow class file. | |
259 | //---------------------------------------------------------------------- | |
260 | ||
261 | %pragma(python) include="_extras.py"; | |
262 | ||
263 |