1 #ifndef TERMOX_WIDGET_LAYOUTS_HORIZONTAL_HPP
2 #define TERMOX_WIDGET_LAYOUTS_HORIZONTAL_HPP
8 #include "detail/linear_layout.hpp"
10 namespace ox::layout::h_detail {
13 [[nodiscard]]
auto operator()(
int primary,
int secondary)
const -> Area
15 return {primary, secondary};
20 [[nodiscard]]
auto operator()(
int primary,
int secondary)
const -> Point
22 return {primary, secondary};
34 [[nodiscard]]
auto operator()(
Widget const& w)
const ->
int
36 return w.
area().width;
41 [[nodiscard]]
auto operator()(
Widget const& w)
const ->
int
55 [[nodiscard]]
auto operator()(
Widget const& w)
const ->
int
57 return w.
area().height;
62 [[nodiscard]]
auto operator()(
Widget const& w)
const ->
int
69 Dimension_parameters<Primary_policy, Primary_length, Primary_offset>;
72 Dimension_parameters<Secondary_policy, Secondary_length, Secondary_offset>;
79 namespace ox::layout {
81 template <
typename Child_t = W
idget>
86 template <
typename Widget_t =
Widget,
typename... Args>
87 [[nodiscard]]
auto horizontal(Args&&... args)
88 -> std::unique_ptr<Horizontal<Widget_t>>
90 return std::make_unique<Horizontal<Widget_t>>(std::forward<Args>(args)...);
94 template <
typename Child_t>
97 auto is_horizontal_impl(...) -> std::false_type;
100 template <
typename T>
101 using Is_horizontal = decltype(detail::is_horizontal_impl(std::declval<T&>()));
104 template <
typename T>
105 inline bool constexpr is_horizontal_v = Is_horizontal<T>::value;
Defines how a Layout should resize a Widget in one length Dimension.
Definition: size_policy.hpp:11
Lays out Widgets in 2D, sharing space in a primary dimension.
Definition: linear_layout.hpp:35
Definition: linear_layout.hpp:15
Definition: linear_layout.hpp:25
Definition: horizontal.hpp:12
Definition: horizontal.hpp:19
Definition: horizontal.hpp:33
Definition: horizontal.hpp:40
Definition: horizontal.hpp:26
Definition: horizontal.hpp:54
Definition: horizontal.hpp:61
Definition: horizontal.hpp:47