]>
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 | ||
49 | %native(_wxStart) __wxStart; | |
50 | %native(_wxSetDictionary) __wxSetDictionary; | |
51 | ||
52 | //--------------------------------------------------------------------------- | |
53 | ||
54 | ||
55 | #define __version__ "0.0.0" // The real value is now in setup.py... | |
56 | ||
57 | %readonly | |
58 | wxPoint wxDefaultPosition; | |
59 | wxSize wxDefaultSize; | |
60 | %readwrite | |
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 | ||
74 | ~wxPyApp(); | |
75 | ||
76 | wxString GetAppName(); | |
77 | #ifdef __WXMSW__ | |
78 | bool GetAuto3D(); | |
79 | #endif | |
80 | wxString GetClassName(); | |
81 | bool GetExitOnFrameDelete(); | |
82 | int GetPrintMode(); | |
83 | wxWindow * GetTopWindow(); | |
84 | wxString GetVendorName(); | |
85 | bool GetUseBestVisual(); | |
86 | ||
87 | void Dispatch(); | |
88 | void ExitMainLoop(); | |
89 | bool Initialized(); | |
90 | int MainLoop(); | |
91 | bool Pending(); | |
92 | bool ProcessIdle(); | |
93 | ||
94 | void SetAppName(const wxString& name); | |
95 | #ifdef __WXMSW__ | |
96 | void SetAuto3D(bool auto3D); | |
97 | #endif | |
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); | |
103 | void SetUseBestVisual(bool flag); | |
104 | wxIcon GetStdIcon(int which); | |
105 | ||
106 | ||
107 | }; | |
108 | ||
109 | %inline %{ | |
110 | wxPyApp* wxGetApp() { | |
111 | return wxPythonApp; | |
112 | } | |
113 | %} | |
114 | ||
115 | //---------------------------------------------------------------------- | |
116 | // this is used to cleanup after wxWindows when Python shuts down. | |
117 | ||
118 | %inline %{ | |
119 | void wxApp_CleanUp() { | |
120 | __wxCleanup(); | |
121 | } | |
122 | %} | |
123 | ||
124 | //---------------------------------------------------------------------- | |
125 | // This code gets added to the module initialization function | |
126 | //---------------------------------------------------------------------- | |
127 | ||
128 | %{ | |
129 | ||
130 | ||
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(); | |
146 | extern "C" SWIGEXPORT(void) initsizersc(); | |
147 | extern "C" SWIGEXPORT(void) initclip_dndc(); | |
148 | extern "C" SWIGEXPORT(void) initstreamsc(); | |
149 | extern "C" SWIGEXPORT(void) initfilesysc(); | |
150 | ||
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 | ||
164 | wxPySaveThread, | |
165 | wxPyRestoreThread, | |
166 | wxPyConstructObject, | |
167 | wxPy_ConvertList, | |
168 | ||
169 | byte_LIST_helper, | |
170 | int_LIST_helper, | |
171 | long_LIST_helper, | |
172 | string_LIST_helper, | |
173 | wxPoint_LIST_helper, | |
174 | wxBitmap_LIST_helper, | |
175 | wxString_LIST_helper, | |
176 | wxAcceleratorEntry_LIST_helper, | |
177 | ||
178 | wxSize_helper, | |
179 | wxPoint_helper, | |
180 | wxRealPoint_helper, | |
181 | wxRect_helper, | |
182 | wxColour_helper, | |
183 | ||
184 | wxPyCBH_setSelf, | |
185 | wxPyCBH_findCallback, | |
186 | wxPyCBH_callCallback, | |
187 | wxPyCBH_callCallbackObj, | |
188 | wxPyCBH_delete, | |
189 | ||
190 | wxPyClassExists, | |
191 | wxPyMake_wxObject, | |
192 | wxPyPtrTypeMap_Add, | |
193 | }; | |
194 | ||
195 | ||
196 | %} | |
197 | ||
198 | ||
199 | ||
200 | %init %{ | |
201 | // Make our API structure a CObject so other modules can import it | |
202 | // from this module. | |
203 | PyObject* v = PyCObject_FromVoidPtr(&API, NULL); | |
204 | PyDict_SetItemString(d,"wxPyCoreAPI", v); | |
205 | Py_XDECREF(v); | |
206 | ||
207 | ||
208 | __wxPreStart(); // initialize the GUI toolkit, if needed. | |
209 | ||
210 | ||
211 | // Since these modules are all linked together, initialize them now | |
212 | // because Python won't be able to find their shared library files, | |
213 | // (since there isn't any.) | |
214 | initwindowsc(); | |
215 | initwindows2c(); | |
216 | initeventsc(); | |
217 | initmiscc(); | |
218 | initmisc2c(); | |
219 | initgdic(); | |
220 | initmdic(); | |
221 | initcontrolsc(); | |
222 | initcontrols2c(); | |
223 | initcmndlgsc(); | |
224 | initstattoolc(); | |
225 | initframesc(); | |
226 | initwindows3c(); | |
227 | initimagec(); | |
228 | initprintfwc(); | |
229 | initsizersc(); | |
230 | initclip_dndc(); | |
231 | initstreamsc(); | |
232 | initfilesysc(); | |
233 | ||
234 | %} | |
235 | ||
236 | //---------------------------------------------------------------------- | |
237 | // And this gets appended to the shadow class file. | |
238 | //---------------------------------------------------------------------- | |
239 | ||
240 | %pragma(python) include="_extras.py"; | |
241 | ||
242 |