]> git.saurik.com Git - wxWidgets.git/commitdiff
Add supoprt for wxListCtrl::OnGetItemColumnImage
authorRobin Dunn <robin@alldunn.com>
Thu, 26 Jan 2006 00:31:31 +0000 (00:31 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 26 Jan 2006 00:31:31 +0000 (00:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37148 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/docs/CHANGES.txt
wxPython/include/wx/wxPython/wxPython_int.h
wxPython/src/_listctrl.i

index c66fb1319a950a331c1dbe959607085bd7ed0dc3..6dd2c9a49f1a5a950a136c90b3195300c97de1d4 100644 (file)
@@ -25,7 +25,7 @@ wx.EventLoop is now implemented for wxMac.
 
 
 
-2.6.2.2
+2.6.3.0
 -------
 
 Change the wx.ListCtrl InsertStringItem wrapper to use the form that
@@ -35,7 +35,11 @@ the native control doesn't use one anyway.
 
 wxMSW: wx.ListCtrl in report mode is now able to support images in
 other columns besides the first one.  Simply pass an image index to
-SetStringItem.
+SetStringItem.  For virtual list controls you can specify the image to
+use on the extra columns by overriding OnGetItemColumnImage in your
+derived class.  It is passed the item number and the column number as
+parameters, and the default version simply calls OnGetItemImage for
+column zero, or returns -1 for other columns.
 
 
 
index cca6beddb2e57f46c92d468c1e31097e3ef014da..fb611c3d7ac30bfe56d691e8dabd10a12540030d 100644 (file)
@@ -2181,6 +2181,60 @@ extern wxPyApp *wxPythonApp;
     }  
 
 
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_INT_LONGLONG(CBNAME)                                     \
+    int CBNAME(long a, long b) const;                                           \
+    int base_##CBNAME(long a, long b) const
+
+
+#define IMP_PYCALLBACK_INT_LONGLONG(CLASS, PCLASS, CBNAME)                      \
+    int CLASS::CBNAME(long a, long b) const {                                   \
+        int rval=-1;                                                            \
+        bool found;                                                             \
+        wxPyBlock_t blocked = wxPyBeginBlockThreads();                          \
+        if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \
+            PyObject* ro;                                                       \
+            ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b));  \
+            if (ro) {                                                           \
+                rval = PyInt_AsLong(ro);                                        \
+                Py_DECREF(ro);                                                  \
+            }                                                                   \
+        }                                                                       \
+        wxPyEndBlockThreads(blocked);                                           \
+        if (! found)                                                            \
+            rval = PCLASS::CBNAME(a, b);                                        \
+        return rval;                                                            \
+    }                                                                           \
+    int CLASS::base_##CBNAME(long a, long b) const {                            \
+        return PCLASS::CBNAME(a, b);                                            \
+    }
+
+
+
+
+#define DEC_PYCALLBACK_INT_LONGLONG_virtual(CBNAME)                             \
+    int CBNAME(long a, long b) const;
+
+
+#define IMP_PYCALLBACK_INT_LONGLONG_virtual(CLASS, PCLASS, CBNAME)              \
+    int CLASS::CBNAME(long a, long b) const {                                   \
+        int rval=-1;    /* this rval is important for OnGetItemImage */         \
+        bool found;                                                             \
+        wxPyBlock_t blocked = wxPyBeginBlockThreads();                          \
+        if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \
+            PyObject* ro;                                                       \
+            ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b));  \
+            if (ro) {                                                           \
+                rval = PyInt_AsLong(ro);                                        \
+                Py_DECREF(ro);                                                  \
+            }                                                                   \
+        }                                                                       \
+        wxPyEndBlockThreads(blocked);                                           \
+        return rval;                                                            \
+    }  
+
+
 //---------------------------------------------------------------------------
 
 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME)                                    \
index 01d62edc5e49a84bf930c152dccac7985e82542d..836730ddacbf836cf26d05d1ebb0b853570d8ea3 100644 (file)
@@ -393,6 +393,7 @@ public:
 
     // use the virtual version to avoid a confusing assert in the base class
     DEC_PYCALLBACK_INT_LONG_virtual(OnGetItemImage);
+    DEC_PYCALLBACK_INT_LONGLONG(OnGetItemColumnImage);
 
     PYPRIVATE;
 };
@@ -402,7 +403,8 @@ IMPLEMENT_ABSTRACT_CLASS(wxPyListCtrl, wxListCtrl);
 IMP_PYCALLBACK_STRING_LONGLONG(wxPyListCtrl, wxListCtrl, OnGetItemText);
 IMP_PYCALLBACK_LISTATTR_LONG(wxPyListCtrl, wxListCtrl, OnGetItemAttr);
 IMP_PYCALLBACK_INT_LONG_virtual(wxPyListCtrl, wxListCtrl, OnGetItemImage);
+IMP_PYCALLBACK_INT_LONGLONG(wxPyListCtrl, wxListCtrl, OnGetItemColumnImage); 
+
 %}