X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4cfcb00f0076acc87833f52ecde7c9fdbfc16f78..009c72169f3dc90dbec89fdfe2956065aa35377f:/src/generic/selstore.cpp diff --git a/src/generic/selstore.cpp b/src/generic/selstore.cpp index 2422bd8057..4333aeaeaa 100644 --- a/src/generic/selstore.cpp +++ b/src/generic/selstore.cpp @@ -214,3 +214,19 @@ void wxSelectionStore::OnItemDelete(unsigned item) } } +void wxSelectionStore::SetItemCount(unsigned count) +{ + // forget about all items whose indices are now invalid if the size + // decreased + if ( count < m_count ) + { + for ( size_t i = m_itemsSel.GetCount(); i > 0; i-- ) + { + if ( m_itemsSel[i - 1] >= count ) + m_itemsSel.RemoveAt(i - 1); + } + } + + // remember the new number of items + m_count = count; +}