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);
25 extern wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source);
29 //----------------------------------------------------------------------
31 %typemap(python,build) int LCOUNT {
32 $target = PyList_Size(_in_LIST);
37 %typemap(python,in) int* LIST {
38 $target = int_LIST_helper($source);
39 if ($target == NULL) {
43 %typemap(python,freearg) int* LIST {
48 %typemap(python,in) long* LIST {
49 $target = long_LIST_helper($source);
50 if ($target == NULL) {
54 %typemap(python,freearg) long* LIST {
59 %typemap(python,in) unsigned long* LIST {
60 $target = (unsigned long*)long_LIST_helper($source);
61 if ($target == NULL) {
65 %typemap(python,freearg) unsigned long* LIST {
71 %typemap(python,in) wxDash* LIST = unsigned long* LIST;
72 %typemap(python,freearg) wxDash* LIST = unsigned long* LIST;
75 %typemap(python,in) char** LIST {
76 $target = string_LIST_helper($source);
77 if ($target == NULL) {
81 %typemap(python,freearg) char** LIST {
87 %typemap(python,in) wxPoint* LIST {
88 $target = wxPoint_LIST_helper($source);
89 if ($target == NULL) {
93 %typemap(python,freearg) wxPoint* LIST {
97 %typemap(python,in) wxBitmap** LIST {
98 $target = wxBitmap_LIST_helper($source);
99 if ($target == NULL) {
103 %typemap(python,freearg) wxBitmap** LIST {
107 %typemap(python,in) wxString* LIST {
108 $target = wxString_LIST_helper($source);
109 if ($target == NULL) {
113 %typemap(python,freearg) wxString* LIST {
117 %typemap(python,in) wxAcceleratorEntry* LIST {
118 $target = wxAcceleratorEntry_LIST_helper($source);
119 if ($target == NULL) {
123 %typemap(python,freearg) wxAcceleratorEntry* LIST {
128 //---------------------------------------------------------------------------
131 static char* wxStringErrorMsg = "string type is required for parameter";
134 %typemap(python, in) wxString& {
135 if (!PyString_Check($source)) {
136 PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
139 $target = new wxString(PyString_AsString($source));
141 %typemap(python, freearg) wxString& {
148 %typemap(python, out) wxString {
149 $target = PyString_FromString(WXSTRINGCAST *($source));
151 %typemap(python, ret) wxString {
156 %typemap(python, out) wxString* {
157 $target = PyString_FromString(WXSTRINGCAST (*$source));
161 // --------------------------------------------------------------------
162 //---------------------------------------------------------------------------
166 // --------------------------------------------------------------------
167 // Map T_OUTPUTs for floats to return ints.
170 %typemap(python,ignore) float *T_OUTPUT_TOINT(float temp),
171 double *T_OUTPUT_TOINT(double temp)
177 %typemap(python,argout) float *T_OUTPUT_TOINT,
178 double *T_OUTPUT_TOINT
181 o = PyInt_FromLong((long) (*$source));
182 $target = t_output_helper($target, o);
185 //---------------------------------------------------------------------------
186 /////////////////////////////////////////////////////////////////////////////
189 // Revision 1.3 1998/11/15 23:03:47 RD
190 // Removing some ifdef's for wxGTK
192 // Revision 1.2 1998/08/14 23:36:39 RD
193 // Beginings of wxGTK compatibility
195 // Revision 1.1 1998/08/09 08:25:52 RD