|
psychic-ui 0.0.0
|
#include <Length.hpp>
Public Types | |
| enum class | Unit : std::uint8_t { Px , Percent , Auto } |
Public Member Functions | |
| constexpr | Length (float value, Unit unit) |
| template<class T> requires (std::is_arithmetic_v<T> && !std::same_as<T, bool>) | |
| constexpr | Length (T px) |
| constexpr bool | isPx () const |
| constexpr bool | isPercent () const |
| constexpr bool | isAuto () const |
| constexpr float | resolve (float relativeTo, float fallback=0.0f) const |
| constexpr bool | operator== (const Length &) const =default |
Static Public Member Functions | |
| static constexpr Length | px (float value) |
| static constexpr Length | percent (float value) |
Public Attributes | |
| float | value {0.0f} |
| Unit | unit {Unit::Px} |
A length in pixels, in percent of the parent (0-100, like CSS), or Auto. A plain number is pixels: width(24). Percent and auto read like CSS: width(50_pct), width(Auto).
|
inlineconstexpr |
Pixels. Any number but a bool, which is a mistake
|
inlinenodiscardconstexpr |
The length in pixels, given what a percent is relative to; fallback when auto