1 #ifndef TERMOX_WIDGET_SIZE_POLICY_HPP
2 #define TERMOX_WIDGET_SIZE_POLICY_HPP
6 #include <signals_light/signal.hpp>
27 std::numeric_limits<decltype(data_.max)>
::max();
56 [[nodiscard]]
auto hint() const ->
int;
62 [[nodiscard]] auto
min() const ->
int;
68 [[nodiscard]] auto
max() const ->
int;
75 [[nodiscard]] auto
stretch() const ->
double;
108 template <
int Hint, typename Widget_t>
110 template <
typename... Args>
112 : Widget_t{std::forward<Args>(args)...}
117 explicit Fixed_height(
typename Widget_t::Parameters parameters)
118 : Widget_t{std::move(parameters)}
125 template <
int H
int,
typename W
idget_t>
127 template <
typename... Args>
128 explicit Fixed_width(Args&&... args) : Widget_t{std::forward<Args>(args)...}
133 explicit Fixed_width(
typename Widget_t::Parameters parameters)
134 : Widget_t{std::move(parameters)}
141 template <
int H
int,
typename W
idget_t>
143 template <
typename... Args>
145 : Widget_t{std::forward<Args>(args)...}
151 : Widget_t{std::move(parameters)}
158 template <
int H
int,
typename W
idget_t>
160 template <
typename... Args>
162 : Widget_t{std::forward<Args>(args)...}
167 explicit Minimum_width(
typename Widget_t::Parameters parameters)
168 : Widget_t{std::move(parameters)}
175 template <
int H
int,
typename W
idget_t>
177 template <
typename... Args>
179 : Widget_t{std::forward<Args>(args)...}
185 : Widget_t{std::move(parameters)}
192 template <
int H
int,
typename W
idget_t>
194 template <
typename... Args>
196 : Widget_t{std::forward<Args>(args)...}
201 explicit Maximum_width(
typename Widget_t::Parameters parameters)
202 : Widget_t{std::move(parameters)}
209 template <
int H
int,
typename W
idget_t>
211 template <
typename... Args>
213 : Widget_t{std::forward<Args>(args)...}
219 : Widget_t{std::move(parameters)}
226 template <
int H
int,
typename W
idget_t>
228 template <
typename... Args>
230 : Widget_t{std::forward<Args>(args)...}
236 : Widget_t{std::move(parameters)}
243 template <
int H
int,
typename W
idget_t>
245 template <
typename... Args>
247 : Widget_t{std::forward<Args>(args)...}
253 : Widget_t{std::move(parameters)}
260 template <
int H
int,
typename W
idget_t>
262 template <
typename... Args>
264 : Widget_t{std::forward<Args>(args)...}
270 : Widget_t{std::move(parameters)}
277 template <
int H
int,
typename W
idget_t>
279 template <
typename... Args>
281 : Widget_t{std::forward<Args>(args)...}
287 : Widget_t{std::move(parameters)}
294 template <
int H
int,
typename W
idget_t>
296 template <
typename... Args>
298 : Widget_t{std::forward<Args>(args)...}
304 : Widget_t{std::move(parameters)}
311 template <
typename W
idget_t>
313 template <
typename... Args>
315 : Widget_t{std::forward<Args>(args)...}
321 : Widget_t{std::move(parameters)}
328 template <
typename W
idget_t>
330 template <
typename... Args>
332 : Widget_t{std::forward<Args>(args)...}
337 explicit Ignored_width(
typename Widget_t::Parameters parameters)
338 : Widget_t{std::move(parameters)}
345 [[nodiscard]]
auto is_valid(
Size_policy const& p) -> bool;
Defines how a Layout should resize a Widget in one length Dimension.
Definition: size_policy.hpp:11
static auto ignored() -> Size_policy
Ignored: Stretch is the only consideration.
Definition: size_policy.cpp:91
auto can_ignore_min() const -> bool
Return if min can be ignored for the last displayed widget in a layout.
Definition: size_policy.cpp:50
sl::Signal< void()> policy_updated
Emitted on any changes to the Size_policy.
Definition: size_policy.hpp:23
static auto fixed(int hint) -> Size_policy
Fixed: hint is the only acceptable size.
Definition: size_policy.cpp:55
auto min() const -> int
Return the minimum length currently set.
Definition: size_policy.cpp:30
static auto minimum(int hint) -> Size_policy
Minimum: hint is the minimum acceptable size, may be larger.
Definition: size_policy.cpp:61
static auto minimum_expanding(int hint) -> Size_policy
Minimum Expanding: hint is minimum, it will expand into unused space.
Definition: size_policy.cpp:85
static auto maximum(int hint) -> Size_policy
Maximum: hint is the maximum acceptable size, may be smaller.
Definition: size_policy.cpp:67
auto hint() const -> int
Return the size hint currently being used.
Definition: size_policy.cpp:22
static auto preferred(int hint) -> Size_policy
Preferred: hint is preferred, though it can be any size.
Definition: size_policy.cpp:73
auto max() const -> int
Return the maximum length currently set.
Definition: size_policy.cpp:38
auto operator=(Size_policy const &x) -> Size_policy &
Specifically does not copy the Signal, so Widget is still notified.
Definition: size_policy.cpp:101
static auto expanding(int hint) -> Size_policy
Expanding: hint is preferred, but it will expand to use extra space.
Definition: size_policy.cpp:79
auto stretch() const -> double
Return the stretch value currently being used.
Definition: size_policy.cpp:46
static constexpr auto maximum_max
Largest possible value for max().
Definition: size_policy.hpp:26
Wrapper type to set the height Size_policy at construction.
Definition: size_policy.hpp:244
Wrapper type to set the width Size_policy at construction.
Definition: size_policy.hpp:261
Wrapper type to set the height Size_policy at construction.
Definition: size_policy.hpp:109
Wrapper type to set the width Size_policy at construction.
Definition: size_policy.hpp:126
Wrapper type to set the height Size_policy at construction.
Definition: size_policy.hpp:312
Wrapper type to set the width Size_policy at construction.
Definition: size_policy.hpp:329
Wrapper type to set the height Size_policy at construction.
Definition: size_policy.hpp:176
Wrapper type to set the width Size_policy at construction.
Definition: size_policy.hpp:193
Wrapper type to set the height Size_policy at construction.
Definition: size_policy.hpp:278
Wrapper type to set the width Size_policy at construction.
Definition: size_policy.hpp:295
Wrapper type to set the height Size_policy at construction.
Definition: size_policy.hpp:142
Wrapper type to set the width Size_policy at construction.
Definition: size_policy.hpp:159
Wrapper type to set the height Size_policy at construction.
Definition: size_policy.hpp:210
Wrapper type to set the width Size_policy at construction.
Definition: size_policy.hpp:227