]>
Commit | Line | Data |
---|---|---|
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 | ||
13 | %module wx | |
14 | ||
15 | ||
16 | %{ | |
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 | ||
28 | %include pointer.i | |
29 | ||
30 | %import misc.i | |
31 | %import misc2.i | |
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 | |
40 | %import stattool.i | |
41 | %import frames.i | |
42 | %import windows3.i | |
43 | %import image.i | |
44 | %import printfw.i | |
45 | %import sizers.i | |
46 | %import streams.i | |
47 | %import filesys.i | |
48 | %import utils.i | |
49 | %import fonts.i | |
50 | ||
51 | ||
52 | %native(_wxStart) __wxStart; | |
53 | %native(_wxSetDictionary) __wxSetDictionary; | |
54 | ||
55 | //--------------------------------------------------------------------------- | |
56 | ||
57 | ||
58 | #define __version__ "0.0.0" // The real value is now in setup.py... | |
59 | ||
60 | %readonly | |
61 | wxPoint wxDefaultPosition; | |
62 | wxSize wxDefaultSize; | |
63 | %readwrite | |
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 | ||
77 | ~wxPyApp(); | |
78 | ||
79 | wxString GetAppName(); | |
80 | #ifdef __WXMSW__ | |
81 | bool GetAuto3D(); | |
82 | #endif | |
83 | wxString GetClassName(); | |
84 | bool GetExitOnFrameDelete(); | |
85 | int GetPrintMode(); | |
86 | wxWindow * GetTopWindow(); | |
87 | wxString GetVendorName(); | |
88 | bool GetUseBestVisual(); | |
89 | ||
90 | void Dispatch(); | |
91 | void ExitMainLoop(); | |
92 | bool Initialized(); | |
93 | int MainLoop(); | |
94 | bool Pending(); | |
95 | bool ProcessIdle(); | |
96 | ||
97 | void SetAppName(const wxString& name); | |
98 | #ifdef __WXMSW__ | |
99 | void SetAuto3D(bool auto3D); | |
100 | #endif | |
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); | |
106 | void SetUseBestVisual(bool flag); | |
107 | }; | |
108 | ||
109 | %inline %{ | |
110 | wxPyApp* wxGetApp() { | |
111 | //return wxPythonApp; | |
112 | return (wxPyApp*)wxTheApp; | |
113 | } | |
114 | %} | |
115 | ||
116 | ||
117 | //---------------------------------------------------------------------- | |
118 | // this is used to cleanup after wxWindows when Python shuts down. | |
119 | ||
120 | %inline %{ | |
121 | void wxApp_CleanUp() { | |
122 | __wxCleanup(); | |
123 | } | |
124 | %} | |
125 | ||
126 | //---------------------------------------------------------------------- | |
127 | // This code gets added to the module initialization function | |
128 | //---------------------------------------------------------------------- | |
129 | ||
130 | %{ | |
131 | ||
132 | ||
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(); | |
148 | extern "C" SWIGEXPORT(void) initsizersc(); | |
149 | extern "C" SWIGEXPORT(void) initclip_dndc(); | |
150 | extern "C" SWIGEXPORT(void) initstreamsc(); | |
151 | extern "C" SWIGEXPORT(void) initfilesysc(); | |
152 | extern "C" SWIGEXPORT(void) initutilsc(); | |
153 | extern "C" SWIGEXPORT(void) initfontsc(); | |
154 | ||
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 = { | |
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, | |
167 | ||
168 | wxPyBeginAllowThreads, | |
169 | wxPyEndAllowThreads, | |
170 | wxPyBeginBlockThreads, | |
171 | wxPyEndBlockThreads, | |
172 | ||
173 | wxPyConstructObject, | |
174 | wxPy_ConvertList, | |
175 | ||
176 | wxString_in_helper, | |
177 | Py2wxString, | |
178 | wx2PyString, | |
179 | ||
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 | ||
195 | wxPyCBH_setCallbackInfo, | |
196 | wxPyCBH_findCallback, | |
197 | wxPyCBH_callCallback, | |
198 | wxPyCBH_callCallbackObj, | |
199 | wxPyCBH_delete, | |
200 | ||
201 | wxPyClassExists, | |
202 | wxPyMake_wxObject, | |
203 | wxPyMake_wxSizer, | |
204 | wxPyPtrTypeMap_Add, | |
205 | wxArrayString2PyList_helper, | |
206 | wxArrayInt2PyList_helper, | |
207 | ||
208 | wxPyClientData_dtor, | |
209 | wxPyUserData_dtor, | |
210 | wxPyOORClientData_dtor, | |
211 | ||
212 | wxPyCBInputStream_create | |
213 | }; | |
214 | ||
215 | ||
216 | %} | |
217 | ||
218 | ||
219 | ||
220 | %init %{ | |
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 | ||
227 | ||
228 | __wxPreStart(); // initialize the GUI toolkit, if needed. | |
229 | ||
230 | ||
231 | // Since these modules are all linked together, initialize them now | |
232 | // because Python won't be able to find their shared library files, | |
233 | // (since there isn't any.) | |
234 | initwindowsc(); | |
235 | initwindows2c(); | |
236 | initeventsc(); | |
237 | initmiscc(); | |
238 | initmisc2c(); | |
239 | initgdic(); | |
240 | initmdic(); | |
241 | initcontrolsc(); | |
242 | initcontrols2c(); | |
243 | initcmndlgsc(); | |
244 | initstattoolc(); | |
245 | initframesc(); | |
246 | initwindows3c(); | |
247 | initimagec(); | |
248 | initprintfwc(); | |
249 | initsizersc(); | |
250 | initclip_dndc(); | |
251 | initstreamsc(); | |
252 | initfilesysc(); | |
253 | initutilsc(); | |
254 | initfontsc(); | |
255 | ||
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 )); | |
261 | #if wxUSE_UNICODE | |
262 | wxString tempStr(wxVERSION_STRING); | |
263 | PyDict_SetItemString(d,"wxVERSION_STRING", PyUnicode_FromUnicode(tempStr.c_str(), tempStr.Len())); | |
264 | #else | |
265 | PyDict_SetItemString(d,"wxVERSION_STRING", PyString_FromString(wxVERSION_STRING)); | |
266 | #endif | |
267 | ||
268 | ||
269 | %} | |
270 | ||
271 | //---------------------------------------------------------------------- | |
272 | // And this gets appended to the shadow class file. | |
273 | //---------------------------------------------------------------------- | |
274 | ||
275 | %pragma(python) include="_extras.py"; | |
276 |