Add possibility to iterate over all selected items in wxSelectionStore.

This is necessary for retrieving all the selected items at once: while doing
this is not recommended for a control with a potentially very large number of
items, it must be possible to allow using wxSelectionStore for wxDataViewCtrl
implementation as wxDataViewCtrl must implement its GetSelections() method.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77902 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-09-27 20:46:15 +00:00
parent f5941e4f83
commit d058c09e9f
3 changed files with 70 additions and 0 deletions

View File

@@ -78,6 +78,19 @@ public:
: m_itemsSel.GetCount();
}
// type of a "cookie" used to preserve the iteration state, this is an
// opaque type, don't rely on its current representation
typedef size_t IterationState;
// constant representing absence of selection and hence end of iteration
static const unsigned NO_SELECTION = static_cast<unsigned>(-1);
// get the first selected item in index order, return NO_SELECTION if none
unsigned GetFirstSelectedItem(IterationState& cookie) const;
// get the next selected item, return NO_SELECTION if no more
unsigned GetNextSelectedItem(IterationState& cookie) const;
private:
// (re)init
void Init() { m_count = 0; m_defaultState = false; }