morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::table::ColumnLayout Class Reference

Column order and visibility, kept apart from the engine's view. More...

#include <engine.hpp>

Public Member Functions

 ColumnLayout (std::vector< std::string > ids)
 A layout of ids, all visible, in that order.
std::span< std::string const > order () const noexcept
 The columns in display order.
std::vector< std::string > visible () const
 The visible columns in display order.
bool setVisible (std::string const &columnId, bool show)
 Shows or hides a column.
bool move (std::string const &columnId, std::size_t position)
 Moves a column to a display position.
void reset ()
 Restores the default order with every column visible.
void rebuild (std::vector< std::string > ids)
 Adopts a new column list: kept columns keep their place and visibility, new ones are appended visible, vanished ones dropped.

Detailed Description

Column order and visibility, kept apart from the engine's view.

At least one column stays visible.

Definition at line 124 of file engine.hpp.

Constructor & Destructor Documentation

◆ ColumnLayout()

morph::table::ColumnLayout::ColumnLayout ( std::vector< std::string > ids)
inlineexplicit

A layout of ids, all visible, in that order.

Parameters
idsColumn ids, the document's default order.

Definition at line 128 of file engine.hpp.

Member Function Documentation

◆ order()

std::span< std::string const > morph::table::ColumnLayout::order ( ) const
inlinenodiscardnoexcept

The columns in display order.

Returns
Column ids.

Definition at line 132 of file engine.hpp.

◆ visible()

std::vector< std::string > morph::table::ColumnLayout::visible ( ) const
inlinenodiscard

The visible columns in display order.

Returns
Column ids.

Definition at line 136 of file engine.hpp.

◆ setVisible()

bool morph::table::ColumnLayout::setVisible ( std::string const & columnId,
bool show )
inline

Shows or hides a column.

Parameters
columnIdColumn columnId.
showtrue to show.
Returns
false when the column is unknown, or hiding it would leave none visible.

Definition at line 150 of file engine.hpp.

◆ move()

bool morph::table::ColumnLayout::move ( std::string const & columnId,
std::size_t position )
inline

Moves a column to a display position.

Parameters
columnIdColumn columnId.
positionPosition in order(), clamped to the end.
Returns
false when the column is unknown.

Definition at line 169 of file engine.hpp.

◆ reset()

void morph::table::ColumnLayout::reset ( )
inline

Restores the default order with every column visible.

Definition at line 182 of file engine.hpp.

◆ rebuild()

void morph::table::ColumnLayout::rebuild ( std::vector< std::string > ids)
inline

Adopts a new column list: kept columns keep their place and visibility, new ones are appended visible, vanished ones dropped.

Parameters
idsThe new columns, as the new default order.

Definition at line 190 of file engine.hpp.


The documentation for this class was generated from the following file: