9namespace hi::inline v1 {
33 float graphic_height = 0.0f) noexcept :
36 if (
alignment == vertical_alignment::top) {
38 _bias = graphic_height * -0.5f + cap_height * -0.5f;
39 }
else if (
alignment == vertical_alignment::middle) {
41 _bias = cap_height * -0.5f;
42 }
else if (
alignment == vertical_alignment::bottom) {
44 _bias = graphic_height * 0.5f + cap_height * -0.5f;
57 constexpr widget_baseline(
float priority,
float gain,
float bias) noexcept : _priority(priority), _gain(gain), _bias(bias) {}
61 return lhs._priority <=> rhs._priority;
64 [[nodiscard]]
constexpr bool empty() const noexcept
66 return _priority == 0.0f;
69 explicit operator bool() const noexcept
79 [[nodiscard]]
constexpr float absolute(
float height)
const noexcept
81 return height * _gain + _bias;
85 float _priority = 0.0f;
vertical_alignment
Vertical alignment.
Definition alignment.hpp:17
Definition alignment.hpp:64
The base-line of a widget on which to set the text and graphics.
Definition widget_baseline.hpp:13
constexpr float absolute(float height) const noexcept
Calculate the absolute base-line.
Definition widget_baseline.hpp:79
constexpr widget_baseline(float priority, vertical_alignment alignment, float cap_height, float graphic_height=0.0f) noexcept
Construct a widget base-line.
Definition widget_baseline.hpp:29
constexpr widget_baseline(float priority, float gain, float bias) noexcept
Construct a widget base-line.
Definition widget_baseline.hpp:57