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