// get the item attribute, either by quering it for virtual control, or by
// returning the one previously set using setter methods for a normal one
- wxListItemAttr *DoGetItemAttr(long item) const;
+ wxListItemAttr *DoGetItemColumnAttr(long item, long column) const;
wxTextCtrl* m_textCtrl; // The control used for editing a label
// return the attribute for the item (may return NULL if none)
virtual wxListItemAttr *OnGetItemAttr(long item) const;
+ // return the attribute for the given item and column (may return NULL if none)
+ virtual wxListItemAttr *OnGetItemColumnAttr(long item, long WXUNUSED(column)) const
+ {
+ return OnGetItemAttr(item);
+ }
+
private:
// process NM_CUSTOMDRAW notification message
WXLPARAM OnCustomDraw(WXLPARAM lParam);
The base class version always returns @NULL.
- @see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText()
+ @see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText(),
+ OnGetItemColumnAttr()
*/
virtual wxListItemAttr* OnGetItemAttr(long item) const;
+ /**
+ This function may be overridden in the derived class for a control with
+ @c wxLC_VIRTUAL style.
+
+ It should return the attribute for the for the specified @a item and @a
+ column or @NULL to use the default appearance parameters.
+
+ The base class version returns @c OnGetItemAttr(item).
+
+ @note Currently this function is only called under wxMSW, the other
+ ports only support OnGetItemAttr()
+
+ @see OnGetItemAttr(), OnGetItemText(),
+ OnGetItemImage(), OnGetItemColumnImage(),
+ */
+ virtual wxListItemAttr* OnGetItemColumnAttr(long item, long column) const;
+
/**
Overload this function in the derived class for a control with
@c wxLC_VIRTUAL and @c wxLC_REPORT styles in order to specify the image
The base class version always calls OnGetItemImage() for the first column, else
it returns -1.
- @see OnGetItemText(), OnGetItemImage(), OnGetItemAttr()
+ @see OnGetItemText(), OnGetItemImage(), OnGetItemAttr(),
+ OnGetItemColumnAttr()
*/
virtual int OnGetItemColumnImage(long item, long column) const;
break;
case CDDS_ITEMPREPAINT:
+ // get a message for each subitem
+ return CDRF_NOTIFYITEMDRAW;
+
+ case CDDS_SUBITEM | CDDS_ITEMPREPAINT:
const int item = nmcd.dwItemSpec;
+ const int column = pLVCD->iSubItem;
// we get this message with item == 0 for an empty control, we
// must ignore it as calling OnGetItemAttr() would be wrong
if ( item < 0 || item >= GetItemCount() )
break;
+ // same for columns
+ if ( column < 0 || column >= GetColumnCount() )
+ break;
- return HandleItemPrepaint(this, pLVCD, DoGetItemAttr(item));
+ return HandleItemPrepaint(this, pLVCD, DoGetItemColumnAttr(item, column));
}
return CDRF_DODEFAULT;
return NULL;
}
-wxListItemAttr *wxListCtrl::DoGetItemAttr(long item) const
+wxListItemAttr *wxListCtrl::DoGetItemColumnAttr(long item, long column) const
{
- return IsVirtual() ? OnGetItemAttr(item)
+ return IsVirtual() ? OnGetItemColumnAttr(item, column)
: wxGetInternalDataAttr(this, item);
}