]>
Commit | Line | Data |
---|---|---|
7bf85405 | 1 | ///////////////////////////////////////////////////////////////////////////// |
1e4a197e | 2 | // Name: wx.i |
7bf85405 RD |
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 | |
203c2f9a | 15 | |
03e9bead | 16 | %{ |
7bf85405 RD |
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 | ||
8bf5d46e RD |
28 | %include pointer.i |
29 | ||
7bf85405 | 30 | %import misc.i |
bb0054cd | 31 | %import misc2.i |
7bf85405 RD |
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 | |
9c039d08 RD |
40 | %import stattool.i |
41 | %import frames.i | |
08127323 | 42 | %import windows3.i |
cf694132 | 43 | %import image.i |
bb0054cd | 44 | %import printfw.i |
2f90df85 | 45 | %import sizers.i |
c368d904 RD |
46 | %import streams.i |
47 | %import filesys.i | |
96e5ef76 | 48 | %import utils.i |
68bc8549 RD |
49 | %import fonts.i |
50 | ||
7bf85405 RD |
51 | |
52 | %native(_wxStart) __wxStart; | |
53 | %native(_wxSetDictionary) __wxSetDictionary; | |
54 | ||
55 | //--------------------------------------------------------------------------- | |
56 | ||
35d60de2 | 57 | %readonly |
b68dc582 RD |
58 | wxPoint wxDefaultPosition; |
59 | wxSize wxDefaultSize; | |
35d60de2 | 60 | %readwrite |
7bf85405 RD |
61 | |
62 | //--------------------------------------------------------------------------- | |
63 | //--------------------------------------------------------------------------- | |
64 | ||
1e4a197e RD |
65 | enum { |
66 | wxPYAPP_ASSERT_SUPPRESS = 1, | |
67 | wxPYAPP_ASSERT_EXCEPTION = 2, | |
68 | wxPYAPP_ASSERT_DIALOG = 4, | |
69 | wxPYAPP_ASSERT_LOG = 8 | |
70 | }; | |
71 | ||
72 | ||
7bf85405 RD |
73 | class wxPyApp : public wxEvtHandler { |
74 | public: | |
75 | %addmethods { | |
76 | wxPyApp() { | |
77 | wxPythonApp = new wxPyApp(); | |
78 | return wxPythonApp; | |
79 | } | |
80 | } | |
81 | ||
8bf5d46e | 82 | ~wxPyApp(); |
7bf85405 | 83 | |
1e4a197e RD |
84 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
85 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyApp)" | |
86 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
87 | ||
88 | ||
7bf85405 | 89 | wxString GetAppName(); |
7bf85405 RD |
90 | wxString GetClassName(); |
91 | bool GetExitOnFrameDelete(); | |
92 | int GetPrintMode(); | |
93 | wxWindow * GetTopWindow(); | |
94 | wxString GetVendorName(); | |
f6bcfd97 | 95 | bool GetUseBestVisual(); |
7bf85405 RD |
96 | |
97 | void Dispatch(); | |
98 | void ExitMainLoop(); | |
99 | bool Initialized(); | |
100 | int MainLoop(); | |
101 | bool Pending(); | |
8bf5d46e | 102 | bool ProcessIdle(); |
fd512ba2 | 103 | bool Yield(bool onlyIfNeeded = FALSE); |
7bf85405 RD |
104 | |
105 | void SetAppName(const wxString& name); | |
7bf85405 RD |
106 | void SetClassName(const wxString& name); |
107 | void SetExitOnFrameDelete(bool flag); | |
108 | void SetPrintMode(int mode); | |
109 | void SetTopWindow(wxWindow* window); | |
110 | void SetVendorName(const wxString& name); | |
f6bcfd97 | 111 | void SetUseBestVisual(bool flag); |
1e4a197e RD |
112 | |
113 | int GetAssertMode(); | |
114 | void SetAssertMode(int mode); | |
115 | ||
116 | ||
1e4a197e RD |
117 | static bool GetMacSupportPCMenuShortcuts(); |
118 | static long GetMacAboutMenuItemId(); | |
119 | static long GetMacPreferencesMenuItemId(); | |
120 | static long GetMacExitMenuItemId(); | |
121 | static wxString GetMacHelpMenuTitleName(); | |
122 | ||
1e4a197e RD |
123 | static void SetMacSupportPCMenuShortcuts(bool val); |
124 | static void SetMacAboutMenuItemId(long val); | |
125 | static void SetMacPreferencesMenuItemId(long val); | |
126 | static void SetMacExitMenuItemId(long val); | |
127 | static void SetMacHelpMenuTitleName(const wxString& val); | |
8bf5d46e RD |
128 | }; |
129 | ||
c368d904 RD |
130 | %inline %{ |
131 | wxPyApp* wxGetApp() { | |
19e30148 | 132 | //return wxPythonApp; |
a2426843 | 133 | return (wxPyApp*)wxTheApp; |
c368d904 RD |
134 | } |
135 | %} | |
8bf5d46e | 136 | |
c5943253 | 137 | |
8bf5d46e | 138 | //---------------------------------------------------------------------- |
b1462dfa | 139 | // this is used to cleanup after wxWindows when Python shuts down. |
8bf5d46e | 140 | |
b1462dfa RD |
141 | %inline %{ |
142 | void wxApp_CleanUp() { | |
7ff49f0c | 143 | __wxCleanup(); |
b1462dfa | 144 | } |
8bf5d46e RD |
145 | %} |
146 | ||
7bf85405 RD |
147 | //---------------------------------------------------------------------- |
148 | // This code gets added to the module initialization function | |
149 | //---------------------------------------------------------------------- | |
150 | ||
151 | %{ | |
1e7ecb7b RD |
152 | |
153 | ||
1d99702e RD |
154 | extern "C" SWIGEXPORT(void) initwindowsc(); |
155 | extern "C" SWIGEXPORT(void) initwindows2c(); | |
156 | extern "C" SWIGEXPORT(void) initeventsc(); | |
157 | extern "C" SWIGEXPORT(void) initmiscc(); | |
158 | extern "C" SWIGEXPORT(void) initmisc2c(); | |
159 | extern "C" SWIGEXPORT(void) initgdic(); | |
160 | extern "C" SWIGEXPORT(void) initmdic(); | |
161 | extern "C" SWIGEXPORT(void) initcontrolsc(); | |
162 | extern "C" SWIGEXPORT(void) initcontrols2c(); | |
163 | extern "C" SWIGEXPORT(void) initcmndlgsc(); | |
164 | extern "C" SWIGEXPORT(void) initstattoolc(); | |
165 | extern "C" SWIGEXPORT(void) initframesc(); | |
166 | extern "C" SWIGEXPORT(void) initwindows3c(); | |
167 | extern "C" SWIGEXPORT(void) initimagec(); | |
168 | extern "C" SWIGEXPORT(void) initprintfwc(); | |
2f90df85 | 169 | extern "C" SWIGEXPORT(void) initsizersc(); |
b1462dfa | 170 | extern "C" SWIGEXPORT(void) initclip_dndc(); |
c368d904 RD |
171 | extern "C" SWIGEXPORT(void) initstreamsc(); |
172 | extern "C" SWIGEXPORT(void) initfilesysc(); | |
96e5ef76 | 173 | extern "C" SWIGEXPORT(void) initutilsc(); |
68bc8549 | 174 | extern "C" SWIGEXPORT(void) initfontsc(); |
c368d904 | 175 | |
1e7ecb7b RD |
176 | |
177 | ||
178 | // Export a C API in a struct. Other modules will be able to load this from | |
179 | // the wxc module and will then have safe access to these functions, even if | |
180 | // in another shared library. | |
181 | static wxPyCoreAPI API = { | |
bc5f2236 RD |
182 | (p_SWIG_MakePtr_t)SWIG_MakePtr, |
183 | (p_SWIG_GetPtr_t)SWIG_GetPtr, | |
184 | (p_SWIG_GetPtrObj_t)SWIG_GetPtrObj, | |
185 | (p_SWIG_RegisterMapping_t)SWIG_RegisterMapping, | |
186 | (p_SWIG_addvarlink_t)SWIG_addvarlink, | |
187 | (p_SWIG_newvarlink_t)SWIG_newvarlink, | |
1e7ecb7b | 188 | |
4268f798 RD |
189 | wxPyBeginAllowThreads, |
190 | wxPyEndAllowThreads, | |
19a97bd6 RD |
191 | wxPyBeginBlockThreads, |
192 | wxPyEndBlockThreads, | |
193 | ||
1e7ecb7b RD |
194 | wxPyConstructObject, |
195 | wxPy_ConvertList, | |
196 | ||
c8bc7bb8 | 197 | wxString_in_helper, |
a541c325 RD |
198 | Py2wxString, |
199 | wx2PyString, | |
200 | ||
1e7ecb7b RD |
201 | byte_LIST_helper, |
202 | int_LIST_helper, | |
203 | long_LIST_helper, | |
204 | string_LIST_helper, | |
205 | wxPoint_LIST_helper, | |
206 | wxBitmap_LIST_helper, | |
207 | wxString_LIST_helper, | |
208 | wxAcceleratorEntry_LIST_helper, | |
209 | ||
210 | wxSize_helper, | |
211 | wxPoint_helper, | |
212 | wxRealPoint_helper, | |
213 | wxRect_helper, | |
214 | wxColour_helper, | |
1e4a197e | 215 | wxPoint2DDouble_helper, |
1e7ecb7b | 216 | |
0122b7e3 | 217 | wxPyCBH_setCallbackInfo, |
1e7ecb7b RD |
218 | wxPyCBH_findCallback, |
219 | wxPyCBH_callCallback, | |
220 | wxPyCBH_callCallbackObj, | |
221 | wxPyCBH_delete, | |
9416aa89 RD |
222 | |
223 | wxPyClassExists, | |
224 | wxPyMake_wxObject, | |
2f4e9287 | 225 | wxPyMake_wxSizer, |
9416aa89 | 226 | wxPyPtrTypeMap_Add, |
293a0a86 | 227 | wxArrayString2PyList_helper, |
4acff284 RD |
228 | wxArrayInt2PyList_helper, |
229 | ||
230 | wxPyClientData_dtor, | |
231 | wxPyUserData_dtor, | |
249a57f4 RD |
232 | wxPyOORClientData_dtor, |
233 | ||
234 | wxPyCBInputStream_create | |
1e7ecb7b RD |
235 | }; |
236 | ||
9416aa89 | 237 | |
0699c864 | 238 | %} |
08127323 | 239 | |
7bf85405 | 240 | |
7bf85405 RD |
241 | |
242 | %init %{ | |
1e7ecb7b RD |
243 | // Make our API structure a CObject so other modules can import it |
244 | // from this module. | |
245 | PyObject* v = PyCObject_FromVoidPtr(&API, NULL); | |
246 | PyDict_SetItemString(d,"wxPyCoreAPI", v); | |
247 | Py_XDECREF(v); | |
248 | ||
7bf85405 | 249 | |
1e4a197e | 250 | __wxPreStart(d); // initialize the GUI toolkit, if needed. |
7bf85405 | 251 | |
7bf85405 RD |
252 | |
253 | // Since these modules are all linked together, initialize them now | |
f6bcfd97 | 254 | // because Python won't be able to find their shared library files, |
7bf85405 RD |
255 | // (since there isn't any.) |
256 | initwindowsc(); | |
257 | initwindows2c(); | |
258 | initeventsc(); | |
259 | initmiscc(); | |
bb0054cd | 260 | initmisc2c(); |
7bf85405 RD |
261 | initgdic(); |
262 | initmdic(); | |
263 | initcontrolsc(); | |
264 | initcontrols2c(); | |
265 | initcmndlgsc(); | |
9c039d08 RD |
266 | initstattoolc(); |
267 | initframesc(); | |
08127323 | 268 | initwindows3c(); |
cf694132 | 269 | initimagec(); |
bb0054cd | 270 | initprintfwc(); |
2f90df85 | 271 | initsizersc(); |
b1462dfa | 272 | initclip_dndc(); |
c368d904 RD |
273 | initstreamsc(); |
274 | initfilesysc(); | |
96e5ef76 | 275 | initutilsc(); |
68bc8549 | 276 | initfontsc(); |
f6bcfd97 | 277 | |
a3fbed81 | 278 | |
1fded56b RD |
279 | // Although these are redfined in __version__ they need to be here too so |
280 | // that an assert can be done to ensure that the wxPython and the wxWindows | |
281 | // versions match. | |
a3fbed81 RD |
282 | PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION )); |
283 | PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION )); | |
1fded56b | 284 | PyDict_SetItemString(d,"wxRELEASE_VERSION", PyInt_FromLong((long)wxRELEASE_NUMBER )); |
a3fbed81 | 285 | |
7bf85405 RD |
286 | %} |
287 | ||
288 | //---------------------------------------------------------------------- | |
289 | // And this gets appended to the shadow class file. | |
290 | //---------------------------------------------------------------------- | |
291 | ||
292 | %pragma(python) include="_extras.py"; | |
293 | ||
1e4a197e | 294 |