]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/wx.i
don't forget to backport manifest and wxLocale fix
[wxWidgets.git] / wxPython / src / wx.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx.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 %import utils.i
49 %import fonts.i
50
51
52 %native(_wxStart) __wxStart;
53 %native(_wxSetDictionary) __wxSetDictionary;
54
55 //---------------------------------------------------------------------------
56
57
58 #define __version__ "0.0.0" // The real value is now in setup.py...
59
60 %readonly
61 wxPoint wxDefaultPosition;
62 wxSize wxDefaultSize;
63 %readwrite
64
65 //---------------------------------------------------------------------------
66 //---------------------------------------------------------------------------
67
68 enum {
69 wxPYAPP_ASSERT_SUPPRESS = 1,
70 wxPYAPP_ASSERT_EXCEPTION = 2,
71 wxPYAPP_ASSERT_DIALOG = 4,
72 wxPYAPP_ASSERT_LOG = 8
73 };
74
75
76 class wxPyApp : public wxEvtHandler {
77 public:
78 %addmethods {
79 wxPyApp() {
80 wxPythonApp = new wxPyApp();
81 return wxPythonApp;
82 }
83 }
84
85 ~wxPyApp();
86
87 void _setCallbackInfo(PyObject* self, PyObject* _class);
88 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyApp)"
89 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
90
91
92 wxString GetAppName();
93 #ifdef __WXMSW__
94 bool GetAuto3D();
95 #endif
96 wxString GetClassName();
97 bool GetExitOnFrameDelete();
98 int GetPrintMode();
99 wxWindow * GetTopWindow();
100 wxString GetVendorName();
101 bool GetUseBestVisual();
102
103 void Dispatch();
104 void ExitMainLoop();
105 bool Initialized();
106 int MainLoop();
107 bool Pending();
108 bool ProcessIdle();
109 bool Yield(bool onlyIfNeeded = FALSE);
110
111 void SetAppName(const wxString& name);
112 #ifdef __WXMSW__
113 void SetAuto3D(bool auto3D);
114 #endif
115 void SetClassName(const wxString& name);
116 void SetExitOnFrameDelete(bool flag);
117 void SetPrintMode(int mode);
118 void SetTopWindow(wxWindow* window);
119 void SetVendorName(const wxString& name);
120 void SetUseBestVisual(bool flag);
121
122 int GetAssertMode();
123 void SetAssertMode(int mode);
124
125
126 static bool GetMacDefaultEncodingIsPC();
127 static bool GetMacSupportPCMenuShortcuts();
128 static long GetMacAboutMenuItemId();
129 static long GetMacPreferencesMenuItemId();
130 static long GetMacExitMenuItemId();
131 static wxString GetMacHelpMenuTitleName();
132
133 static void SetMacDefaultEncodingIsPC(bool val);
134 static void SetMacSupportPCMenuShortcuts(bool val);
135 static void SetMacAboutMenuItemId(long val);
136 static void SetMacPreferencesMenuItemId(long val);
137 static void SetMacExitMenuItemId(long val);
138 static void SetMacHelpMenuTitleName(const wxString& val);
139 };
140
141 %inline %{
142 wxPyApp* wxGetApp() {
143 //return wxPythonApp;
144 return (wxPyApp*)wxTheApp;
145 }
146 %}
147
148
149 //----------------------------------------------------------------------
150 // this is used to cleanup after wxWindows when Python shuts down.
151
152 %inline %{
153 void wxApp_CleanUp() {
154 __wxCleanup();
155 }
156 %}
157
158 //----------------------------------------------------------------------
159 // This code gets added to the module initialization function
160 //----------------------------------------------------------------------
161
162 %{
163
164
165 extern "C" SWIGEXPORT(void) initwindowsc();
166 extern "C" SWIGEXPORT(void) initwindows2c();
167 extern "C" SWIGEXPORT(void) initeventsc();
168 extern "C" SWIGEXPORT(void) initmiscc();
169 extern "C" SWIGEXPORT(void) initmisc2c();
170 extern "C" SWIGEXPORT(void) initgdic();
171 extern "C" SWIGEXPORT(void) initmdic();
172 extern "C" SWIGEXPORT(void) initcontrolsc();
173 extern "C" SWIGEXPORT(void) initcontrols2c();
174 extern "C" SWIGEXPORT(void) initcmndlgsc();
175 extern "C" SWIGEXPORT(void) initstattoolc();
176 extern "C" SWIGEXPORT(void) initframesc();
177 extern "C" SWIGEXPORT(void) initwindows3c();
178 extern "C" SWIGEXPORT(void) initimagec();
179 extern "C" SWIGEXPORT(void) initprintfwc();
180 extern "C" SWIGEXPORT(void) initsizersc();
181 extern "C" SWIGEXPORT(void) initclip_dndc();
182 extern "C" SWIGEXPORT(void) initstreamsc();
183 extern "C" SWIGEXPORT(void) initfilesysc();
184 extern "C" SWIGEXPORT(void) initutilsc();
185 extern "C" SWIGEXPORT(void) initfontsc();
186
187
188
189 // Export a C API in a struct. Other modules will be able to load this from
190 // the wxc module and will then have safe access to these functions, even if
191 // in another shared library.
192 static wxPyCoreAPI API = {
193 (p_SWIG_MakePtr_t)SWIG_MakePtr,
194 (p_SWIG_GetPtr_t)SWIG_GetPtr,
195 (p_SWIG_GetPtrObj_t)SWIG_GetPtrObj,
196 (p_SWIG_RegisterMapping_t)SWIG_RegisterMapping,
197 (p_SWIG_addvarlink_t)SWIG_addvarlink,
198 (p_SWIG_newvarlink_t)SWIG_newvarlink,
199
200 wxPyBeginAllowThreads,
201 wxPyEndAllowThreads,
202 wxPyBeginBlockThreads,
203 wxPyEndBlockThreads,
204
205 wxPyConstructObject,
206 wxPy_ConvertList,
207
208 wxString_in_helper,
209 Py2wxString,
210 wx2PyString,
211
212 byte_LIST_helper,
213 int_LIST_helper,
214 long_LIST_helper,
215 string_LIST_helper,
216 wxPoint_LIST_helper,
217 wxBitmap_LIST_helper,
218 wxString_LIST_helper,
219 wxAcceleratorEntry_LIST_helper,
220
221 wxSize_helper,
222 wxPoint_helper,
223 wxRealPoint_helper,
224 wxRect_helper,
225 wxColour_helper,
226 wxPoint2DDouble_helper,
227
228 wxPyCBH_setCallbackInfo,
229 wxPyCBH_findCallback,
230 wxPyCBH_callCallback,
231 wxPyCBH_callCallbackObj,
232 wxPyCBH_delete,
233
234 wxPyClassExists,
235 wxPyMake_wxObject,
236 wxPyMake_wxSizer,
237 wxPyPtrTypeMap_Add,
238 wxArrayString2PyList_helper,
239 wxArrayInt2PyList_helper,
240
241 wxPyClientData_dtor,
242 wxPyUserData_dtor,
243 wxPyOORClientData_dtor,
244
245 wxPyCBInputStream_create
246 };
247
248
249 %}
250
251
252
253 %init %{
254 // Make our API structure a CObject so other modules can import it
255 // from this module.
256 PyObject* v = PyCObject_FromVoidPtr(&API, NULL);
257 PyDict_SetItemString(d,"wxPyCoreAPI", v);
258 Py_XDECREF(v);
259
260
261 __wxPreStart(d); // initialize the GUI toolkit, if needed.
262
263
264 // Since these modules are all linked together, initialize them now
265 // because Python won't be able to find their shared library files,
266 // (since there isn't any.)
267 initwindowsc();
268 initwindows2c();
269 initeventsc();
270 initmiscc();
271 initmisc2c();
272 initgdic();
273 initmdic();
274 initcontrolsc();
275 initcontrols2c();
276 initcmndlgsc();
277 initstattoolc();
278 initframesc();
279 initwindows3c();
280 initimagec();
281 initprintfwc();
282 initsizersc();
283 initclip_dndc();
284 initstreamsc();
285 initfilesysc();
286 initutilsc();
287 initfontsc();
288
289
290 PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION ));
291 PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION ));
292 PyDict_SetItemString(d,"wxRELEASE_NUMBER", PyInt_FromLong((long)wxRELEASE_NUMBER ));
293 PyDict_SetItemString(d,"wxVERSION_NUMBER", PyInt_FromLong((long)wxVERSION_NUMBER ));
294 #if wxUSE_UNICODE
295 wxString tempStr(wxVERSION_STRING);
296 PyDict_SetItemString(d,"wxVERSION_STRING", PyUnicode_FromWideChar(tempStr.c_str(), tempStr.Len()));
297 #else
298 PyDict_SetItemString(d,"wxVERSION_STRING", PyString_FromString(wxVERSION_STRING));
299 #endif
300
301
302 %}
303
304 //----------------------------------------------------------------------
305 // And this gets appended to the shadow class file.
306 //----------------------------------------------------------------------
307
308 %pragma(python) include="_extras.py";
309
310