X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce00f59b5b169752d2f05ce3bb1a88ddc1b38b4c..c29c95fe24973b94fd724db767193171ca7c513d:/samples/dataview/mymodels.cpp?ds=sidebyside diff --git a/samples/dataview/mymodels.cpp b/samples/dataview/mymodels.cpp index 79fc7170bb..a3cb111198 100644 --- a/samples/dataview/mymodels.cpp +++ b/samples/dataview/mymodels.cpp @@ -244,6 +244,17 @@ bool MyMusicTreeModel::SetValue( const wxVariant &variant, return false; } +bool MyMusicTreeModel::IsEnabled( const wxDataViewItem &item, + unsigned int col ) const +{ + wxASSERT(item.IsOk()); + + MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) item.GetID(); + + // disable Beethoven's ratings, his pieces can only be good + return !(col == 3 && node->m_artist.EndsWith("Beethoven")); +} + wxDataViewItem MyMusicTreeModel::GetParent( const wxDataViewItem &item ) const { // the invisible root node has no parent @@ -525,3 +536,14 @@ bool MyListModel::SetValueByRow( const wxVariant &variant, return false; } + + +// ---------------------------------------------------------------------------- +// MyListStoreDerivedModel +// ---------------------------------------------------------------------------- + +bool MyListStoreDerivedModel::IsEnabledByRow(unsigned int row, unsigned int col) const +{ + // disabled the last two checkboxes + return !(col == 0 && 8 <= row && row <= 9); +}