1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Special typemaps specifically for wxPython.
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
14 //---------------------------------------------------------------------------
15 // Tell SWIG to wrap all the wrappers with Python's thread macros
18 wxPy_BEGIN_ALLOW_THREADS;
20 wxPy_END_ALLOW_THREADS;
23 //----------------------------------------------------------------------
24 // Here are some to map (int LCOUNT, int* LIST), etc. from a python list
28 extern byte* byte_LIST_helper(PyObject* source);
29 extern int* int_LIST_helper(PyObject* source);
30 extern long* long_LIST_helper(PyObject* source);
31 extern char** string_LIST_helper(PyObject* source);
32 extern wxPoint* wxPoint_LIST_helper(PyObject* source);
33 extern wxBitmap** wxBitmap_LIST_helper(PyObject* source);
34 extern wxString* wxString_LIST_helper(PyObject* source);
35 extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source);
39 //----------------------------------------------------------------------
41 %typemap(python,build) int LCOUNT {
43 $target = PyList_Size(_in_LIST);
52 %typemap(python,in) byte* LIST {
53 $target = byte_LIST_helper($source);
54 if ($target == NULL) {
58 %typemap(python,freearg) byte* LIST {
63 %typemap(python,in) int* LIST {
64 $target = int_LIST_helper($source);
65 if ($target == NULL) {
69 %typemap(python,freearg) int* LIST {
74 %typemap(python,in) long* LIST {
75 $target = long_LIST_helper($source);
76 if ($target == NULL) {
80 %typemap(python,freearg) long* LIST {
85 %typemap(python,in) unsigned long* LIST {
86 $target = (unsigned long*)long_LIST_helper($source);
87 if ($target == NULL) {
91 %typemap(python,freearg) unsigned long* LIST {
97 %typemap(python,in) wxDash* LIST = unsigned long* LIST;
98 %typemap(python,freearg) wxDash* LIST = unsigned long* LIST;
101 %typemap(python,in) char** LIST {
102 $target = string_LIST_helper($source);
103 if ($target == NULL) {
107 %typemap(python,freearg) char** LIST {
113 %typemap(python,in) wxPoint* LIST {
114 $target = wxPoint_LIST_helper($source);
115 if ($target == NULL) {
119 %typemap(python,freearg) wxPoint* LIST {
123 %typemap(python,in) wxBitmap** LIST {
124 $target = wxBitmap_LIST_helper($source);
125 if ($target == NULL) {
129 %typemap(python,freearg) wxBitmap** LIST {
133 %typemap(python,in) wxString* LIST {
134 $target = wxString_LIST_helper($source);
135 if ($target == NULL) {
139 %typemap(python,freearg) wxString* LIST {
143 %typemap(python,in) wxAcceleratorEntry* LIST {
144 $target = wxAcceleratorEntry_LIST_helper($source);
145 if ($target == NULL) {
149 %typemap(python,freearg) wxAcceleratorEntry* LIST {
154 //---------------------------------------------------------------------------
157 static char* wxStringErrorMsg = "string type is required for parameter";
160 %typemap(python, in) wxString& {
161 if (!PyString_Check($source)) {
162 PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
165 $target = new wxString(PyString_AsString($source), PyString_Size($source));
167 %typemap(python, freearg) wxString& {
174 %typemap(python, out) wxString {
175 $target = PyString_FromString(WXSTRINGCAST *($source));
177 %typemap(python, ret) wxString {
182 %typemap(python, out) wxString* {
183 $target = PyString_FromString(WXSTRINGCAST (*$source));
187 // --------------------------------------------------------------------
188 //---------------------------------------------------------------------------
192 // --------------------------------------------------------------------
193 // Map T_OUTPUTs for floats to return ints.
196 %typemap(python,ignore) float *T_OUTPUT_TOINT(float temp),
197 double *T_OUTPUT_TOINT(double temp)
203 %typemap(python,argout) float *T_OUTPUT_TOINT,
204 double *T_OUTPUT_TOINT
207 o = PyInt_FromLong((long) (*$source));
208 $target = t_output_helper($target, o);
211 //---------------------------------------------------------------------------
212 /////////////////////////////////////////////////////////////////////////////
215 // Revision 1.5 1999/04/30 03:29:19 RD
216 // wxPython 2.0b9, first phase (win32)
217 // Added gobs of stuff, see wxPython/README.txt for details
219 // Revision 1.4.4.2 1999/03/28 06:35:01 RD
222 // Python thread support
223 // various minor additions
224 // various minor fixes
226 // Revision 1.4.4.1 1999/03/16 06:04:03 RD
230 // Revision 1.4 1998/11/25 08:45:27 RD
232 // Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
233 // Added events for wxGrid
234 // Other various fixes and additions
236 // Revision 1.3 1998/11/15 23:03:47 RD
237 // Removing some ifdef's for wxGTK
239 // Revision 1.2 1998/08/14 23:36:39 RD
240 // Beginings of wxGTK compatibility
242 // Revision 1.1 1998/08/09 08:25:52 RD