]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/wx.i
More unicode related cleanup and fixes for wxPython
[wxWidgets.git] / wxPython / src / wx.i
CommitLineData
7bf85405
RD
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
b8b8dda7 13%module wx
03e9bead 14
03e9bead 15%{
7bf85405
RD
16#include "helpers.h"
17%}
18
c5943253 19
7bf85405
RD
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
7bf85405
RD
49
50%native(_wxStart) __wxStart;
51%native(_wxSetDictionary) __wxSetDictionary;
52
53//---------------------------------------------------------------------------
54
2f90df85 55
de20db99 56#define __version__ "0.0.0" // The real value is now in setup.py...
7bf85405 57
35d60de2 58%readonly
b68dc582
RD
59wxPoint wxDefaultPosition;
60wxSize wxDefaultSize;
35d60de2 61%readwrite
7bf85405
RD
62
63//---------------------------------------------------------------------------
64//---------------------------------------------------------------------------
65
66class wxPyApp : public wxEvtHandler {
67public:
68 %addmethods {
69 wxPyApp() {
70 wxPythonApp = new wxPyApp();
71 return wxPythonApp;
72 }
73 }
74
8bf5d46e 75 ~wxPyApp();
7bf85405
RD
76
77 wxString GetAppName();
853b255a 78#ifdef __WXMSW__
7bf85405 79 bool GetAuto3D();
853b255a 80#endif
7bf85405
RD
81 wxString GetClassName();
82 bool GetExitOnFrameDelete();
83 int GetPrintMode();
84 wxWindow * GetTopWindow();
85 wxString GetVendorName();
f6bcfd97 86 bool GetUseBestVisual();
7bf85405
RD
87
88 void Dispatch();
89 void ExitMainLoop();
90 bool Initialized();
91 int MainLoop();
92 bool Pending();
8bf5d46e 93 bool ProcessIdle();
7bf85405
RD
94
95 void SetAppName(const wxString& name);
853b255a 96#ifdef __WXMSW__
7bf85405 97 void SetAuto3D(bool auto3D);
853b255a 98#endif
7bf85405
RD
99 void SetClassName(const wxString& name);
100 void SetExitOnFrameDelete(bool flag);
101 void SetPrintMode(int mode);
102 void SetTopWindow(wxWindow* window);
103 void SetVendorName(const wxString& name);
f6bcfd97 104 void SetUseBestVisual(bool flag);
8bf5d46e 105 wxIcon GetStdIcon(int which);
8bf5d46e
RD
106};
107
c368d904
RD
108%inline %{
109 wxPyApp* wxGetApp() {
110 return wxPythonApp;
111 }
112%}
8bf5d46e 113
c5943253
RD
114
115
8bf5d46e 116//----------------------------------------------------------------------
b1462dfa 117// this is used to cleanup after wxWindows when Python shuts down.
8bf5d46e 118
b1462dfa
RD
119%inline %{
120 void wxApp_CleanUp() {
7ff49f0c 121 __wxCleanup();
b1462dfa 122 }
8bf5d46e
RD
123%}
124
7bf85405
RD
125//----------------------------------------------------------------------
126// This code gets added to the module initialization function
127//----------------------------------------------------------------------
128
129%{
1e7ecb7b
RD
130
131
1d99702e
RD
132extern "C" SWIGEXPORT(void) initwindowsc();
133extern "C" SWIGEXPORT(void) initwindows2c();
134extern "C" SWIGEXPORT(void) initeventsc();
135extern "C" SWIGEXPORT(void) initmiscc();
136extern "C" SWIGEXPORT(void) initmisc2c();
137extern "C" SWIGEXPORT(void) initgdic();
138extern "C" SWIGEXPORT(void) initmdic();
139extern "C" SWIGEXPORT(void) initcontrolsc();
140extern "C" SWIGEXPORT(void) initcontrols2c();
141extern "C" SWIGEXPORT(void) initcmndlgsc();
142extern "C" SWIGEXPORT(void) initstattoolc();
143extern "C" SWIGEXPORT(void) initframesc();
144extern "C" SWIGEXPORT(void) initwindows3c();
145extern "C" SWIGEXPORT(void) initimagec();
146extern "C" SWIGEXPORT(void) initprintfwc();
2f90df85 147extern "C" SWIGEXPORT(void) initsizersc();
b1462dfa 148extern "C" SWIGEXPORT(void) initclip_dndc();
c368d904
RD
149extern "C" SWIGEXPORT(void) initstreamsc();
150extern "C" SWIGEXPORT(void) initfilesysc();
96e5ef76 151extern "C" SWIGEXPORT(void) initutilsc();
c368d904 152
1e7ecb7b
RD
153
154
155// Export a C API in a struct. Other modules will be able to load this from
156// the wxc module and will then have safe access to these functions, even if
157// in another shared library.
158static wxPyCoreAPI API = {
159 SWIG_MakePtr,
160 SWIG_GetPtr,
161 SWIG_GetPtrObj,
162 SWIG_RegisterMapping,
163 SWIG_addvarlink,
164 SWIG_newvarlink,
165
4268f798
RD
166 wxPyBeginAllowThreads,
167 wxPyEndAllowThreads,
19a97bd6
RD
168 wxPyBeginBlockThreads,
169 wxPyEndBlockThreads,
170
1e7ecb7b
RD
171 wxPyConstructObject,
172 wxPy_ConvertList,
173
c8bc7bb8 174 wxString_in_helper,
a541c325
RD
175 Py2wxString,
176 wx2PyString,
177
1e7ecb7b
RD
178 byte_LIST_helper,
179 int_LIST_helper,
180 long_LIST_helper,
181 string_LIST_helper,
182 wxPoint_LIST_helper,
183 wxBitmap_LIST_helper,
184 wxString_LIST_helper,
185 wxAcceleratorEntry_LIST_helper,
186
187 wxSize_helper,
188 wxPoint_helper,
189 wxRealPoint_helper,
190 wxRect_helper,
191 wxColour_helper,
192
0122b7e3 193 wxPyCBH_setCallbackInfo,
1e7ecb7b
RD
194 wxPyCBH_findCallback,
195 wxPyCBH_callCallback,
196 wxPyCBH_callCallbackObj,
197 wxPyCBH_delete,
9416aa89
RD
198
199 wxPyClassExists,
200 wxPyMake_wxObject,
2f4e9287 201 wxPyMake_wxSizer,
9416aa89 202 wxPyPtrTypeMap_Add,
293a0a86
RD
203 wxArrayString2PyList_helper,
204 wxArrayInt2PyList_helper
1e7ecb7b
RD
205};
206
9416aa89 207
0699c864 208%}
08127323 209
7bf85405 210
7bf85405
RD
211
212%init %{
1e7ecb7b
RD
213 // Make our API structure a CObject so other modules can import it
214 // from this module.
215 PyObject* v = PyCObject_FromVoidPtr(&API, NULL);
216 PyDict_SetItemString(d,"wxPyCoreAPI", v);
217 Py_XDECREF(v);
218
7bf85405 219
0d6f9504 220 __wxPreStart(); // initialize the GUI toolkit, if needed.
7bf85405 221
7bf85405
RD
222
223 // Since these modules are all linked together, initialize them now
f6bcfd97 224 // because Python won't be able to find their shared library files,
7bf85405
RD
225 // (since there isn't any.)
226 initwindowsc();
227 initwindows2c();
228 initeventsc();
229 initmiscc();
bb0054cd 230 initmisc2c();
7bf85405
RD
231 initgdic();
232 initmdic();
233 initcontrolsc();
234 initcontrols2c();
235 initcmndlgsc();
9c039d08
RD
236 initstattoolc();
237 initframesc();
08127323 238 initwindows3c();
cf694132 239 initimagec();
bb0054cd 240 initprintfwc();
2f90df85 241 initsizersc();
b1462dfa 242 initclip_dndc();
c368d904
RD
243 initstreamsc();
244 initfilesysc();
96e5ef76 245 initutilsc();
f6bcfd97 246
a3fbed81
RD
247
248 PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION ));
249 PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION ));
250 PyDict_SetItemString(d,"wxRELEASE_NUMBER", PyInt_FromLong((long)wxRELEASE_NUMBER ));
251 PyDict_SetItemString(d,"wxVERSION_NUMBER", PyInt_FromLong((long)wxVERSION_NUMBER ));
c8bc7bb8
RD
252#if wxUSE_UNICODE
253 wxString tempStr(wxVERSION_STRING);
254 PyDict_SetItemString(d,"wxVERSION_STRING", PyUnicode_FromUnicode(tempStr.c_str(), tempStr.Len()));
255#else
a3fbed81 256 PyDict_SetItemString(d,"wxVERSION_STRING", PyString_FromString(wxVERSION_STRING));
c8bc7bb8 257#endif
a3fbed81
RD
258
259
7bf85405
RD
260%}
261
262//----------------------------------------------------------------------
263// And this gets appended to the shadow class file.
264//----------------------------------------------------------------------
265
266%pragma(python) include="_extras.py";
267
268