Add custom renderer column to the list model example in dataview sample.

Add a column using custom renderer to the example using a list model with
attributes to test attributes support -- currently they are ignored, but this
will be fixed soon.

Also make the custom renderer display somewhat more clear as previously it
didn't depend at all on its value.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-11-10 17:40:37 +00:00
parent 2746bccf23
commit ef6833f9ab
3 changed files with 36 additions and 19 deletions

View File

@@ -203,18 +203,13 @@ void MyMusicTreeModel::GetValue( wxVariant &variant,
variant = node->m_quality;
break;
case 4:
// wxMac doesn't conceal the popularity progress renderer, return 0 for containers
if (IsContainer(item))
variant = (long) 0;
else
variant = (long) 80; // all music is very 80% popular
variant = 80L; // all music is very 80% popular
break;
case 5:
// Make size of red square depend on year
if (GetYear(item) < 1900)
variant = (long) 35;
variant = "old";
else
variant = (long) 25;
variant = "new";
break;
default:
@@ -436,6 +431,10 @@ void MyListModel::GetValueByRow( wxVariant &variant,
}
break;
case Col_Custom:
variant = wxString::Format("%d", row % 100);
break;
case Col_Max:
wxFAIL_MSG( "invalid column" );
}
@@ -456,7 +455,8 @@ bool MyListModel::GetAttrByRow( unsigned int row, unsigned int col,
break;
case Col_TextWithAttr:
// do what the labels defined above hint at
case Col_Custom:
// do what the labels defined in GetValueByRow() hint at
switch ( row % 5 )
{
case 0:
@@ -517,6 +517,7 @@ bool MyListModel::SetValueByRow( const wxVariant &variant,
return true;
case Col_TextWithAttr:
case Col_Custom:
wxLogError("Cannot edit the column %d", col);
break;