A table's selected keys and active key.
More...
#include <selection.hpp>
|
| bool | select (RowId key) |
| | Selects a row; in Single mode it replaces the selection.
|
| bool | deselect (RowId key) |
| | Deselects a row.
|
| bool | toggle (RowId key) |
| | Selects an unselected row, or deselects a selected one.
|
| void | clear () |
| | Deselects every row.
|
| std::expected< void, TableError > | selectAll (Engine const &engine) |
| | Selects every row in the engine's view.
|
| void | viewChanged (Engine const &engine) |
| | Brings the selection up to date after the view changed: with pruneOnFilter, drops selected rows no longer in the view.
|
| void | setActiveKey (std::optional< RowId > key) |
| | Moves the cursor.
|
| std::optional< RowId > const & | activeKey () const noexcept |
| | The row with the cursor.
|
| bool | contains (RowId const &key) const |
| | Whether a row is selected.
|
| std::size_t | selectedCount () const noexcept |
| | Selected rows.
|
| std::vector< RowId > const & | keys () const noexcept |
| | The selected keys, in the order they were selected.
|
| SelectionOptions const & | options () const noexcept |
| | The configuration.
|
|
| static std::expected< Selection, TableError > | create (SelectionOptions options) |
| | Builds a selection.
|
| static bool | activate (Engine const &engine, std::size_t viewRow, std::function< void(RowId const &)> const &onActivate) |
| | Activates the row at a view row: reports it and changes no selection.
|
A table's selected keys and active key.
Definition at line 60 of file selection.hpp.
◆ create()
Builds a selection.
- Parameters
-
| options | The configuration. |
- Returns
- The selection, or Unavailable when
options asks to prune in server mode.
Definition at line 66 of file selection.hpp.
◆ select()
| bool morph::table::Selection::select |
( |
RowId | key | ) |
|
|
inline |
Selects a row; in Single mode it replaces the selection.
- Parameters
-
| key | The row's key, by value: it may come from keys(), which this call changes. |
- Returns
- false in None mode.
Definition at line 79 of file selection.hpp.
◆ deselect()
| bool morph::table::Selection::deselect |
( |
RowId | key | ) |
|
|
inline |
Deselects a row.
- Parameters
-
| key | The row's key, by value: it may come from keys(), which this call changes. |
- Returns
- true when it was selected.
Definition at line 98 of file selection.hpp.
◆ toggle()
| bool morph::table::Selection::toggle |
( |
RowId | key | ) |
|
|
inline |
Selects an unselected row, or deselects a selected one.
- Parameters
-
| key | The row's key, by value: it may come from keys(), which this call changes. |
- Returns
- Whether the row is selected afterwards.
Definition at line 110 of file selection.hpp.
◆ clear()
| void morph::table::Selection::clear |
( |
| ) |
|
|
inline |
◆ selectAll()
| std::expected< void, TableError > morph::table::Selection::selectAll |
( |
Engine const & | engine | ) |
|
|
inline |
Selects every row in the engine's view.
- Parameters
-
| engine | The table's engine. |
- Returns
- Unavailable in server mode or unless the mode is Multiple.
Definition at line 126 of file selection.hpp.
◆ viewChanged()
| void morph::table::Selection::viewChanged |
( |
Engine const & | engine | ) |
|
|
inline |
Brings the selection up to date after the view changed: with pruneOnFilter, drops selected rows no longer in the view.
- Parameters
-
| engine | The table's engine. |
Definition at line 141 of file selection.hpp.
◆ setActiveKey()
| void morph::table::Selection::setActiveKey |
( |
std::optional< RowId > | key | ) |
|
|
inline |
Moves the cursor.
- Parameters
-
| key | The row's key, or nothing for no cursor. |
Definition at line 156 of file selection.hpp.
◆ activeKey()
| std::optional< RowId > const & morph::table::Selection::activeKey |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
The row with the cursor.
- Returns
- Its key, or nothing.
Definition at line 160 of file selection.hpp.
◆ contains()
| bool morph::table::Selection::contains |
( |
RowId const & | key | ) |
const |
|
inlinenodiscard |
Whether a row is selected.
- Parameters
-
- Returns
- true when selected.
Definition at line 165 of file selection.hpp.
◆ selectedCount()
| std::size_t morph::table::Selection::selectedCount |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ keys()
| std::vector< RowId > const & morph::table::Selection::keys |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
The selected keys, in the order they were selected.
- Returns
- The keys.
Definition at line 173 of file selection.hpp.
◆ options()
The configuration.
- Returns
- The options.
Definition at line 177 of file selection.hpp.
◆ activate()
| bool morph::table::Selection::activate |
( |
Engine const & | engine, |
|
|
std::size_t | viewRow, |
|
|
std::function< void(RowId const &)> const & | onActivate ) |
|
inlinestatic |
Activates the row at a view row: reports it and changes no selection.
- Parameters
-
| engine | The table's engine. |
| viewRow | The view row. |
| onActivate | Receives the row's key. |
- Returns
- false when
viewRow is past the view.
Definition at line 184 of file selection.hpp.
The documentation for this class was generated from the following file: