]> git.saurik.com Git - wxWidgets.git/commitdiff
Moved wxPy_ConvertList function from oglhelpers to helpers
authorRobin Dunn <robin@alldunn.com>
Mon, 13 Sep 1999 19:28:10 +0000 (19:28 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 13 Sep 1999 19:28:10 +0000 (19:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

utils/wxPython/modules/ogl/ogl.i
utils/wxPython/modules/ogl/oglhelpers.cpp
utils/wxPython/modules/ogl/oglhelpers.h
utils/wxPython/src/helpers.cpp
utils/wxPython/src/helpers.h

index 6c140befb5ca556d76bc04507fc5f84fa70bb421..490067bc1422effdb090826f98b7b98d0a4b2de2 100644 (file)
@@ -156,6 +156,7 @@ extern "C" SWIGEXPORT(void) initoglshapes2c();
 extern "C" SWIGEXPORT(void) initoglcanvasc();
 %}
 
+
 %init %{
 
     initoglbasicc();
index 6b6e7b17b9e1300ded77f5f2f9df8340230ae8be..ab2152276a0729cc152ab8a928f9b1ded81855bd 100644 (file)
@@ -92,42 +92,10 @@ wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList) {
 
 
 //---------------------------------------------------------------------------
-// Convert a wxList to a Python List
 
-#include <ogl.h>
 
-PyObject* wxPy_ConvertList(wxList* list, char* className) {
-    PyObject*   pyList;
-    PyObject*   pyObj;
-    wxObject*   wxObj;
-    wxNode*     node = list->First();
 
-    bool doSave = wxPyRestoreThread();
-    pyList = PyList_New(0);
-    while (node) {
-        wxObj = node->Data();
-//        printf("%s class at %x : %x\n", wxObj->GetClassInfo()->GetClassName(), (void*)wxObj, (void*)((wxShape*)wxObj)->GetParent());
-        pyObj = wxPyConstructObject(wxObj, className);
-        PyList_Append(pyList, pyObj);
-        node = node->Next();
-    }
-//      for (int x=0; x<PyList_Size(pyList); x++) {
-//          PyObject* obj = PyList_GetItem(pyList, x);
-//          char* attr = PyString_AsString(PyObject_GetAttrString(obj, "this"));
-//          PyObject* par = PyObject_CallMethod(obj, "GetParent", NULL);
-//          char* parent;
-//          if (par != Py_None)
-//              parent = PyString_AsString(PyObject_GetAttrString(par, "this"));
-//          else
-//              parent = "None";
-//          printf("obj.this = %s  obj.GetParent().this = %s\n", attr, parent);
-//      }
-//    printf("--------\n");
-    wxPySaveThread(doSave);
-    return pyList;
-}
 
-//---------------------------------------------------------------------------
 
 
 
index 1c2804d5f0780131f5ad53ff827822d5f88400c9..631a7318daec6e21dab4540f9ac2305413338676 100644 (file)
 wxList* wxPy_wxListHelper(PyObject* pyList, char* className);
 wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList);
 
-PyObject* wxPy_ConvertList(wxList* list, char* className);
-
 
 
 //---------------------------------------------------------------------------
index c74c75de36903bb17c20f6dd89a224dedaaec99b..547dde92b327b2948a3a5e52c4c604cf582ca804 100644 (file)
@@ -494,9 +494,30 @@ PyObject* wxPyEvent::GetUserData() {
 }
 
 //----------------------------------------------------------------------
+//---------------------------------------------------------------------------
+// Convert a wxList to a Python List
+
+PyObject* wxPy_ConvertList(wxListBase* list, char* className) {
+    PyObject*   pyList;
+    PyObject*   pyObj;
+    wxObject*   wxObj;
+    wxNode*     node = list->First();
+
+    bool doSave = wxPyRestoreThread();
+    pyList = PyList_New(0);
+    while (node) {
+        wxObj = node->Data();
+        pyObj = wxPyConstructObject(wxObj, className);
+        PyList_Append(pyList, pyObj);
+        node = node->Next();
+    }
+    wxPySaveThread(doSave);
+    return pyList;
+}
+
 //----------------------------------------------------------------------
 // Some helper functions for typemaps in my_typemaps.i, so they won't be
-// imcluded in every file...
+// included in every file...
 
 
 HELPEREXPORT byte* byte_LIST_helper(PyObject* source) {
index 54baeab6f644baf2199004eb37610e27c7675208..92cb512e084b29889c01db21fb10e10b730cdbf0 100644 (file)
@@ -67,6 +67,7 @@ void wxPyEventThunker(wxObject*, wxEvent& event);
 HELPEREXPORT PyObject* wxPyConstructObject(void* ptr, char* className);
 HELPEREXPORT bool wxPyRestoreThread();
 HELPEREXPORT void wxPySaveThread(bool doSave);
+HELPEREXPORT PyObject* wxPy_ConvertList(wxListBase* list, char* className);
 
 //----------------------------------------------------------------------
 
@@ -574,6 +575,111 @@ private:
 
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK__STRING(CBNAME)                  \
+    void CBNAME(const wxString& a);                     \
+    void base_##CBNAME(const wxString& a);
+
+
+#define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME)                   \
+    void CLASS::CBNAME(const wxString& a)  {                            \
+        bool doSave = wxPyRestoreThread();                              \
+        if (m_myInst.findCallback(#CBNAME))                             \
+            m_myInst.callCallback(Py_BuildValue("(s)", a.c_str()));     \
+        else                                                            \
+            PCLASS::CBNAME(a);                                          \
+        wxPySaveThread(doSave);                                         \
+    }                                                                   \
+    void CLASS::base_##CBNAME(const wxString& a) {                      \
+        PCLASS::CBNAME(a);                                              \
+    }
+
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_BOOL_STRING(CBNAME)              \
+    bool CBNAME(const wxString& a);                     \
+    bool base_##CBNAME(const wxString& a);
+
+
+#define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME)                       \
+    bool CLASS::CBNAME(const wxString& a)  {                                    \
+        bool rval;                                                              \
+        bool doSave = wxPyRestoreThread();                                      \
+        if (m_myInst.findCallback(#CBNAME))                                     \
+            rval = m_myInst.callCallback(Py_BuildValue("(s)", a.c_str()));      \
+        else                                                                    \
+            rval = PCLASS::CBNAME(a);                                           \
+        wxPySaveThread(doSave);                                                 \
+        return rval;                                                            \
+    }                                                                           \
+    bool CLASS::base_##CBNAME(const wxString& a) {                              \
+        return PCLASS::CBNAME(a);                                               \
+    }
+
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_STRING_(CBNAME)                  \
+    wxString CBNAME();                                  \
+    wxString base_##CBNAME();
+
+
+#define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME)                           \
+    wxString CLASS::CBNAME() {                                                  \
+        wxString rval;                                                          \
+        bool doSave = wxPyRestoreThread();                                      \
+        if (m_myInst.findCallback(#CBNAME)) {                                   \
+            PyObject* ro;                                                       \
+            ro = m_myInst.callCallbackObj(Py_BuildValue("()"));                 \
+            rval = PyString_AsString(PyObject_Str(ro));                         \
+        }                                                                       \
+        else                                                                    \
+            rval = PCLASS::CBNAME(a);                                           \
+        wxPySaveThread(doSave);                                                 \
+        return rval;                                                            \
+    }                                                                           \
+    bool CLASS::base_##CBNAME(const wxString& a) {                              \
+        return PCLASS::CBNAME(a);                                               \
+    }
+
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_STRING__pure(CBNAME)             \
+    wxString CBNAME();
+
+
+#define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME)                      \
+    wxString CLASS::CBNAME() {                                                  \
+        wxString rval;                                                          \
+        bool doSave = wxPyRestoreThread();                                      \
+        if (m_myInst.findCallback(#CBNAME)) {                                   \
+            PyObject* ro;                                                       \
+            ro = m_myInst.callCallbackObj(Py_BuildValue("()"));                 \
+            rval = PyString_AsString(PyObject_Str(ro));                         \
+        }                                                                       \
+        wxPySaveThread(doSave);                                                 \
+        return rval;                                                            \
+    }
+
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME)                  \
+    bool CBNAME(const wxHtmlTag& a);                          \
+
+
+#define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME)                     \
+    bool CLASS::CBNAME(const wxHtmlTag& a)  {                                   \
+        bool rval = false;                                                      \
+        bool doSave = wxPyRestoreThread();                                      \
+        if (m_myInst.findCallback(#CBNAME))                                     \
+            rval = m_myInst.callCallback(Py_BuildValue("(O)",                   \
+                                         wxPyConstructObject((void*)&a,"wxHtmlTag"))); \
+        wxPySaveThread(doSave);                                                 \
+        return rval;                                                            \
+    }
+
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------