without consuming much memory. To use virtual list control you must use
\helpref{SetItemCount}{wxlistctrlsetitemcount} first and overload at least
\helpref{OnGetItemText}{wxlistctrlongetitemtext} (and optionally
-\helpref{OnGetItemImage}{wxlistctrlongetitemimage} and
+\helpref{OnGetItemImage}{wxlistctrlongetitemimage} or \helpref{OnGetItemColumnImage}{wxlistctrlongetitemcolumnimage} and
\helpref{OnGetItemAttr}{wxlistctrlongetitemattr}) to return the information
about the items when the control requests it. Virtual list control can be used
as a normal one except that no operations which can take time proportional to
\wxheading{See also}
\helpref{OnGetItemImage}{wxlistctrlongetitemimage},\\
+\helpref{OnGetItemColumnImage}{wxlistctrlongetitemcolumnimage},\\
\helpref{OnGetItemText}{wxlistctrlongetitemtext}
(if the control doesn't have an image list, it is not necessary to overload
it). It should return the index of the items image in the controls image list
or $-1$ for no image.
+In a control with {\tt wxLC\_REPORT} style, OnGetItemImage only gets called for
+the first column of each line.
The base class version always returns $-1$.
\wxheading{See also}
\helpref{OnGetItemText}{wxlistctrlongetitemtext},\\
+\helpref{OnGetItemColumnImage}{wxlistctrlongetitemcolumnimage},\\
\helpref{OnGetItemAttr}{wxlistctrlongetitemattr}
+\membersection{wxListCtrl::OnGetItemColumnImage}\label{wxlistctrlongetitemcolumnimage}
+
+\constfunc{virtual int}{OnGetItemColumnImage}{\param{long }{item}, \param{long }{column}}
+
+Overload this function in the derived class for a control with
+{\tt wxLC\_VIRTUAL} and {\tt wxLC\_REPORT} styles in order to specify the image
+index for the given line and column.
+
+The base class version always calls OnGetItemImage for the first column, else
+it returns $-1$.
+
+\wxheading{See also}
+
+\helpref{OnGetItemText}{wxlistctrlongetitemtext},\\
+\helpref{OnGetItemImage}{wxlistctrlongetitemimage},\\
+\helpref{OnGetItemAttr}{wxlistctrlongetitemattr}
\membersection{wxListCtrl::OnGetItemText}\label{wxlistctrlongetitemtext}
\helpref{SetItemCount}{wxlistctrlsetitemcount},\\
\helpref{OnGetItemImage}{wxlistctrlongetitemimage},\\
+\helpref{OnGetItemColumnImage}{wxlistctrlongetitemcolumnimage},\\
\helpref{OnGetItemAttr}{wxlistctrlongetitemattr}
// return the text for the given column of the given item
virtual wxString OnGetItemText(long item, long column) const;
- // return the icon for the given item
+ // return the icon for the given item. In report view, OnGetItemImage will
+ // only be called for the first column. See OnGetItemColumnImage for
+ // details.
virtual int OnGetItemImage(long item) const;
+ // return the icon for the given item and column.
+ virtual int OnGetItemColumnImage(long item, long column) const;
+
// return the attribute for the item (may return NULL if none)
virtual wxListItemAttr *OnGetItemAttr(long item) const;
// return the text for the given column of the given item
virtual wxString OnGetItemText(long item, long column) const;
- // return the icon for the given item
+ // return the icon for the given item. In report view, OnGetItemImage will
+ // only be called for the first column. See OnGetItemColumnImage for
+ // details.
virtual int OnGetItemImage(long item) const;
+ // return the icon for the given item and column.
+ virtual int OnGetItemColumnImage(long item, long column) const;
+
// return the attribute for the item (may return NULL if none)
virtual wxListItemAttr *OnGetItemAttr(long item) const;
) const;
//
- // Return the icon for the given item
+ // Return the icon for the given item. In report view, OnGetItemImage will
+ // only be called for the first column. See OnGetItemColumnImage for
+ // details.
//
virtual int OnGetItemImage(long lItem) const;
+ //
+ // Return the icon for the given item and column
+ //
+ virtual int OnGetItemColumnImage(long lItem, long lColumn) const;
+
//
// Return the attribute for the item (may return NULL if none)
//
// return the text for the given column of the given item
virtual wxString OnGetItemText(long item, long column) const;
- // return the icon for the given item
+ // return the text for the given column of the given item
+ virtual wxString OnGetItemText(long item, long column) const;
+
+ // return the icon for the given item. In report view, OnGetItemImage will
+ // only be called for the first column. See OnGetItemColumnImage for
+ // details.
virtual int OnGetItemImage(long item) const;
// return the attribute for the item (may return NULL if none)
for ( size_t col = 0; col < countCol; col++ )
{
ld->SetText(col, listctrl->OnGetItemText(line, col));
+ ld->SetImage(listctrl->OnGetItemColumnImage(line, col));
}
- ld->SetImage(listctrl->OnGetItemImage(line));
ld->SetAttr(listctrl->OnGetItemAttr(line));
}
{
wxCHECK_MSG(!GetImageList(wxIMAGE_LIST_SMALL),
-1,
- wxT("List control has an image list: OnGetItemImage should be overridden."));
-
+ wxT("List control has an image list, OnGetItemImage or OnGetItemColumnImage should be overridden."));
return -1;
}
+int wxGenericListCtrl::OnGetItemColumnImage(long item, long column) const
+{
+ if (!column)
+ return OnGetItemImage(item);
+
+ return -1;
+
+
wxListItemAttr *
wxGenericListCtrl::OnGetItemAttr(long WXUNUSED_UNLESS_DEBUG(item)) const
{
#ifdef NM_CUSTOMDRAW
if ( lvi.mask & LVIF_IMAGE )
{
- lvi.iImage = OnGetItemImage(item);
+ lvi.iImage = OnGetItemColumnImage(item, lvi.iSubItem);
}
#endif // NM_CUSTOMDRAW
{
wxCHECK_MSG(!GetImageList(wxIMAGE_LIST_SMALL),
-1,
- wxT("List control has an image list, OnGetItemImage should be overridden."));
+ wxT("List control has an image list, OnGetItemImage or OnGetItemColumnImage should be overridden."));
+ return -1;
+}
+
+int wxListCtrl::OnGetItemColumnImage(long item, long column) const
+{
+ if (!column)
+ return OnGetItemImage(item);
+
return -1;
}
return -1;
} // end of wxListCtrl::OnGetItemImage
+int wxListCtrl::OnGetItemColumnImage (
+ long lItem,
+ long lColumn
+) const
+{
+ if (!lColumn)
+ return OnGetItemImage(lItem);
+
+ return -1;
+} // end of wxListCtrl::OnGetItemColumnImage
+
wxListItemAttr* wxListCtrl::OnGetItemAttr (
long WXUNUSED_UNLESS_DEBUG(lItem)
) const
return -1;
}
+int wxListCtrl::OnGetItemColumnImage(long item, long column) const
+{
+ if (!column)
+ return OnGetItemImage(item);
+
+ return -1;
+}
+
wxListItemAttr *wxListCtrl::OnGetItemAttr(long WXUNUSED_UNLESS_DEBUG(item)) const
{
// no attributes by default