Phoenix Logo

phoenix_title wx.lib.agw.ultimatelistctrl.SelectionStore

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.


class_hierarchy Class Hierarchy

Inheritance diagram for class SelectionStore:


method_summary Methods Summary

__init__ Default class constructor.
Clear Clears the number of selected items.
GetSelectedCount Return the total number of selected items.
IsSelected Returns True if the given item is selected.
OnItemDelete Must be called when an item is deleted.
SelectItem Selects the given item.
SelectRange Selects a range of items.
SetItemCount Sets the total number of items we handle.

api Class API



class 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.


Methods



__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.

Parameters:item – the item to check for selection state.


OnItemDelete(self, item)

Must be called when an item is deleted.

Parameters:item – the item that is being deleted.


SelectItem(self, item, select=True)

Selects the given item.

Parameters:
  • item – the item to select;
  • selectTrue to select the item, False otherwise.
Returns:

True if the items selection really changed.



SelectRange(self, itemFrom, itemTo, select=True)

Selects a range of items.

Parameters:
  • itemFrom – the first index of the selection range;
  • itemTo – the last index of the selection range;
  • selectTrue to select the items, False otherwise.
Returns:

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.

Parameters:count – the total number of items we handle.