]> 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 9cf9014612faba9d319b1008d85fd4f4bae5e664..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);                                   \