7#include "../geometry/geometry.hpp"
8#include "../utility/utility.hpp"
9#include "../macros.hpp"
14hi_export_module(hikogui.layout.box_constraints);
16hi_export
namespace hi {
inline namespace v1 {
48 hi_axiom(holds_invariant());
53 hi_assert(new_minimum <= new_maximum);
57 inplace_max(r.minimum, new_minimum);
58 inplace_min(r.maximum, new_maximum);
60 inplace_max(r.preferred, r.minimum);
61 inplace_max(r.maximum, r.preferred);
62 hi_axiom(r.holds_invariant());
75 hi_axiom(holds_invariant());
86 [[nodiscard]]
constexpr bool holds_invariant()
const noexcept
91 if (minimum > preferred or preferred > maximum) {
100 inplace_max(r.minimum, rhs);
101 inplace_max(r.preferred, rhs);
102 inplace_max(r.maximum, rhs);
104 hi_axiom(r.holds_invariant());
118 inplace_max(r.minimum, rhs.minimum);
119 inplace_max(r.preferred, rhs.preferred);
120 inplace_max(r.maximum, rhs.maximum);
121 inplace_max(r.margins, rhs.margins);
123 hi_axiom(r.holds_invariant());
127 template<std::convertible_to<box_constra
ints>... Args>
131 return max(first, max(second, third, args...));
@ flush
Align the text naturally based on the writing direction of each paragraph.
@ justified
Stretch the text to be flush to both sides.
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Horizontal/Vertical alignment combination.
Definition alignment.hpp:244
A high-level geometric extent.
Definition extent2.hpp:32
constexpr float & width() noexcept
Access the x-as-width element from the extent.
Definition extent2.hpp:107
constexpr float & height() noexcept
Access the y-as-height element from the extent.
Definition extent2.hpp:118
The left, bottom, right and top margins.
Definition margins.hpp:25
2D constraints.
Definition box_constraints.hpp:25
friend constexpr box_constraints max(box_constraints const &lhs, box_constraints const &rhs) noexcept
Makes a constraint that encompasses both given constraints.
Definition box_constraints.hpp:115