SelectionStore is used to store the selected items in the virtual controls, i.e. it is well suited for storing even when the control contains a huge (practically infinite) number of items.
Of course, internally it still has to store the selected items somehow (as an array currently) but the advantage is that it can handle the selection of all items (common operation) efficiently and that it could be made even smarter in the future (e.g. store the selections as an array of ranges + individual items) without changing its API.
Default class constructor. |
|
Clears the number of selected items. |
|
Return the total number of selected items. |
|
Returns |
|
Must be called when an item is deleted. |
|
Selects the given item. |
|
Selects a range of items. |
|
Sets the total number of items we handle. |
SelectionStore
(object)¶SelectionStore is used to store the selected items in the virtual controls, i.e. it is well suited for storing even when the control contains a huge (practically infinite) number of items.
Of course, internally it still has to store the selected items somehow (as an array currently) but the advantage is that it can handle the selection of all items (common operation) efficiently and that it could be made even smarter in the future (e.g. store the selections as an array of ranges + individual items) without changing its API.
__init__
(self)¶Default class constructor.
Clear
(self)¶Clears the number of selected items.
GetSelectedCount
(self)¶Return the total number of selected items.
IsSelected
(self, item)¶Returns True
if the given item is selected.
item – the item to check for selection state.
OnItemDelete
(self, item)¶Must be called when an item is deleted.
item – the item that is being deleted.
SelectItem
(self, item, select=True)¶Selects the given item.
item – the item to select;
select – True
to select the item, False
otherwise.
True
if the items selection really changed.
SelectRange
(self, itemFrom, itemTo, select=True)¶Selects a range of items.
itemFrom – the first index of the selection range;
itemTo – the last index of the selection range;
select – True
to select the items, False
otherwise.
True
and fill the itemsChanged array with the indices of items
which have changed state if “few” of them did, otherwise return False
(meaning that too many items changed state to bother counting them individually).
SetItemCount
(self, count)¶Sets the total number of items we handle.
count – the total number of items we handle.