TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::SizeConstraintAxis Struct Reference

Per-axis size constraint: an explicit size, or a min / max clamp on the content-driven size. More...

#include <gui_core/layout/gui_constraints.h>

Public Member Functions

constexpr void SetValue (CssPx v)
 Setters take CSS px (scaled when the element is added) or Pixels (used as is).
constexpr void SetValue (Pixels v)
constexpr void SetMin (CssPx v)
constexpr void SetMin (Pixels v)
constexpr void SetMax (CssPx v)
constexpr void SetMax (Pixels v)
template<class PxFn>
constexpr void ResolveCss (const PxFn &px)
 CSS px to pixels, with px (the style manager's Px).
constexpr bool HasFixed () const
 True when an explicit size is set.
constexpr int32_t Clamp (int32_t s) const
 Clamps s to [min, max].
constexpr int32_t Apply (int32_t s) const
 The explicit size if set, else s clamped to [min, max].
bool operator== (const SizeConstraintAxis &) const noexcept=default

Public Attributes

int32_t value = kAuto
 Explicit size (kAuto = content-driven).
int32_t min = 0
 Lower clamp for the content-driven size.
int32_t max = kUnbounded
 Upper clamp for the content-driven size.
uint8_t cssMask = 0
 Which of value / min / max are CSS px, scaled to pixels when the element is added.

Static Public Attributes

static constexpr int32_t kAuto = -1
 No explicit size.
static constexpr int32_t kUnbounded = std::numeric_limits<int32_t>::max()
 No maximum.
static constexpr uint8_t kValueCss = 1
static constexpr uint8_t kMinCss = 2
static constexpr uint8_t kMaxCss = 4

Detailed Description

Per-axis size constraint: an explicit size, or a min / max clamp on the content-driven size.

Member Function Documentation

◆ SetValue() [1/2]

void tachyon::SizeConstraintAxis::SetValue ( CssPx v)
inlineconstexpr

Setters take CSS px (scaled when the element is added) or Pixels (used as is).

◆ SetValue() [2/2]

void tachyon::SizeConstraintAxis::SetValue ( Pixels v)
inlineconstexpr

◆ SetMin() [1/2]

void tachyon::SizeConstraintAxis::SetMin ( CssPx v)
inlineconstexpr

◆ SetMin() [2/2]

void tachyon::SizeConstraintAxis::SetMin ( Pixels v)
inlineconstexpr

◆ SetMax() [1/2]

void tachyon::SizeConstraintAxis::SetMax ( CssPx v)
inlineconstexpr

◆ SetMax() [2/2]

void tachyon::SizeConstraintAxis::SetMax ( Pixels v)
inlineconstexpr

◆ ResolveCss()

template<class PxFn>
void tachyon::SizeConstraintAxis::ResolveCss ( const PxFn & px)
inlineconstexpr

CSS px to pixels, with px (the style manager's Px).

◆ HasFixed()

bool tachyon::SizeConstraintAxis::HasFixed ( ) const
inlineconstexpr

True when an explicit size is set.

◆ Clamp()

int32_t tachyon::SizeConstraintAxis::Clamp ( int32_t s) const
inlineconstexpr

Clamps s to [min, max].

◆ Apply()

int32_t tachyon::SizeConstraintAxis::Apply ( int32_t s) const
inlineconstexpr

The explicit size if set, else s clamped to [min, max].

◆ operator==()

bool tachyon::SizeConstraintAxis::operator== ( const SizeConstraintAxis & ) const
defaultnoexcept

Member Data Documentation

◆ kAuto

int32_t tachyon::SizeConstraintAxis::kAuto = -1
staticconstexpr

No explicit size.

◆ kUnbounded

int32_t tachyon::SizeConstraintAxis::kUnbounded = std::numeric_limits<int32_t>::max()
staticconstexpr

No maximum.

◆ value

int32_t tachyon::SizeConstraintAxis::value = kAuto

Explicit size (kAuto = content-driven).

◆ min

int32_t tachyon::SizeConstraintAxis::min = 0

Lower clamp for the content-driven size.

◆ max

int32_t tachyon::SizeConstraintAxis::max = kUnbounded

Upper clamp for the content-driven size.

◆ cssMask

uint8_t tachyon::SizeConstraintAxis::cssMask = 0

Which of value / min / max are CSS px, scaled to pixels when the element is added.

◆ kValueCss

uint8_t tachyon::SizeConstraintAxis::kValueCss = 1
staticconstexpr

◆ kMinCss

uint8_t tachyon::SizeConstraintAxis::kMinCss = 2
static

◆ kMaxCss

uint8_t tachyon::SizeConstraintAxis::kMaxCss = 4
static

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