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