dataview sample: Added test for wxDataViewModel::Cleared functionality: Ctrl-W will clear MyMusicTreeModel. Ctrl-W can be pressed while editing some item (artist is editable)

This commit is contained in:
valid-ptr
2022-01-18 17:00:15 +03:00
committed by konstantin.matveyev
parent 8aae7ad937
commit 0199a8ce49
3 changed files with 25 additions and 0 deletions

View File

@@ -152,6 +152,21 @@ void MyMusicTreeModel::Delete( const wxDataViewItem &item )
// notify control
ItemDeleted( parent, item );
}
void MyMusicTreeModel::Clear()
{
m_pop = NULL;
m_classical = NULL;
m_ninth = NULL;
while (!m_root->GetChildren().IsEmpty())
{
MyMusicTreeModelNode* node = m_root->GetNthChild(0);
m_root->GetChildren().Remove(node);
delete node;
}
Cleared();
}
int MyMusicTreeModel::Compare( const wxDataViewItem &item1, const wxDataViewItem &item2,
unsigned int column, bool ascending ) const