13namespace hi {
inline namespace v1 {
37 vertical_alignment alignment,
39 float graphic_height = 0.0f) noexcept :
42 if (alignment == vertical_alignment::top) {
44 _bias = graphic_height * -0.5f + cap_height * -0.5f;
45 }
else if (alignment == vertical_alignment::middle) {
47 _bias = cap_height * -0.5f;
48 }
else if (alignment == vertical_alignment::bottom) {
50 _bias = graphic_height * 0.5f + cap_height * -0.5f;
63 constexpr widget_baseline(
float priority,
float gain,
float bias) noexcept : _priority(priority), _gain(gain), _bias(bias) {}
67 return lhs._priority <=> rhs._priority;
70 [[nodiscard]]
constexpr bool empty() const noexcept
72 return _priority == 0.0f;
75 explicit operator bool() const noexcept
85 [[nodiscard]]
constexpr float absolute(
float height)
const noexcept
87 return height * _gain + _bias;
91 float _priority = 0.0f;
#define hi_no_default()
This part of the code should not be reachable, unless a programming bug.
Definition assert.hpp:145
DOXYGEN BUG.
Definition algorithm.hpp:15
The HikoGUI namespace.
Definition ascii.hpp:19
The base-line of a widget on which to set the text and graphics.
Definition widget_baseline.hpp:19
constexpr float absolute(float height) const noexcept
Calculate the absolute base-line.
Definition widget_baseline.hpp:85
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:35
constexpr widget_baseline(float priority, float gain, float bias) noexcept
Construct a widget base-line.
Definition widget_baseline.hpp:63