]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/helpers.h
fixes for reading bitmapswith BI_BITFIELDS (patch 597906)
[wxWidgets.git] / wxPython / src / helpers.h
index acc450dce6130b118c92a2750dae16d7ccc315f0..1ca7acd7daafd7a49e85190c0bb0a8d44a39661e 100644 (file)
@@ -1068,6 +1068,33 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
 
 //---------------------------------------------------------------------------
 
+#define DEC_PYCALLBACK_STRING_STRING(CBNAME)                                    \
+    wxString CBNAME(const wxString& a);                                         \
+    wxString base_##CBNAME(const wxString& a);
+
+#define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME)                     \
+    wxString CLASS::CBNAME(const wxString& a)  {                                \
+        wxString rval;                                                          \
+        bool found;                                                             \
+        wxPyBeginBlockThreads();                                                \
+        if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \
+            PyObject* ro;                                                       \
+            PyObject* s = wx2PyString(a);                                       \
+            ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s));    \
+            Py_DECREF(s);                                                       \
+            if (ro) {                                                           \
+                rval = Py2wxString(ro);                                         \
+                Py_DECREF(ro);                                                  \
+            }                                                                   \
+        }                                                                       \
+        if (! found)                                                            \
+            rval = PCLASS::CBNAME(a);                                           \
+        wxPyEndBlockThreads();                                                  \
+        return rval;                                                            \
+    }                                                                           \
+
+//---------------------------------------------------------------------------
+
 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME)                            \
     wxString CBNAME(const wxString& a,int b);                                   \
 
@@ -1315,6 +1342,30 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
 
 //---------------------------------------------------------------------------
 
+#define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME)                      \
+    void CBNAME(wxWindowBase* a);                                  \
+    void base_##CBNAME(wxWindowBase* a);
+
+
+#define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME)                    \
+    void CLASS::CBNAME(wxWindowBase* a) {                                       \
+        bool found;                                                             \
+        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();                                                  \
+        if (! found)                                                            \
+            PCLASS::CBNAME(a);                                                  \
+    }                                                                           \
+    void CLASS::base_##CBNAME(wxWindowBase* a) {                                \
+        PCLASS::CBNAME(a);                                                      \
+    }
+
+//---------------------------------------------------------------------------
+
 #define DEC_PYCALLBACK_BOOL_(CBNAME)                      \
     bool CBNAME();                                        \
     bool base_##CBNAME();
@@ -1596,6 +1647,25 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
 
 //---------------------------------------------------------------------------
 
+#define DEC_PYCALLBACK_bool_anypure(CBNAME, Type)                               \
+    bool CBNAME(Type& a);
+
+
+#define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type)                \
+    bool CLASS::CBNAME(Type& a) {                                               \
+        bool rv=FALSE;                                                          \
+        wxPyBeginBlockThreads();                                                \
+        if (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();                                                  \
+        return rv;                                                              \
+    }                                                                           \
+
+//---------------------------------------------------------------------------
+
 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME)                                  \
     wxString CBNAME(long a, long b) const;                                      \
     wxString base_##CBNAME(long a, long b)const ;
@@ -1716,4 +1786,87 @@ void wxPyCBH_delete(wxPyCallbackHelper* cbh);
 
 //---------------------------------------------------------------------------
 
+#define DEC_PYCALLBACK_WIZPG__pure(CBNAME)                                      \
+    wxWizardPage* CBNAME() const;
+
+#define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME)                       \
+    wxWizardPage* CLASS::CBNAME() const {                                       \
+        wxWizardPage* rv = NULL;                                                \
+        wxPyBeginBlockThreads();                                                \
+        if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \
+            PyObject* ro;                                                       \
+            ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \
+            if (ro) {                                                           \
+                SWIG_GetPtrObj(ro, (void **)&rv, "_wxWizardPage_p");            \
+                Py_DECREF(ro);                                                  \
+            }                                                                   \
+        }                                                                       \
+        wxPyEndBlockThreads();                                                  \
+        return rv;                                                              \
+    }
+
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_BITMAP__pure(CBNAME)                                     \
+    wxBitmap CBNAME() const;
+
+#define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME)                      \
+    wxBitmap CLASS::CBNAME() const {                                            \
+        wxBitmap rv;                                                            \
+        wxPyBeginBlockThreads();                                                \
+        if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \
+            PyObject* ro;                                                       \
+            wxBitmap* ptr;                                                      \
+            ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \
+            if (ro) {                                                           \
+                if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p"))         \
+                    rv = *ptr;                                                  \
+                Py_DECREF(ro);                                                  \
+            }                                                                   \
+        }                                                                       \
+        wxPyEndBlockThreads();                                                  \
+        return rv;                                                              \
+    }
+
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_OBJECT__pure(CBNAME)                                     \
+    wxObject* CBNAME();
+
+#define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME)                      \
+    wxObject* CLASS::CBNAME() {                                                 \
+        wxObject* rv = NULL;                                                    \
+        wxPyBeginBlockThreads();                                                \
+        if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \
+            PyObject* ro;                                                       \
+            ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \
+            if (ro) {                                                           \
+                SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p");                \
+                Py_DECREF(ro);                                                  \
+            }                                                                   \
+        }                                                                       \
+        wxPyEndBlockThreads();                                                  \
+        return rv;                                                              \
+    }
+
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME)                                   \
+    bool CBNAME(wxXmlNode* a);
+
+
+#define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME)                    \
+    bool CLASS::CBNAME(wxXmlNode* a) {                                          \
+        bool rv=FALSE;                                                          \
+        wxPyBeginBlockThreads();                                                \
+        if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \
+            PyObject* obj = wxPyConstructObject((void*)a, "wxXmlNode", 0);      \
+            rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));     \
+            Py_DECREF(obj);                                                     \
+        }                                                                       \
+        wxPyEndBlockThreads();                                                  \
+        return rv;                                                              \
+    }                                                                           \
+
+//---------------------------------------------------------------------------
 #endif