Implement attributes support in generic wxDataViewIconTextRenderer.

Simply override RenderWithAttr() instead of Render().

Update the sample to show that this works now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-10-12 22:44:15 +00:00
parent 3e60a3c147
commit 38c349189a
3 changed files with 48 additions and 28 deletions

View File

@@ -430,31 +430,42 @@ void MyListModel::GetValueByRow( wxVariant &variant,
bool MyListModel::GetAttrByRow( unsigned int row, unsigned int col,
wxDataViewItemAttr &attr )
{
if (col != 2)
return false;
// do what the labels defined above hint at
switch ( row % 5 )
switch ( col )
{
case 0:
attr.SetColour(*wxBLUE);
break;
return false;
case 1:
attr.SetColour(*wxGREEN);
if ( !(row % 2) )
return false;
attr.SetColour(*wxLIGHT_GREY);
break;
case 2:
attr.SetColour(*wxRED);
break;
// do what the labels defined above hint at
switch ( row % 5 )
{
case 0:
attr.SetColour(*wxBLUE);
break;
case 3:
attr.SetColour(*wxCYAN);
attr.SetBold(true);
break;
case 1:
attr.SetColour(*wxGREEN);
break;
case 4:
return false;
case 2:
attr.SetColour(*wxRED);
break;
case 3:
attr.SetColour(*wxCYAN);
attr.SetBold(true);
break;
case 4:
return false;
}
break;
}
return true;