X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0122b7e3fcfd78f879470053c91a60e3c66537a3..a92b0cfd2bd0bef75b43c071df0b0e028f360d8e:/wxPython/src/helpers.h diff --git a/wxPython/src/helpers.h b/wxPython/src/helpers.h index b9c07e3a84..3eb8574c22 100644 --- a/wxPython/src/helpers.h +++ b/wxPython/src/helpers.h @@ -65,7 +65,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); @@ -134,6 +135,7 @@ 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); +wxPen** wxPen_LIST_helper(PyObject* source); bool wxSize_helper(PyObject* source, wxSize** obj); bool wxPoint_helper(PyObject* source, wxPoint** obj); @@ -141,6 +143,20 @@ bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj); bool wxRect_helper(PyObject* source, wxRect** obj); bool wxColour_helper(PyObject* source, wxColour** obj); +#if PYTHON_API_VERSION < 1009 +#define PySequence_Fast_GET_ITEM(o, i) \ + (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) +#endif + +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& arr); + + +#define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; } + //---------------------------------------------------------------------- #ifndef SWIGCODE @@ -204,22 +220,24 @@ protected: class wxPyEvent : public wxEvent, public wxPyEvtSelfRef { - DECLARE_DYNAMIC_CLASS(wxPyEvent) + DECLARE_ABSTRACT_CLASS(wxPyEvent) public: wxPyEvent(int id=0); + wxPyEvent(const wxPyEvent& evt); ~wxPyEvent(); - void CopyObject(wxObject& dest) const; + virtual wxEvent* Clone() const { return new wxPyEvent(*this); } }; class wxPyCommandEvent : public wxCommandEvent, public wxPyEvtSelfRef { - DECLARE_DYNAMIC_CLASS(wxPyCommandEvent) + DECLARE_ABSTRACT_CLASS(wxPyCommandEvent) public: wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0); + wxPyCommandEvent(const wxPyCommandEvent& evt); ~wxPyCommandEvent(); - void CopyObject(wxObject& dest) const; + virtual wxEvent* Clone() const { return new wxPyCommandEvent(*this); } }; @@ -267,9 +285,10 @@ 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); }; #ifdef wxPyUSE_EXPORT @@ -1373,7 +1392,7 @@ public: #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \ bool CLASS::CBNAME(Type& a) { \ - bool rv; \ + bool rv=FALSE; \ bool found; \ wxPyTState* state = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ @@ -1489,7 +1508,7 @@ public: #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \ bool CLASS::CBNAME(wxMouseEvent& e) { \ - bool rval; \ + bool rval=FALSE; \ bool found; \ wxPyTState* state = wxPyBeginBlockThreads(); \ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ @@ -1505,6 +1524,7 @@ public: wxPyEndBlockThreads(state); \ if (! found) \ return PCLASS::CBNAME(e); \ + return rval; \ } \ bool CLASS::base_##CBNAME(wxMouseEvent& e) { \ return PCLASS::CBNAME(e); \