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