]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/wx.i
no changes
[wxWidgets.git] / wxPython / src / wx.i
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 #include "helpers.h"
17 %}
18
19 //----------------------------------------------------------------------
20 // This is where we include the other wrapper definition files for SWIG
21 //----------------------------------------------------------------------
22
23 %include typemaps.i
24 %include my_typemaps.i
25 %include _defs.i
26
27 %include pointer.i
28
29 %import misc.i
30 %import misc2.i
31 %import windows.i
32 %import events.i
33 %import gdi.i
34 %import mdi.i
35 %import controls.i
36 %import controls2.i
37 %import windows2.i
38 %import cmndlgs.i
39 %import stattool.i
40 %import frames.i
41 %import windows3.i
42 %import image.i
43 %import printfw.i
44 %import sizers.i
45 %import streams.i
46 %import filesys.i
47 %import utils.i
48 %import fonts.i
49
50
51 %native(_wxStart) __wxStart;
52 %native(_wxSetDictionary) __wxSetDictionary;
53
54 //---------------------------------------------------------------------------
55
56
57 #define __version__ "0.0.0" // The real value is now in setup.py...
58
59 %readonly
60 wxPoint wxDefaultPosition;
61 wxSize wxDefaultSize;
62 %readwrite
63
64 //---------------------------------------------------------------------------
65 //---------------------------------------------------------------------------
66
67 class wxPyApp : public wxEvtHandler {
68 public:
69 %addmethods {
70 wxPyApp() {
71 wxPythonApp = new wxPyApp();
72 return wxPythonApp;
73 }
74 }
75
76 ~wxPyApp();
77
78 wxString GetAppName();
79 #ifdef __WXMSW__
80 bool GetAuto3D();
81 #endif
82 wxString GetClassName();
83 bool GetExitOnFrameDelete();
84 int GetPrintMode();
85 wxWindow * GetTopWindow();
86 wxString GetVendorName();
87 bool GetUseBestVisual();
88
89 void Dispatch();
90 void ExitMainLoop();
91 bool Initialized();
92 int MainLoop();
93 bool Pending();
94 bool ProcessIdle();
95
96 void SetAppName(const wxString& name);
97 #ifdef __WXMSW__
98 void SetAuto3D(bool auto3D);
99 #endif
100 void SetClassName(const wxString& name);
101 void SetExitOnFrameDelete(bool flag);
102 void SetPrintMode(int mode);
103 void SetTopWindow(wxWindow* window);
104 void SetVendorName(const wxString& name);
105 void SetUseBestVisual(bool flag);
106 };
107
108 %inline %{
109 wxPyApp* wxGetApp() {
110 return wxPythonApp;
111 }
112 %}
113
114
115
116 //----------------------------------------------------------------------
117 // this is used to cleanup after wxWindows when Python shuts down.
118
119 %inline %{
120 void wxApp_CleanUp() {
121 __wxCleanup();
122 }
123 %}
124
125 //----------------------------------------------------------------------
126 // This code gets added to the module initialization function
127 //----------------------------------------------------------------------
128
129 %{
130
131
132 extern "C" SWIGEXPORT(void) initwindowsc();
133 extern "C" SWIGEXPORT(void) initwindows2c();
134 extern "C" SWIGEXPORT(void) initeventsc();
135 extern "C" SWIGEXPORT(void) initmiscc();
136 extern "C" SWIGEXPORT(void) initmisc2c();
137 extern "C" SWIGEXPORT(void) initgdic();
138 extern "C" SWIGEXPORT(void) initmdic();
139 extern "C" SWIGEXPORT(void) initcontrolsc();
140 extern "C" SWIGEXPORT(void) initcontrols2c();
141 extern "C" SWIGEXPORT(void) initcmndlgsc();
142 extern "C" SWIGEXPORT(void) initstattoolc();
143 extern "C" SWIGEXPORT(void) initframesc();
144 extern "C" SWIGEXPORT(void) initwindows3c();
145 extern "C" SWIGEXPORT(void) initimagec();
146 extern "C" SWIGEXPORT(void) initprintfwc();
147 extern "C" SWIGEXPORT(void) initsizersc();
148 extern "C" SWIGEXPORT(void) initclip_dndc();
149 extern "C" SWIGEXPORT(void) initstreamsc();
150 extern "C" SWIGEXPORT(void) initfilesysc();
151 extern "C" SWIGEXPORT(void) initutilsc();
152 extern "C" SWIGEXPORT(void) initfontsc();
153
154
155
156 // Export a C API in a struct. Other modules will be able to load this from
157 // the wxc module and will then have safe access to these functions, even if
158 // in another shared library.
159 static wxPyCoreAPI API = {
160 SWIG_MakePtr,
161 SWIG_GetPtr,
162 SWIG_GetPtrObj,
163 SWIG_RegisterMapping,
164 SWIG_addvarlink,
165 SWIG_newvarlink,
166
167 wxPyBeginAllowThreads,
168 wxPyEndAllowThreads,
169 wxPyBeginBlockThreads,
170 wxPyEndBlockThreads,
171
172 wxPyConstructObject,
173 wxPy_ConvertList,
174
175 wxString_in_helper,
176 Py2wxString,
177 wx2PyString,
178
179 byte_LIST_helper,
180 int_LIST_helper,
181 long_LIST_helper,
182 string_LIST_helper,
183 wxPoint_LIST_helper,
184 wxBitmap_LIST_helper,
185 wxString_LIST_helper,
186 wxAcceleratorEntry_LIST_helper,
187
188 wxSize_helper,
189 wxPoint_helper,
190 wxRealPoint_helper,
191 wxRect_helper,
192 wxColour_helper,
193
194 wxPyCBH_setCallbackInfo,
195 wxPyCBH_findCallback,
196 wxPyCBH_callCallback,
197 wxPyCBH_callCallbackObj,
198 wxPyCBH_delete,
199
200 wxPyClassExists,
201 wxPyMake_wxObject,
202 wxPyMake_wxSizer,
203 wxPyPtrTypeMap_Add,
204 wxArrayString2PyList_helper,
205 wxArrayInt2PyList_helper,
206
207 wxPyClientData_dtor,
208 wxPyUserData_dtor,
209 wxPyOORClientData_dtor
210 };
211
212
213 %}
214
215
216
217 %init %{
218 // Make our API structure a CObject so other modules can import it
219 // from this module.
220 PyObject* v = PyCObject_FromVoidPtr(&API, NULL);
221 PyDict_SetItemString(d,"wxPyCoreAPI", v);
222 Py_XDECREF(v);
223
224
225 __wxPreStart(); // initialize the GUI toolkit, if needed.
226
227
228 // Since these modules are all linked together, initialize them now
229 // because Python won't be able to find their shared library files,
230 // (since there isn't any.)
231 initwindowsc();
232 initwindows2c();
233 initeventsc();
234 initmiscc();
235 initmisc2c();
236 initgdic();
237 initmdic();
238 initcontrolsc();
239 initcontrols2c();
240 initcmndlgsc();
241 initstattoolc();
242 initframesc();
243 initwindows3c();
244 initimagec();
245 initprintfwc();
246 initsizersc();
247 initclip_dndc();
248 initstreamsc();
249 initfilesysc();
250 initutilsc();
251 initfontsc();
252
253
254 PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION ));
255 PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION ));
256 PyDict_SetItemString(d,"wxRELEASE_NUMBER", PyInt_FromLong((long)wxRELEASE_NUMBER ));
257 PyDict_SetItemString(d,"wxVERSION_NUMBER", PyInt_FromLong((long)wxVERSION_NUMBER ));
258 #if wxUSE_UNICODE
259 wxString tempStr(wxVERSION_STRING);
260 PyDict_SetItemString(d,"wxVERSION_STRING", PyUnicode_FromUnicode(tempStr.c_str(), tempStr.Len()));
261 #else
262 PyDict_SetItemString(d,"wxVERSION_STRING", PyString_FromString(wxVERSION_STRING));
263 #endif
264
265
266 %}
267
268 //----------------------------------------------------------------------
269 // And this gets appended to the shadow class file.
270 //----------------------------------------------------------------------
271
272 %pragma(python) include="_extras.py";
273
274