Handle multiple item insertion and deletion in wxSelectionStore.

Rename the existing but not implemented and never used OnItemAdd() method to
OnItemsInserted() and add OnItemsDeleted(), which is more efficient than
OnItemDelete() when many items are being removed from the control at once.

This is not used yet, but will be used in wxDataViewCtrl soon and maybe in the
other controls later.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77904 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-09-27 20:46:21 +00:00
parent 06ab4da3f3
commit adf8f9d0cd
3 changed files with 101 additions and 3 deletions

View File

@@ -47,12 +47,16 @@ public:
// special case of SetItemCount(0)
void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; }
// must be called when a new item is inserted/added
void OnItemAdd(unsigned WXUNUSED(item)) { wxFAIL_MSG( wxT("TODO") ); }
// must be called when new items are inserted/added
void OnItemsInserted(unsigned item, unsigned numItems);
// must be called when an item is deleted
// must be called when an items is deleted
void OnItemDelete(unsigned item);
// more efficient version for notifying the selection about deleting
// several items at once, return true if any of them were selected
bool OnItemsDeleted(unsigned item, unsigned numItems);
// select one item, use SelectRange() insted if possible!
//
// returns true if the items selection really changed