X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/214c4fbea5875368cc21a082d20cb082cd38cb3c..38b2e0de1806b8c5e723cdd04d20ce2b911ed5c4:/wxPython/src/_core_api.i?ds=sidebyside diff --git a/wxPython/src/_core_api.i b/wxPython/src/_core_api.i index 153124b842..1761c48813 100644 --- a/wxPython/src/_core_api.i +++ b/wxPython/src/_core_api.i @@ -20,8 +20,57 @@ // located here so they know about the SWIG types and functions declared // in the wrapper code. +static +swig_type_info* wxPyFindSwigType(const wxChar* className); + +%} + + +#if SWIG_VERSION < 0x010328 +%{ +// Make a SWIGified pointer object suitable for a .this attribute +PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* className) { + + PyObject* robj = NULL; + + swig_type_info* swigType = wxPyFindSwigType(className); + wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyMakeSwigPtr")); + +#ifdef SWIG_COBJECT_TYPES + robj = PySwigObject_FromVoidPtrAndDesc((void *) ptr, (char *)swigType->name); +#else + { + char result[1024]; + robj = SWIG_PackVoidPtr(result, ptr, swigType->name, sizeof(result)) ? + PyString_FromString(result) : 0; + } +#endif + return robj; +} +%} + +#else // SWIG_VERSION >= 1.3.28 +%{ +// Make a SWIGified pointer object suitable for a .this attribute +PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* className) { + + PyObject* robj = NULL; + + swig_type_info* swigType = wxPyFindSwigType(className); + wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyMakeSwigPtr")); + + robj = PySwigObject_New(ptr, swigType, 0); + return robj; +} +%} +#endif + + + + +%{ #include - WX_DECLARE_STRING_HASH_MAP( swig_type_info*, wxPyTypeInfoHashMap ); +WX_DECLARE_STRING_HASH_MAP( swig_type_info*, wxPyTypeInfoHashMap ); // Maintains a hashmap of className to swig_type_info pointers. Given the @@ -100,29 +149,6 @@ bool wxPyConvertSwigPtr(PyObject* obj, void **ptr, } -// Make a SWIGified pointer object suitable for a .this attribute -PyObject* wxPyMakeSwigPtr(void* ptr, const wxChar* className) { - - PyObject* robj = NULL; - - swig_type_info* swigType = wxPyFindSwigType(className); - wxCHECK_MSG(swigType != NULL, NULL, wxT("Unknown type in wxPyMakeSwigPtr")); - -#if SWIG_VERSION < 0x010328 -#ifdef SWIG_COBJECT_TYPES - robj = PySwigObject_FromVoidPtrAndDesc((void *) ptr, (char *)swigType->name); -#else - { - char result[1024]; - robj = SWIG_PackVoidPtr(result, ptr, swigType->name, sizeof(result)) ? - PyString_FromString(result) : 0; - } -#endif -#else // SWIG_VERSION >= 1.3.28 - robj = PySwigObject_New(ptr, swigType, 0); -#endif - return robj; -} // Python's PyInstance_Check does not return True for instances of new-style