tbx
0.7.6
|
Class to implement multiple selections. More...
#include <selection.h>
Classes | |
class | MultiIteratorImpl |
Class derived to implement iterator. More... | |
Public Member Functions | |
virtual Type | type () const |
Returns the type of this selection class. | |
virtual bool | selected (unsigned int index) const |
Returns true if an item is selected. More... | |
virtual unsigned int | first () const |
Returns first selected item. More... | |
virtual unsigned int | last () const |
Returns last selected item. | |
virtual bool | empty () const |
Returns true if selection is empty. | |
virtual unsigned int | count () const |
Return the number of selected items. More... | |
virtual bool | any () const |
Returns true if one or more items are selected. | |
virtual bool | one () const |
Returns true if only one item is selected. | |
virtual bool | many () const |
Returns true if there are more than one item selected. | |
virtual void | inserted (unsigned int index, unsigned int count) |
Data has been inserted so adjust selection. | |
virtual void | removed (unsigned int index, unsigned int count) |
Data has been removed so adjust selection. | |
virtual void | clear () |
Clear the selection. | |
virtual void | set (unsigned int index) |
Modifiy the selection so it only consist of the given index. More... | |
virtual void | select (unsigned int index) |
Add the index to the selection. | |
virtual void | deselect (unsigned int index) |
Remove selection from given index. | |
virtual void | toggle (unsigned int index) |
Toggle the selected index. | |
virtual void | set (unsigned int from, unsigned int to) |
Change the selection to be the specified range. | |
virtual void | select (unsigned int from, unsigned int to) |
Select a range of values. | |
virtual void | deselect (unsigned int from, unsigned int to) |
Deselect a range of values. | |
virtual void | toggle (unsigned int from, unsigned int to) |
Toggle selected items in the range. | |
![]() | |
void | add_listener (SelectionListener *listener) |
Add listeners. More... | |
void | remove_listener (SelectionListener *listener) |
Remove listener for selection changes. | |
Iterator | begin () const |
Get iterator to first selected item. More... | |
Iterator | end () const |
Get iterator to end of selection. More... | |
Protected Member Functions | |
virtual IteratorImpl * | get_iterator_impl () const |
Get initial iterator implementation. | |
![]() | |
Selection () | |
Protected constructor, must always use a subclass. | |
void | fire_event (const SelectionChangedEvent &event) |
Helper for subclasses to fire Selection Changed Events. | |
void | fire_event (unsigned int index, bool selected, bool final) |
Helper for subclasses to fire Selection Changed Events. | |
void | fire_event (unsigned int from, unsigned int to, bool selected, bool final) |
Helper for subclasses to fire Selection Changed Events. | |
Additional Inherited Members | |
![]() | |
enum | Type { NONE, SINGLE, MULTIPLE } |
Type of selection. | |
![]() | |
static const unsigned int | NO_SELECTION = -1 |
Constant for indices when there is no selection. | |
Class to implement multiple selections.
|
virtual |
Return the number of selected items.
Count number of selected items.
Implements tbx::view::Selection.
|
inlinevirtual |
Returns first selected item.
Only one item is ever selected so first() always equals last().
Implements tbx::view::Selection.
|
virtual |
Returns true if an item is selected.
Check if the given index is selected.
index | of item to test |
index | to check |
Implements tbx::view::Selection.
|
virtual |
Modifiy the selection so it only consist of the given index.
index | new selection |
Implements tbx::view::Selection.