morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::Sizing Struct Reference

How much space a widget asks for along one dimension, in backend units (a character cell on the TUI). More...

#include <view.hpp>

Public Types

enum class  Kind : std::uint8_t { Content , Fixed , Stretch }
 The sizing rule. More...

Public Member Functions

bool operator== (Sizing const &) const =default
 Memberwise equality.

Static Public Member Functions

static constexpr Sizing content () noexcept
 Size to the content.
static constexpr Sizing fixed (int units) noexcept
 A fixed size.
static constexpr Sizing stretch (int weight=1) noexcept
 A share of the leftover space.

Public Attributes

Kind kind = Kind::Content
 The rule.
int amount = 0
 Units for Fixed, weight for Stretch, unused for Content.

Detailed Description

How much space a widget asks for along one dimension, in backend units (a character cell on the TUI).

Definition at line 270 of file view.hpp.

Member Enumeration Documentation

◆ Kind

enum class morph::ui::Sizing::Kind : std::uint8_t
strong

The sizing rule.

Enumerator
Content 

As much as the content needs.

Fixed 

Exactly amount units.

Stretch 

A share of the leftover space, weighted by amount.

Definition at line 272 of file view.hpp.

Member Function Documentation

◆ content()

constexpr Sizing morph::ui::Sizing::content ( )
inlinestaticnodiscardconstexprnoexcept

Size to the content.

Returns
The sizing.

Definition at line 284 of file view.hpp.

◆ fixed()

constexpr Sizing morph::ui::Sizing::fixed ( int units)
inlinestaticnodiscardconstexprnoexcept

A fixed size.

Parameters
unitsThe size in backend units.
Returns
The sizing.

Definition at line 289 of file view.hpp.

◆ stretch()

constexpr Sizing morph::ui::Sizing::stretch ( int weight = 1)
inlinestaticnodiscardconstexprnoexcept

A share of the leftover space.

Parameters
weightThe share's weight.
Returns
The sizing.

Definition at line 294 of file view.hpp.

◆ operator==()

bool morph::ui::Sizing::operator== ( Sizing const & ) const
default

Memberwise equality.

Returns
Whether both rules and amounts match.

Member Data Documentation

◆ kind

Kind morph::ui::Sizing::kind = Kind::Content

The rule.

Definition at line 278 of file view.hpp.

◆ amount

int morph::ui::Sizing::amount = 0

Units for Fixed, weight for Stretch, unused for Content.

Definition at line 280 of file view.hpp.


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