X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8b6cf9bf10a43343734d1bb22f2fae3ade2f4a67..2f94ab4099941a5f47ced25799dd28b12ccdc319:/src/common/datavcmn.cpp diff --git a/src/common/datavcmn.cpp b/src/common/datavcmn.cpp index f487ba4d0c..a77fcb9387 100644 --- a/src/common/datavcmn.cpp +++ b/src/common/datavcmn.cpp @@ -326,6 +326,29 @@ wxDataViewIndexListModel::~wxDataViewIndexListModel() { } +void wxDataViewIndexListModel::Reset( unsigned int new_size ) +{ + if (m_useHash) + { + m_hash.Clear(); + + // IDs are ordered until an item gets deleted or inserted + m_ordered = true; + + // build initial index + unsigned int i; + for (i = 1; i < new_size+1; i++) + m_hash.Add( (void*) i ); + m_lastIndex = new_size + 1; + } + else + { + m_lastIndex = new_size-1; + } + + wxDataViewModel::Cleared(); +} + void wxDataViewIndexListModel::RowPrepended() { if (m_useHash) @@ -549,7 +572,7 @@ unsigned int wxDataViewIndexListModel::GetChildren( const wxDataViewItem &item, return 0; children = m_hash; - + return m_hash.GetCount(); }