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