X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce00f59b5b169752d2f05ce3bb1a88ddc1b38b4c..0d53638f7147c18153f63fdfc096b17be6e22a27:/samples/dataview/mymodels.cpp diff --git a/samples/dataview/mymodels.cpp b/samples/dataview/mymodels.cpp index 79fc7170bb..e1df2f0881 100644 --- a/samples/dataview/mymodels.cpp +++ b/samples/dataview/mymodels.cpp @@ -4,7 +4,6 @@ // Author: Robert Roebling // Modified by: Francesco Montorsi, Bo Yang // Created: 06/01/06 -// RCS-ID: $Id$ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -244,6 +243,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 +535,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); +}