X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd9f7fea29e3f8bb61861f52984b7943512346ac..700c96d420c7413ff2220e16e848962bdd2e45eb:/wxPython/src/my_typemaps.i diff --git a/wxPython/src/my_typemaps.i b/wxPython/src/my_typemaps.i index 7b73b7a73e..ff4994d928 100644 --- a/wxPython/src/my_typemaps.i +++ b/wxPython/src/my_typemaps.i @@ -35,8 +35,6 @@ } - - //--------------------------------------------------------------------------- // wxString typemaps @@ -51,21 +49,24 @@ delete $1; } - - -%typemap(out) wxString { +%typemap(out) wxString& { %#if wxUSE_UNICODE - $result = PyUnicode_FromWideChar($1.c_str(), $1.Len()); + $result = PyUnicode_FromWideChar($1->c_str(), $1->Len()); %#else - $result = PyString_FromStringAndSize($1.c_str(), $1.Len()); + $result = PyString_FromStringAndSize($1->c_str(), $1->Len()); %#endif } -%typemap(out) wxString* { + +%apply wxString& { wxString* } + + + +%typemap(out) wxString { %#if wxUSE_UNICODE - $result = PyUnicode_FromWideChar($1->c_str(), $1->Len()); + $result = PyUnicode_FromWideChar($1.c_str(), $1.Len()); %#else - $result = PyString_FromStringAndSize($1->c_str(), $1->Len()); + $result = PyString_FromStringAndSize($1.c_str(), $1.Len()); %#endif } @@ -87,34 +88,6 @@ -// //--------------------------------------------------------------------------- - - -// %typemap(python, in) wxMemoryBuffer& { -// if (!PyString_Check($source)) { -// PyErr_SetString(PyExc_TypeError, "String buffer expected"); -// return NULL; -// } -// char* str = PyString_AS_STRING($source); -// int len = PyString_GET_SIZE($source); -// $target = new wxMemoryBuffer(len); -// memcpy($target->GetData(), str, len); -// } - -// %typemap(python, freearg) wxMemoryBuffer& { -// if ($target) -// delete $source; -// } - -// %typemap(python, out) wxMemoryBuffer { -// $target = PyString_FromStringAndSize((char*)$source->GetData(), $source->GetDataLen()); -// } - -// %typemap(python, ret) wxMemoryBuffer { -// delete $source; -// } - - //--------------------------------------------------------------------------- // Typemaps to convert Python sequence objects (tuples, etc.) to // wxSize, wxPoint, wxRealPoint, and wxRect. @@ -264,62 +237,6 @@ } -// //--------------------------------------------------------------------------- -// // Map T_OUTPUTs for floats to return ints. - - -// %typemap(python,ignore) float *T_OUTPUT_TOINT(float temp), -// double *T_OUTPUT_TOINT(double temp) -// { -// $target = &temp; -// } - - -// %typemap(python,argout) float *T_OUTPUT_TOINT, -// double *T_OUTPUT_TOINT -// { -// PyObject *o; -// o = PyInt_FromLong((long) (*$source)); -// $target = t_output_helper($target, o); -// } - - -// %typemap(python,ignore) bool *T_OUTPUT(int temp) -// { -// $target = (bool*)&temp; -// } - -// %typemap(python,argout) bool *T_OUTPUT -// { -// PyObject *o; -// o = PyInt_FromLong((long) (*$source)); -// $target = t_output_helper($target, o); -// } - -// %typemap(python,ignore) bool *OUTPUT = bool *T_OUTPUT; -// %typemap(python,argout) bool *OUTPUT = bool *T_OUTPUT; - - - -// %typemap(python,ignore) byte *T_OUTPUT(int temp) -// { -// $target = (byte*)&temp; -// } - -// %typemap(python,argout) byte *T_OUTPUT -// { -// PyObject *o; -// o = PyInt_FromLong((long) (*$source)); -// $target = t_output_helper($target, o); -// } - -// %typemap(python,ignore) byte *OUTPUT = byte *T_OUTPUT; -// %typemap(python,argout) byte *OUTPUT = byte *T_OUTPUT; - - -// %typemap(python,ignore) wxCoord *OUTPUT = int *OUTPUT; -// %typemap(python,argout) wxCoord *OUTPUT = int *OUTPUT; - //--------------------------------------------------------------------------- // Typemaps to convert return values that are base class pointers @@ -362,6 +279,7 @@ %typemap(out) wxToolBar* { $result = wxPyMake_wxObject($1); } %typemap(out) wxToolBarBase* { $result = wxPyMake_wxObject($1); } %typemap(out) wxTreeCtrl* { $result = wxPyMake_wxObject($1); } +%typemap(out) wxPyTreeCtrl* { $result = wxPyMake_wxObject($1); } %typemap(out) wxWindow* { $result = wxPyMake_wxObject($1); } %typemap(out) wxHtmlWindow* { $result = wxPyMake_wxObject($1); } %typemap(out) wxPyHtmlWindow* { $result = wxPyMake_wxObject($1); }