AGW Logo

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

hierarchy Inheritance Diagram

Inheritance diagram for: SelectionStore

Inheritance diagram of SelectionStore


method_summary Methods Summary

__init__Default class constructor.
ClearClears the number of selected items.
GetSelectedCountReturn the total number of selected items.
IsSelectedReturns True if the given item is selected.
OnItemDeleteMust be called when an item is deleted.
SelectItemSelects the given item.
SelectRangeSelects a range of items.
SetItemCountSets the total number of items we handle.

API Class API

class SelectionStore(object)[source]

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__()[source]

Default class constructor.



Clear()[source]

Clears the number of selected items.



GetSelectedCount()[source]

Return the total number of selected items.



IsSelected(item)[source]

Returns True if the given item is selected.

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


OnItemDelete(item)[source]

Must be called when an item is deleted.

Parameters:item – the item that is being deleted.


SelectItem(item, select=True)[source]

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(itemFrom, itemTo, select=True)[source]

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(count)[source]

Sets the total number of items we handle.

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

Table Of Contents

Previous topic

PyImageList

Next topic

UltimateListCtrl