Add supoprt for wxListCtrl::OnGetItemColumnImage
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37148 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
|
||||
|
@@ -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) \
|
||||
|
@@ -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,6 +403,7 @@ 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);
|
||||
|
||||
%}
|
||||
|
||||
|
Reference in New Issue
Block a user