X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bdb9373a32c8fa962b913a6a90fb6a24424137d2..4087064a382ca938e9b7889a9aafd6340b54d6c5:/wxPython/src/helpers.h diff --git a/wxPython/src/helpers.h b/wxPython/src/helpers.h index b542b5f2b4..8258295e46 100644 --- a/wxPython/src/helpers.h +++ b/wxPython/src/helpers.h @@ -52,7 +52,7 @@ void __wxPreStart(); PyObject* __wxStart(PyObject*, PyObject* args); void __wxCleanup(); -extern PyObject* wxPython_dict; +//extern PyObject* wxPython_dict; PyObject* __wxSetDictionary(PyObject*, PyObject* args); void wxPyEventThunker(wxObject*, wxEvent& event); @@ -60,6 +60,14 @@ void wxPyEventThunker(wxObject*, wxEvent& event); PyObject* wxPyConstructObject(void* ptr, const char* className, int setThisOwn=0); +PyObject* wxPyConstructObject(void* ptr, + const char* className, + PyObject* klass, + int setThisOwn=0); +PyObject* wxPyClassExists(const char* className); +PyObject* wxPyMake_wxObject(wxObject* source); +void wxPyPtrTypeMap_Add(const char* commonName, const char* ptrName); + bool wxPyRestoreThread(); void wxPySaveThread(bool doSave); PyObject* wxPy_ConvertList(wxListBase* list, const char* className); @@ -112,7 +120,7 @@ byte* byte_LIST_helper(PyObject* source); int* int_LIST_helper(PyObject* source); long* long_LIST_helper(PyObject* source); char** string_LIST_helper(PyObject* source); -wxPoint* wxPoint_LIST_helper(PyObject* source); +wxPoint* wxPoint_LIST_helper(PyObject* source, int* npoints); wxBitmap** wxBitmap_LIST_helper(PyObject* source); wxString* wxString_LIST_helper(PyObject* source); wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source); @@ -137,13 +145,6 @@ extern "C" char *SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type); # pragma warning(disable:4190) #endif - - -// Non-const versions to keep SWIG happy. -extern wxPoint wxPyDefaultPosition; -extern wxSize wxPyDefaultSize; -extern wxString wxPyEmptyStr; - //---------------------------------------------------------------------- class wxPyCallback : public wxObject { @@ -237,7 +238,7 @@ struct wxPyCoreAPI { int* (*p_int_LIST_helper)(PyObject* source); long* (*p_long_LIST_helper)(PyObject* source); char** (*p_string_LIST_helper)(PyObject* source); - wxPoint* (*p_wxPoint_LIST_helper)(PyObject* source); + wxPoint* (*p_wxPoint_LIST_helper)(PyObject* source, int* npoints); wxBitmap** (*p_wxBitmap_LIST_helper)(PyObject* source); wxString* (*p_wxString_LIST_helper)(PyObject* source); wxAcceleratorEntry* (*p_wxAcceleratorEntry_LIST_helper)(PyObject* source); @@ -254,6 +255,10 @@ struct wxPyCoreAPI { PyObject* (*p_wxPyCBH_callCallbackObj)(const wxPyCallbackHelper& cbh, PyObject* argTuple); void (*p_wxPyCBH_delete)(wxPyCallbackHelper* cbh); + PyObject* (*p_wxPyClassExists)(const char* className); + PyObject* (*p_wxPyMake_wxObject)(wxObject* source); + void (*p_wxPyPtrTypeMap_Add)(const char* commonName, const char* ptrName); + }; #ifdef wxPyUSE_EXPORT @@ -461,7 +466,7 @@ public: void CLASS::CBNAME(wxDC& a) { \ bool doSave = wxPyRestoreThread(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ @@ -486,7 +491,7 @@ public: void CLASS::CBNAME(wxDC& a, bool b) { \ bool doSave = wxPyRestoreThread(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ Py_DECREF(obj); \ } \ @@ -509,7 +514,7 @@ public: void CLASS::CBNAME(wxDC& a, bool b) { \ bool doSave = wxPyRestoreThread(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ Py_DECREF(obj); \ } \ @@ -573,7 +578,7 @@ public: void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ bool doSave = wxPyRestoreThread(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \ Py_DECREF(obj); \ } \ @@ -597,7 +602,7 @@ public: bool doSave = wxPyRestoreThread(); \ bool rval; \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + PyObject* obj = wxPyMake_wxObject(&a); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\ Py_DECREF(obj); \ } \ @@ -620,8 +625,8 @@ public: #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \ bool doSave = wxPyRestoreThread(); \ - if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ - wxPyCBH_callCallback(m_myInst, Py_BuildValue("(idii)", \ + if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ + wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \ (int)a,b,c,d,e)); \ else \ PCLASS::CBNAME(a, b, c, d, e); \ @@ -642,7 +647,7 @@ public: void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \ bool doSave = wxPyRestoreThread(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \ Py_DECREF(obj); \ } \ @@ -665,7 +670,7 @@ public: void CLASS::CBNAME(wxDC& a, bool b) { \ bool doSave = wxPyRestoreThread(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject(&a, "wxDC", 0); \ + PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ Py_DECREF(obj); \ } \ @@ -689,7 +694,7 @@ public: int e, int f) { \ bool doSave = wxPyRestoreThread(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject(a, "wxPyControlPoint", 0); \ + PyObject* obj = wxPyMake_wxObject(a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\ Py_DECREF(obj); \ } \ @@ -713,7 +718,7 @@ public: void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \ bool doSave = wxPyRestoreThread(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject(a, "wxPyControlPoint", 0); \ + PyObject* obj = wxPyMake_wxObject(a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \ Py_DECREF(obj); \ } \ @@ -954,7 +959,7 @@ public: bool rval = FALSE; \ bool doSave = wxPyRestoreThread(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)&a,"wxHtmlTag", 0); \ + PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ @@ -1012,7 +1017,7 @@ public: bool rval; \ bool doSave = wxPyRestoreThread(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ - PyObject* obj = wxPyConstructObject((void*)a,"wxWindow", 0);\ + PyObject* obj = wxPyMake_wxObject(a); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ @@ -1080,7 +1085,7 @@ public: wxFSFile* rval=0; \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ - PyObject* obj = wxPyConstructObject(&a, "wxFileSystem", 0); \ + PyObject* obj = wxPyMake_wxObject(&a); \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Os)", \ obj, b.c_str())); \ if (ro) { \