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 int* int_LIST_helper(PyObject* source);
20 extern long* long_LIST_helper(PyObject* source);
21 extern char** string_LIST_helper(PyObject* source);
22 extern wxPoint* wxPoint_LIST_helper(PyObject* source);
23 extern wxBitmap** wxBitmap_LIST_helper(PyObject* source);
24 extern wxString* wxString_LIST_helper(PyObject* source);
26 extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source);
31 //----------------------------------------------------------------------
33 %typemap(python,build) int LCOUNT {
34 $target = PyList_Size(_in_LIST);
39 %typemap(python,in) int* LIST {
40 $target = int_LIST_helper($source);
41 if ($target == NULL) {
45 %typemap(python,freearg) int* LIST {
50 %typemap(python,in) long* LIST {
51 $target = long_LIST_helper($source);
52 if ($target == NULL) {
56 %typemap(python,freearg) long* LIST {
61 %typemap(python,in) unsigned long* LIST {
62 $target = (unsigned long*)long_LIST_helper($source);
63 if ($target == NULL) {
67 %typemap(python,freearg) unsigned long* LIST {
73 %typemap(python,in) wxDash* LIST = unsigned long* LIST;
74 %typemap(python,freearg) wxDash* LIST = unsigned long* LIST;
77 %typemap(python,in) char** LIST {
78 $target = string_LIST_helper($source);
79 if ($target == NULL) {
83 %typemap(python,freearg) char** LIST {
89 %typemap(python,in) wxPoint* LIST {
90 $target = wxPoint_LIST_helper($source);
91 if ($target == NULL) {
95 %typemap(python,freearg) wxPoint* LIST {
99 %typemap(python,in) wxBitmap** LIST {
100 $target = wxBitmap_LIST_helper($source);
101 if ($target == NULL) {
105 %typemap(python,freearg) wxBitmap** LIST {
109 %typemap(python,in) wxString* LIST {
110 $target = wxString_LIST_helper($source);
111 if ($target == NULL) {
115 %typemap(python,freearg) wxString* LIST {
119 %typemap(python,in) wxAcceleratorEntry* LIST {
120 $target = wxAcceleratorEntry_LIST_helper($source);
121 if ($target == NULL) {
125 %typemap(python,freearg) wxAcceleratorEntry* LIST {
130 //---------------------------------------------------------------------------
133 static char* wxStringErrorMsg = "string type is required for parameter";
136 %typemap(python, in) wxString& {
137 if (!PyString_Check($source)) {
138 PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
141 $target = new wxString(PyString_AsString($source));
143 %typemap(python, freearg) wxString& {
150 %typemap(python, out) wxString {
151 $target = PyString_FromString(WXSTRINGCAST *($source));
153 %typemap(python, ret) wxString {
158 %typemap(python, out) wxString* {
159 $target = PyString_FromString(WXSTRINGCAST (*$source));
163 // --------------------------------------------------------------------
164 //---------------------------------------------------------------------------
168 // --------------------------------------------------------------------
169 // Map T_OUTPUTs for floats to return ints.
172 %typemap(python,ignore) float *T_OUTPUT_TOINT(float temp),
173 double *T_OUTPUT_TOINT(double temp)
179 %typemap(python,argout) float *T_OUTPUT_TOINT,
180 double *T_OUTPUT_TOINT
183 o = PyInt_FromLong((long) (*$source));
184 $target = t_output_helper($target, o);
187 //---------------------------------------------------------------------------
188 /////////////////////////////////////////////////////////////////////////////
191 // Revision 1.2 1998/08/14 23:36:39 RD
192 // Beginings of wxGTK compatibility
194 // Revision 1.1 1998/08/09 08:25:52 RD