7#include "abstract_button_widget.hpp"
8#include "default_button_delegate.hpp"
10namespace hi::inline v1 {
70 template<
typename Value,
typename... Args>
72 requires(not std::is_convertible_v<Value, weak_or_unique_ptr<delegate_type>>) :
76 make_unique_default_button_delegate<
button_type::
toggle>(
std::forward<Value>(value),
std::forward<Args>(args)...))
82 void set_layout(
widget_layout const &layout) noexcept override;
83 void draw(
draw_context const &context) noexcept override;
86 static constexpr
std::chrono::nanoseconds _animation_duration =
std::chrono::milliseconds(150);
90 animator<
float> _animated_value = _animation_duration;
92 float _pip_move_range;
95 void draw_toggle_button(
draw_context const &context) noexcept;
96 void draw_toggle_pip(
draw_context const &context) noexcept;
button_type
The type of button.
Definition button_type.hpp:13
A type that gets animated between two values.
Definition animator.hpp:17
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:20
Draw context for drawing using the HikoGUI shaders.
Definition draw_context.hpp:52
Definition gui_window.hpp:39
Class that hold either a weak_ptr or a unique_ptr This class is to hold a weak_ptr,...
Definition weak_or_unique_ptr.hpp:25
Definition abstract_button_widget.hpp:23
Definition button_delegate.hpp:14
A GUI widget that permits the user to make a binary choice.
Definition toggle_widget.hpp:48
toggle_widget(gui_window &window, widget *parent, std::unique_ptr< delegate_type > delegate) noexcept
Construct a toggle widget.
toggle_widget(gui_window &window, widget *parent, Value &&value, Args &&...args) noexcept
Construct a toggle widget with a default button delegate.
Definition toggle_widget.hpp:71
An interactive graphical object as part of the user-interface.
Definition widget.hpp:39
Definition widget_constraints.hpp:13
Definition widget_layout.hpp:18