morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
selection.hpp File Reference

A table's selection and activation, kept by row key. More...

#include <cstddef>
#include <cstdint>
#include <expected>
#include <functional>
#include <morph/table/data_source.hpp>
#include <morph/table/engine.hpp>
#include <optional>
#include <unordered_set>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  morph::table::SelectionOptions
 A selection's configuration. More...
class  morph::table::Selection
 A table's selected keys and active key. More...
struct  morph::table::TableCounts
 The counts a status line shows. More...

Enumerations

enum class  morph::table::TableMode : std::uint8_t { Client , Server , Hybrid }
 Where a table's rows are sorted and filtered. More...
enum class  morph::table::SelectionMode : std::uint8_t { None , Single , Multiple }
 How many rows a selection may hold. More...

Functions

TableCounts morph::table::counts (Engine const &engine, Selection const &selection)
 A table's counts.

Detailed Description

A table's selection and activation, kept by row key.

Selection is a set of RowIds plus an active key (the row with the cursor). Because it is kept by key, it survives sort, filter and refetch: a row that leaves the view stays selected unless the table prunes on filter. Activation (double-click, Enter) reports a row and does not change the selection.

In server mode a selected row may be outside the fetched pages, so "select all" and pruning are not available; the selection is the set of keys the user chose.

See docs/spec/table/engine.md.

Definition in file selection.hpp.

Enumeration Type Documentation

◆ TableMode

enum class morph::table::TableMode : std::uint8_t
strong

Where a table's rows are sorted and filtered.

Enumerator
Client 

The client holds every row and the engine sorts and filters them.

Server 

The server sorts and filters; the client holds fetched pages.

Hybrid 

A server search whose result the client engine sorts and filters.

Definition at line 36 of file selection.hpp.

◆ SelectionMode

enum class morph::table::SelectionMode : std::uint8_t
strong

How many rows a selection may hold.

Enumerator
None 

Rows cannot be selected.

Single 

At most one row.

Multiple 

Any number of rows.

Definition at line 43 of file selection.hpp.

Function Documentation

◆ counts()

TableCounts morph::table::counts ( Engine const & engine,
Selection const & selection )
inlinenodiscard

A table's counts.

Parameters
engineThe table's engine.
selectionThe table's selection.
Returns
View, source and selected counts.

Definition at line 218 of file selection.hpp.