1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Special typemaps specifically for wxPython.
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
14 //----------------------------------------------------------------------
15 // Here are some to map (int LCOUNT, int* LIST), etc. from a python list
19 extern byte* byte_LIST_helper(PyObject* source);
20 extern int* int_LIST_helper(PyObject* source);
21 extern long* long_LIST_helper(PyObject* source);
22 extern char** string_LIST_helper(PyObject* source);
23 extern wxPoint* wxPoint_LIST_helper(PyObject* source);
24 extern wxBitmap** wxBitmap_LIST_helper(PyObject* source);
25 extern wxString* wxString_LIST_helper(PyObject* source);
26 extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source);
30 //----------------------------------------------------------------------
32 %typemap(python,build) int LCOUNT {
33 $target = PyList_Size(_in_LIST);
38 %typemap(python,in) byte* LIST {
39 $target = byte_LIST_helper($source);
40 if ($target == NULL) {
44 %typemap(python,freearg) byte* LIST {
49 %typemap(python,in) int* LIST {
50 $target = int_LIST_helper($source);
51 if ($target == NULL) {
55 %typemap(python,freearg) int* LIST {
60 %typemap(python,in) long* LIST {
61 $target = long_LIST_helper($source);
62 if ($target == NULL) {
66 %typemap(python,freearg) long* LIST {
71 %typemap(python,in) unsigned long* LIST {
72 $target = (unsigned long*)long_LIST_helper($source);
73 if ($target == NULL) {
77 %typemap(python,freearg) unsigned long* LIST {
83 %typemap(python,in) wxDash* LIST = unsigned long* LIST;
84 %typemap(python,freearg) wxDash* LIST = unsigned long* LIST;
87 %typemap(python,in) char** LIST {
88 $target = string_LIST_helper($source);
89 if ($target == NULL) {
93 %typemap(python,freearg) char** LIST {
99 %typemap(python,in) wxPoint* LIST {
100 $target = wxPoint_LIST_helper($source);
101 if ($target == NULL) {
105 %typemap(python,freearg) wxPoint* LIST {
109 %typemap(python,in) wxBitmap** LIST {
110 $target = wxBitmap_LIST_helper($source);
111 if ($target == NULL) {
115 %typemap(python,freearg) wxBitmap** LIST {
119 %typemap(python,in) wxString* LIST {
120 $target = wxString_LIST_helper($source);
121 if ($target == NULL) {
125 %typemap(python,freearg) wxString* LIST {
129 %typemap(python,in) wxAcceleratorEntry* LIST {
130 $target = wxAcceleratorEntry_LIST_helper($source);
131 if ($target == NULL) {
135 %typemap(python,freearg) wxAcceleratorEntry* LIST {
140 //---------------------------------------------------------------------------
143 static char* wxStringErrorMsg = "string type is required for parameter";
146 %typemap(python, in) wxString& {
147 if (!PyString_Check($source)) {
148 PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
151 $target = new wxString(PyString_AsString($source));
153 %typemap(python, freearg) wxString& {
160 %typemap(python, out) wxString {
161 $target = PyString_FromString(WXSTRINGCAST *($source));
163 %typemap(python, ret) wxString {
168 %typemap(python, out) wxString* {
169 $target = PyString_FromString(WXSTRINGCAST (*$source));
173 // --------------------------------------------------------------------
174 //---------------------------------------------------------------------------
178 // --------------------------------------------------------------------
179 // Map T_OUTPUTs for floats to return ints.
182 %typemap(python,ignore) float *T_OUTPUT_TOINT(float temp),
183 double *T_OUTPUT_TOINT(double temp)
189 %typemap(python,argout) float *T_OUTPUT_TOINT,
190 double *T_OUTPUT_TOINT
193 o = PyInt_FromLong((long) (*$source));
194 $target = t_output_helper($target, o);
197 //---------------------------------------------------------------------------
198 /////////////////////////////////////////////////////////////////////////////
201 // Revision 1.4 1998/11/25 08:45:27 RD
202 // Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon
203 // Added events for wxGrid
204 // Other various fixes and additions
206 // Revision 1.3 1998/11/15 23:03:47 RD
207 // Removing some ifdef's for wxGTK
209 // Revision 1.2 1998/08/14 23:36:39 RD
210 // Beginings of wxGTK compatibility
212 // Revision 1.1 1998/08/09 08:25:52 RD