X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/07b2e1cd389c16c05d74adedf92fda3ca785f2bd..c331ac2ed75ba5c435d745e9282c27a339da4f18:/wxPython/src/helpers.h diff --git a/wxPython/src/helpers.h b/wxPython/src/helpers.h index e31bed8bc2..ffab121edf 100644 --- a/wxPython/src/helpers.h +++ b/wxPython/src/helpers.h @@ -15,21 +15,6 @@ #include -//---------------------------------------------------------------------- - -// if we want to handle threads and Python threads are available... -#if defined(WXP_USE_THREAD) && defined(WITH_THREAD) - -#define WXP_WITH_THREAD -#define wxPy_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS -#define wxPy_END_ALLOW_THREADS Py_END_ALLOW_THREADS - -#else // no Python threads... -#undef WXP_WITH_THREAD -#define wxPy_BEGIN_ALLOW_THREADS -#define wxPy_END_ALLOW_THREADS -#endif - //--------------------------------------------------------------------------- @@ -41,9 +26,10 @@ class wxPyApp: public wxApp public: wxPyApp(); ~wxPyApp(); - int MainLoop(void); - bool OnInit(void); + bool OnInit(); + int MainLoop(); }; + extern wxPyApp *wxPythonApp; //---------------------------------------------------------------------- @@ -65,7 +51,8 @@ PyObject* wxPyConstructObject(void* ptr, PyObject* klass, int setThisOwn=0); PyObject* wxPyClassExists(const char* className); -PyObject* wxPyMake_wxObject(wxObject* source); +PyObject* wxPyMake_wxObject(wxObject* source, bool checkEvtHandler=TRUE); +PyObject* wxPyMake_wxSizer(wxSizer* source); void wxPyPtrTypeMap_Add(const char* commonName, const char* ptrName); PyObject* wxPy_ConvertList(wxListBase* list, const char* className); @@ -73,17 +60,21 @@ long wxPyGetWinHandle(wxWindow* win); //---------------------------------------------------------------------- -struct wxPyTState { - PyThreadState* newState; - PyThreadState* prevState; - - wxPyTState() : newState(NULL), prevState(NULL) {} -}; +// if we want to handle threads and Python threads are available... +#if defined(WXP_USE_THREAD) && defined(WITH_THREAD) +#define WXP_WITH_THREAD +#else // no Python threads... +#undef WXP_WITH_THREAD +#endif -wxPyTState* wxPyBeginBlockThreads(); -void wxPyEndBlockThreads(wxPyTState* state); +// For Python --> C++ +PyThreadState* wxPyBeginAllowThreads(); +void wxPyEndAllowThreads(PyThreadState* state); +// For C++ --> Python +void wxPyBeginBlockThreads(); +void wxPyEndBlockThreads(); //---------------------------------------------------------------------- // Handle wxInputStreams by Joerg Baumann @@ -151,7 +142,8 @@ bool _2int_seq_helper(PyObject* source, int* i1, int* i2); bool _4int_seq_helper(PyObject* source, int* i1, int* i2, int* i3, int* i4); -PyObject* wxArrayString2PyList_helper(const wxArrayString& app); +PyObject* wxArrayString2PyList_helper(const wxArrayString& arr); +PyObject* wxArrayInt2PyList_helper(const wxArrayInt& arr); #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; } @@ -256,8 +248,10 @@ struct wxPyCoreAPI { void (*p_SWIG_addvarlink)(PyObject*, char*, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)); PyObject* (*p_SWIG_newvarlink)(void); - wxPyTState* (*p_wxPyBeginBlockThreads)(); - void (*p_wxPyEndBlockThreads)(wxPyTState* state); + PyThreadState* (*p_wxPyBeginAllowThreads)(); + void (*p_wxPyEndAllowThreads)(PyThreadState* state); + void (*p_wxPyBeginBlockThreads)(); + void (*p_wxPyEndBlockThreads)(); PyObject* (*p_wxPyConstructObject)(void *, const char *, int); PyObject* (*p_wxPy_ConvertList)(wxListBase* list, const char* className); @@ -284,9 +278,11 @@ struct wxPyCoreAPI { void (*p_wxPyCBH_delete)(wxPyCallbackHelper* cbh); PyObject* (*p_wxPyClassExists)(const char* className); - PyObject* (*p_wxPyMake_wxObject)(wxObject* source); + PyObject* (*p_wxPyMake_wxObject)(wxObject* source, bool checkEvtHandler); + PyObject* (*p_wxPyMake_wxSizer)(wxSizer* source); void (*p_wxPyPtrTypeMap_Add)(const char* commonName, const char* ptrName); - + PyObject* (*p_wxArrayString2PyList_helper)(const wxArrayString& arr); + PyObject* (*p_wxArrayInt2PyList_helper)(const wxArrayInt& arr); }; #ifdef wxPyUSE_EXPORT @@ -354,13 +350,13 @@ public: ~wxPyUserData() { #ifdef wxPyUSE_EXPORT - wxPyTState* state = wxPyCoreAPIPtr->p_wxPyBeginBlockThreads(); + wxPyCoreAPIPtr->p_wxPyBeginBlockThreads(); Py_DECREF(m_obj); - wxPyCoreAPIPtr->p_wxPyEndBlockThreads(state); + wxPyCoreAPIPtr->p_wxPyEndBlockThreads(); #else - wxPyTState* state = wxPyBeginBlockThreads(); + wxPyBeginBlockThreads(); Py_DECREF(m_obj); - wxPyEndBlockThreads(state); + wxPyEndBlockThreads(); #endif } PyObject* m_obj; @@ -377,13 +373,13 @@ public: ~wxPyClientData() { #ifdef wxPyUSE_EXPORT - wxPyTState* state = wxPyCoreAPIPtr->p_wxPyBeginBlockThreads(); + wxPyCoreAPIPtr->p_wxPyBeginBlockThreads(); Py_DECREF(m_obj); - wxPyCoreAPIPtr->p_wxPyEndBlockThreads(state); + wxPyCoreAPIPtr->p_wxPyEndBlockThreads(); #else - wxPyTState* state = wxPyBeginBlockThreads(); + wxPyBeginBlockThreads(); Py_DECREF(m_obj); - wxPyEndBlockThreads(state); + wxPyEndBlockThreads(); #endif } PyObject* m_obj; @@ -413,10 +409,10 @@ public: #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME() { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(); \ } \ @@ -434,10 +430,10 @@ public: #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(int a, int b) { \ bool rval=FALSE, found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a,b); \ return rval; \ @@ -456,10 +452,10 @@ public: #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(int a, int b) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a,b); \ } \ @@ -477,10 +473,10 @@ public: #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(int a) { \ bool rval=FALSE, found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ @@ -498,11 +494,11 @@ public: #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(int a) { \ bool rval=FALSE; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \ else rval = FALSE; \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ return rval; \ } @@ -517,13 +513,13 @@ public: #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a); \ } \ @@ -543,13 +539,13 @@ public: #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, bool b) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b); \ } \ @@ -567,13 +563,13 @@ public: #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, bool b) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b); \ } \ @@ -591,10 +587,10 @@ public: #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(double a, double b) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b); \ } \ @@ -612,11 +608,11 @@ public: #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(double a, double b, int c, int d) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \ a,b,c,d)); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b, c, d); \ } \ @@ -634,13 +630,13 @@ public: #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b, c, d, e, f); \ } \ @@ -658,14 +654,14 @@ public: #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ bool rval=FALSE; \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a, b, c, d, e, f); \ return rval; \ @@ -684,11 +680,11 @@ public: #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \ (int)a,b,c,d,e)); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b, c, d, e); \ } \ @@ -706,13 +702,13 @@ public: #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b, c, d, e); \ } \ @@ -730,13 +726,13 @@ public: #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxDC& a, bool b) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(&a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b); \ } \ @@ -755,13 +751,13 @@ public: void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \ int e, int f) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b, c, d, e, f); \ } \ @@ -780,13 +776,13 @@ public: #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(a); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b, c, d, e); \ } \ @@ -805,10 +801,10 @@ public: #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(double a, double b, int c) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b, c); \ } \ @@ -826,10 +822,10 @@ public: #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(bool a, double b, double c, int d) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a, b, c, d); \ } \ @@ -848,10 +844,10 @@ public: #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(const wxString& a) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a); \ } \ @@ -870,10 +866,10 @@ public: bool CLASS::CBNAME(const wxString& a) { \ bool rval=FALSE; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str()));\ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ @@ -890,10 +886,10 @@ public: #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(const wxString& a) { \ bool rval=FALSE; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ return rval; \ } \ @@ -905,7 +901,7 @@ public: #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME(const wxString& a) { \ wxString rval; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(s)", a.c_str()));\ @@ -915,7 +911,7 @@ public: Py_DECREF(ro); Py_DECREF(str); \ } \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ return rval; \ } \ @@ -927,7 +923,7 @@ public: #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME(const wxString& a,int b) { \ wxString rval; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(si)", a.c_str(),b)); \ @@ -937,7 +933,7 @@ public: Py_DECREF(ro); Py_DECREF(str); \ } \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ return rval; \ } \ @@ -952,11 +948,11 @@ public: bool CLASS::CBNAME(const wxString& a, const wxString& b) { \ bool rval=FALSE; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ss)", \ a.c_str(), b.c_str())); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a, b); \ return rval; \ @@ -976,7 +972,7 @@ public: wxString CLASS::CBNAME() { \ wxString rval; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ @@ -986,7 +982,7 @@ public: Py_DECREF(ro); Py_DECREF(str); \ } \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ @@ -1004,7 +1000,7 @@ public: #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \ wxString CLASS::CBNAME() { \ wxString rval; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ @@ -1014,7 +1010,7 @@ public: Py_DECREF(ro); Py_DECREF(str); \ } \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ return rval; \ } @@ -1027,13 +1023,13 @@ public: #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(const wxHtmlTag& a) { \ bool rval=FALSE; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ return rval; \ } @@ -1047,13 +1043,13 @@ public: void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \ wxString rval; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \ wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(cell, x, y); \ } \ @@ -1071,7 +1067,7 @@ public: #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \ PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \ @@ -1079,7 +1075,7 @@ public: Py_DECREF(obj); \ Py_DECREF(o2); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(cell, x, y, e); \ } \ @@ -1097,10 +1093,10 @@ public: #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \ void CLASS::CBNAME() { \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ } //--------------------------------------------------------------------------- @@ -1112,7 +1108,7 @@ public: #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \ wxSize CLASS::CBNAME() { \ wxSize rval(0,0); \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ wxSize* ptr; \ @@ -1123,7 +1119,7 @@ public: Py_DECREF(ro); \ } \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ return rval; \ } @@ -1138,13 +1134,13 @@ public: bool CLASS::CBNAME(wxWindow* a) { \ bool rval=FALSE; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyMake_wxObject(a); \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ @@ -1164,10 +1160,10 @@ public: bool CLASS::CBNAME() { \ bool rval=FALSE; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ @@ -1187,10 +1183,10 @@ public: wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ int rval=0; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a, b, c); \ return (wxDragResult)rval; \ @@ -1206,7 +1202,7 @@ public: #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \ wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ wxFSFile* rval=0; \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ PyObject* ro; \ @@ -1219,7 +1215,7 @@ public: } \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ return rval; \ }; @@ -1234,10 +1230,10 @@ public: bool CLASS::CBNAME(wxDragResult a) { \ bool rval=FALSE; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ @@ -1254,11 +1250,11 @@ public: #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \ wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ int rval=0; \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ return (wxDragResult)rval; \ } \ @@ -1271,10 +1267,10 @@ public: #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(int a, int b, const wxString& c) { \ bool rval=FALSE; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str()));\ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ return rval; \ } \ @@ -1289,10 +1285,10 @@ public: size_t CLASS::CBNAME() { \ size_t rval=0; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(); \ return rval; \ @@ -1312,7 +1308,7 @@ public: wxDataFormat CLASS::CBNAME(size_t a) { \ wxDataFormat rval=0; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ wxDataFormat* ptr; \ @@ -1323,7 +1319,7 @@ public: Py_DECREF(ro); \ } \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ @@ -1342,13 +1338,13 @@ public: #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \ void CLASS::CBNAME(const Type& a) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a); \ } \ @@ -1367,13 +1363,13 @@ public: #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \ void CLASS::CBNAME(Type& a) { \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ PCLASS::CBNAME(a); \ } \ @@ -1392,13 +1388,13 @@ public: bool CLASS::CBNAME(Type& a) { \ bool rv=FALSE; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rv = PCLASS::CBNAME(a); \ return rv; \ @@ -1418,7 +1414,7 @@ public: wxString CLASS::CBNAME(long a, long b) const { \ wxString rval; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \ @@ -1428,7 +1424,7 @@ public: Py_DECREF(ro); Py_DECREF(str); \ } \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a,b); \ return rval; \ @@ -1448,7 +1444,7 @@ public: int CLASS::CBNAME(long a) const { \ int rval=-1; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \ @@ -1457,7 +1453,7 @@ public: Py_DECREF(ro); \ } \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ @@ -1478,7 +1474,7 @@ public: wxListItemAttr *CLASS::CBNAME(long a) const { \ wxListItemAttr *rval = NULL; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ wxListItemAttr* ptr; \ @@ -1489,7 +1485,7 @@ public: Py_DECREF(ro); \ } \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ rval = PCLASS::CBNAME(a); \ return rval; \ @@ -1508,7 +1504,7 @@ public: bool CLASS::CBNAME(wxMouseEvent& e) { \ bool rval=FALSE; \ bool found; \ - wxPyTState* state = wxPyBeginBlockThreads(); \ + wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ PyObject* ro; \ PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \ @@ -1519,7 +1515,7 @@ public: } \ Py_DECREF(obj); \ } \ - wxPyEndBlockThreads(state); \ + wxPyEndBlockThreads(); \ if (! found) \ return PCLASS::CBNAME(e); \ return rval; \