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