]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/wx.i
Added wxAccessible documentation
[wxWidgets.git] / wxPython / src / wx.i
CommitLineData
7bf85405 1/////////////////////////////////////////////////////////////////////////////
1e4a197e 2// Name: wx.i
7bf85405
RD
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
b8b8dda7 13%module wx
03e9bead 14
203c2f9a 15
03e9bead 16%{
7bf85405
RD
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
8bf5d46e
RD
28%include pointer.i
29
7bf85405 30%import misc.i
bb0054cd 31%import misc2.i
7bf85405
RD
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
9c039d08
RD
40%import stattool.i
41%import frames.i
08127323 42%import windows3.i
cf694132 43%import image.i
bb0054cd 44%import printfw.i
2f90df85 45%import sizers.i
c368d904
RD
46%import streams.i
47%import filesys.i
96e5ef76 48%import utils.i
68bc8549
RD
49%import fonts.i
50
7bf85405
RD
51
52%native(_wxStart) __wxStart;
53%native(_wxSetDictionary) __wxSetDictionary;
54
55//---------------------------------------------------------------------------
56
2f90df85 57
de20db99 58#define __version__ "0.0.0" // The real value is now in setup.py...
7bf85405 59
35d60de2 60%readonly
b68dc582
RD
61wxPoint wxDefaultPosition;
62wxSize wxDefaultSize;
35d60de2 63%readwrite
7bf85405
RD
64
65//---------------------------------------------------------------------------
66//---------------------------------------------------------------------------
67
1e4a197e
RD
68enum {
69 wxPYAPP_ASSERT_SUPPRESS = 1,
70 wxPYAPP_ASSERT_EXCEPTION = 2,
71 wxPYAPP_ASSERT_DIALOG = 4,
72 wxPYAPP_ASSERT_LOG = 8
73};
74
75
7bf85405
RD
76class wxPyApp : public wxEvtHandler {
77public:
78 %addmethods {
79 wxPyApp() {
80 wxPythonApp = new wxPyApp();
81 return wxPythonApp;
82 }
83 }
84
8bf5d46e 85 ~wxPyApp();
7bf85405 86
1e4a197e
RD
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
7bf85405 92 wxString GetAppName();
853b255a 93#ifdef __WXMSW__
7bf85405 94 bool GetAuto3D();
853b255a 95#endif
7bf85405
RD
96 wxString GetClassName();
97 bool GetExitOnFrameDelete();
98 int GetPrintMode();
99 wxWindow * GetTopWindow();
100 wxString GetVendorName();
f6bcfd97 101 bool GetUseBestVisual();
7bf85405
RD
102
103 void Dispatch();
104 void ExitMainLoop();
105 bool Initialized();
106 int MainLoop();
107 bool Pending();
8bf5d46e 108 bool ProcessIdle();
fd512ba2 109 bool Yield(bool onlyIfNeeded = FALSE);
7bf85405
RD
110
111 void SetAppName(const wxString& name);
853b255a 112#ifdef __WXMSW__
7bf85405 113 void SetAuto3D(bool auto3D);
853b255a 114#endif
7bf85405
RD
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);
f6bcfd97 120 void SetUseBestVisual(bool flag);
1e4a197e
RD
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);
8bf5d46e
RD
139};
140
c368d904
RD
141%inline %{
142 wxPyApp* wxGetApp() {
19e30148 143 //return wxPythonApp;
a2426843 144 return (wxPyApp*)wxTheApp;
c368d904
RD
145 }
146%}
8bf5d46e 147
c5943253 148
8bf5d46e 149//----------------------------------------------------------------------
b1462dfa 150// this is used to cleanup after wxWindows when Python shuts down.
8bf5d46e 151
b1462dfa
RD
152%inline %{
153 void wxApp_CleanUp() {
7ff49f0c 154 __wxCleanup();
b1462dfa 155 }
8bf5d46e
RD
156%}
157
7bf85405
RD
158//----------------------------------------------------------------------
159// This code gets added to the module initialization function
160//----------------------------------------------------------------------
161
162%{
1e7ecb7b
RD
163
164
1d99702e
RD
165extern "C" SWIGEXPORT(void) initwindowsc();
166extern "C" SWIGEXPORT(void) initwindows2c();
167extern "C" SWIGEXPORT(void) initeventsc();
168extern "C" SWIGEXPORT(void) initmiscc();
169extern "C" SWIGEXPORT(void) initmisc2c();
170extern "C" SWIGEXPORT(void) initgdic();
171extern "C" SWIGEXPORT(void) initmdic();
172extern "C" SWIGEXPORT(void) initcontrolsc();
173extern "C" SWIGEXPORT(void) initcontrols2c();
174extern "C" SWIGEXPORT(void) initcmndlgsc();
175extern "C" SWIGEXPORT(void) initstattoolc();
176extern "C" SWIGEXPORT(void) initframesc();
177extern "C" SWIGEXPORT(void) initwindows3c();
178extern "C" SWIGEXPORT(void) initimagec();
179extern "C" SWIGEXPORT(void) initprintfwc();
2f90df85 180extern "C" SWIGEXPORT(void) initsizersc();
b1462dfa 181extern "C" SWIGEXPORT(void) initclip_dndc();
c368d904
RD
182extern "C" SWIGEXPORT(void) initstreamsc();
183extern "C" SWIGEXPORT(void) initfilesysc();
96e5ef76 184extern "C" SWIGEXPORT(void) initutilsc();
68bc8549 185extern "C" SWIGEXPORT(void) initfontsc();
c368d904 186
1e7ecb7b
RD
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.
192static wxPyCoreAPI API = {
bc5f2236
RD
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,
1e7ecb7b 199
4268f798
RD
200 wxPyBeginAllowThreads,
201 wxPyEndAllowThreads,
19a97bd6
RD
202 wxPyBeginBlockThreads,
203 wxPyEndBlockThreads,
204
1e7ecb7b
RD
205 wxPyConstructObject,
206 wxPy_ConvertList,
207
c8bc7bb8 208 wxString_in_helper,
a541c325
RD
209 Py2wxString,
210 wx2PyString,
211
1e7ecb7b
RD
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,
1e4a197e 226 wxPoint2DDouble_helper,
1e7ecb7b 227
0122b7e3 228 wxPyCBH_setCallbackInfo,
1e7ecb7b
RD
229 wxPyCBH_findCallback,
230 wxPyCBH_callCallback,
231 wxPyCBH_callCallbackObj,
232 wxPyCBH_delete,
9416aa89
RD
233
234 wxPyClassExists,
235 wxPyMake_wxObject,
2f4e9287 236 wxPyMake_wxSizer,
9416aa89 237 wxPyPtrTypeMap_Add,
293a0a86 238 wxArrayString2PyList_helper,
4acff284
RD
239 wxArrayInt2PyList_helper,
240
241 wxPyClientData_dtor,
242 wxPyUserData_dtor,
249a57f4
RD
243 wxPyOORClientData_dtor,
244
245 wxPyCBInputStream_create
1e7ecb7b
RD
246};
247
9416aa89 248
0699c864 249%}
08127323 250
7bf85405 251
7bf85405
RD
252
253%init %{
1e7ecb7b
RD
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
7bf85405 260
1e4a197e 261 __wxPreStart(d); // initialize the GUI toolkit, if needed.
7bf85405 262
7bf85405
RD
263
264 // Since these modules are all linked together, initialize them now
f6bcfd97 265 // because Python won't be able to find their shared library files,
7bf85405
RD
266 // (since there isn't any.)
267 initwindowsc();
268 initwindows2c();
269 initeventsc();
270 initmiscc();
bb0054cd 271 initmisc2c();
7bf85405
RD
272 initgdic();
273 initmdic();
274 initcontrolsc();
275 initcontrols2c();
276 initcmndlgsc();
9c039d08
RD
277 initstattoolc();
278 initframesc();
08127323 279 initwindows3c();
cf694132 280 initimagec();
bb0054cd 281 initprintfwc();
2f90df85 282 initsizersc();
b1462dfa 283 initclip_dndc();
c368d904
RD
284 initstreamsc();
285 initfilesysc();
96e5ef76 286 initutilsc();
68bc8549 287 initfontsc();
f6bcfd97 288
a3fbed81
RD
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 ));
c8bc7bb8
RD
294#if wxUSE_UNICODE
295 wxString tempStr(wxVERSION_STRING);
1e4a197e 296 PyDict_SetItemString(d,"wxVERSION_STRING", PyUnicode_FromWideChar(tempStr.c_str(), tempStr.Len()));
c8bc7bb8 297#else
a3fbed81 298 PyDict_SetItemString(d,"wxVERSION_STRING", PyString_FromString(wxVERSION_STRING));
c8bc7bb8 299#endif
a3fbed81
RD
300
301
7bf85405
RD
302%}
303
304//----------------------------------------------------------------------
305// And this gets appended to the shadow class file.
306//----------------------------------------------------------------------
307
308%pragma(python) include="_extras.py";
309
1e4a197e 310