tbx
0.7.3
|
Class to represent a single selection. More...
#include <selection.h>
Classes | |
class | SingleIteratorImpl |
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. | |
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 |
Always returns false. More... | |
virtual void | inserted (unsigned int index, unsigned int count) |
Called by the object selection is on when new items have been inserted and selected item need to be moved. More... | |
virtual void | removed (unsigned int index, unsigned int count) |
Called by the object selection is on when items have been removed and selected item to be deleted or moved. More... | |
virtual void | clear () |
Clear the current selection. | |
virtual void | set (unsigned int index) |
Select an item. More... | |
virtual void | select (unsigned int index) |
Select an item. More... | |
virtual void | deselect (unsigned int index) |
Clear the selection for an item. More... | |
virtual void | toggle (unsigned int index) |
Toggle the selection for an item. More... | |
virtual void | set (unsigned int from, unsigned int to) |
Set the selection a range of items. More... | |
virtual void | select (unsigned int from, unsigned int to) |
Selection a range of items. More... | |
virtual void | deselect (unsigned int from, unsigned int to) |
Deselect a range of items. More... | |
virtual void | toggle (unsigned int from, unsigned int to) |
Toggle the selection of a range of items. More... | |
![]() | |
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 |
Override to return the iterator implementation for the selection iterator to used. More... | |
![]() | |
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 represent a single selection.
|
virtual |
|
virtual |
Deselect a range of items.
For a single selection from and to must be identical
from | first index to deselect |
to | last index to deselect |
std::runtime_error | if from != to |
Implements tbx::view::Selection.
|
inlinevirtual |
Returns first selected item.
Only one item is ever selected so first() always equals last().
Implements tbx::view::Selection.
|
inlineprotectedvirtual |
Override to return the iterator implementation for the selection iterator to used.
Implements tbx::view::Selection.
|
virtual |
Called by the object selection is on when new items have been inserted and selected item need to be moved.
index | of the insertion |
count | of items inserted |
Implements tbx::view::Selection.
|
inlinevirtual |
|
virtual |
Called by the object selection is on when items have been removed and selected item to be deleted or moved.
index | of the insertion |
count | of items inserted |
Implements tbx::view::Selection.
|
virtual |
Select an item.
Causes current item to be deselected so in this case is identical to set(index)
index | to select |
Implements tbx::view::Selection.
|
virtual |
Selection a range of items.
For a single selection from and to must be identical and this is equivalent to set(from).
from | first index to select |
to | last index to select |
std::runtime_error | if from != to |
Implements tbx::view::Selection.
|
inlinevirtual |
Returns true if an item is selected.
index | of item to test |
Implements tbx::view::Selection.
|
virtual |
Select an item.
Caused current selected item to be deselected.
index | to select |
Implements tbx::view::Selection.
|
virtual |
Set the selection a range of items.
For a single selection from and to must be identical
from | first index to select |
to | last index to select |
std::runtime_error | if from != to |
Implements tbx::view::Selection.
|
virtual |
|
virtual |
Toggle the selection of a range of items.
For a single selection from and to must be identical
from | first index to toggle |
to | last index to toggle |
std::runtime_error | if from != to |
Implements tbx::view::Selection.