added (MSW-only) wxListCtrl::OnGetItemColumnAttr() (#10018)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58393 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-01-25 13:27:48 +00:00
parent d099c754b5
commit eab1336c90
3 changed files with 39 additions and 6 deletions

View File

@@ -402,7 +402,7 @@ protected:
// get the item attribute, either by quering it for virtual control, or by // 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 // 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 wxTextCtrl* m_textCtrl; // The control used for editing a label
@@ -442,6 +442,12 @@ protected:
// return the attribute for the item (may return NULL if none) // return the attribute for the item (may return NULL if none)
virtual wxListItemAttr *OnGetItemAttr(long item) const; 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: private:
// process NM_CUSTOMDRAW notification message // process NM_CUSTOMDRAW notification message
WXLPARAM OnCustomDraw(WXLPARAM lParam); WXLPARAM OnCustomDraw(WXLPARAM lParam);

View File

@@ -873,10 +873,28 @@ protected:
The base class version always returns @NULL. The base class version always returns @NULL.
@see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText() @see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText(),
OnGetItemColumnAttr()
*/ */
virtual wxListItemAttr* OnGetItemAttr(long item) const; 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 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 @c wxLC_VIRTUAL and @c wxLC_REPORT styles in order to specify the image
@@ -885,7 +903,8 @@ protected:
The base class version always calls OnGetItemImage() for the first column, else The base class version always calls OnGetItemImage() for the first column, else
it returns -1. it returns -1.
@see OnGetItemText(), OnGetItemImage(), OnGetItemAttr() @see OnGetItemText(), OnGetItemImage(), OnGetItemAttr(),
OnGetItemColumnAttr()
*/ */
virtual int OnGetItemColumnImage(long item, long column) const; virtual int OnGetItemColumnImage(long item, long column) const;

View File

@@ -2821,14 +2821,22 @@ WXLPARAM wxListCtrl::OnCustomDraw(WXLPARAM lParam)
break; break;
case CDDS_ITEMPREPAINT: case CDDS_ITEMPREPAINT:
// get a message for each subitem
return CDRF_NOTIFYITEMDRAW;
case CDDS_SUBITEM | CDDS_ITEMPREPAINT:
const int item = nmcd.dwItemSpec; const int item = nmcd.dwItemSpec;
const int column = pLVCD->iSubItem;
// we get this message with item == 0 for an empty control, we // we get this message with item == 0 for an empty control, we
// must ignore it as calling OnGetItemAttr() would be wrong // must ignore it as calling OnGetItemAttr() would be wrong
if ( item < 0 || item >= GetItemCount() ) if ( item < 0 || item >= GetItemCount() )
break; 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 CDRF_DODEFAULT;
@@ -2990,9 +2998,9 @@ wxListItemAttr *wxListCtrl::OnGetItemAttr(long WXUNUSED_UNLESS_DEBUG(item)) cons
return NULL; 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); : wxGetInternalDataAttr(this, item);
} }