]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/dataview/mymodels.cpp
Rebake everything using bakefile 0.2.9.
[wxWidgets.git] / samples / dataview / mymodels.cpp
index 8ea635899a64a126a6794aa0eb5eba29ee0b561a..a3cb11119813bf39b0a076c624199e5b3f95c6c1 100644 (file)
@@ -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
@@ -348,7 +359,7 @@ void MyListModel::Prepend( const wxString &text )
 void MyListModel::DeleteItem( const wxDataViewItem &item )
 {
     unsigned int row = GetRow( item );
-    
+
     if (row >= m_textColValues.GetCount())
         return;
 
@@ -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);
+}