HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
momentary_button_widget.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2021-2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
9#pragma once
10
12
13namespace hi { inline namespace v1 {
14
19public:
21 using delegate_type = typename super::delegate_type;
22
26 button_widget_attribute auto&&...attributes) noexcept :
28 {
29 alignment = alignment::middle_center();
30 set_attributes<0>(hi_forward(attributes)...);
31 }
32
33 momentary_button_widget(widget *parent, button_widget_attribute auto&&...attributes) noexcept :
34 momentary_button_widget(parent, std::make_shared<delegate_type>(), hi_forward(attributes)...)
35 {
36 }
37
39 [[nodiscard]] box_constraints update_constraints() noexcept override;
40 void set_layout(widget_layout const& context) noexcept override;
41 void draw(draw_context const& context) noexcept override;
43private:
44 box_constraints _label_constraints;
45
46 void draw_label_button(draw_context const& context) noexcept;
47};
48
49}} // namespace hi::v1
Defines abstract_button_widget.
#define hi_forward(x)
Forward a value, based on the decltype of the value.
Definition utility.hpp:29
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
Draw context for drawing using the HikoGUI shaders.
Definition draw_context.hpp:211
2D constraints.
Definition box_constraints.hpp:22
Base class for implementing button widgets.
Definition abstract_button_widget.hpp:32
std::shared_ptr< delegate_type > delegate
The delegate that controls the button widget.
Definition abstract_button_widget.hpp:39
observer< alignment > alignment
The alignment of the button and on/off/other label.
Definition abstract_button_widget.hpp:55
A button delegate controls the state of a button widget.
Definition button_delegate.hpp:45
A momentary button widget.
Definition momentary_button_widget.hpp:18
An interactive graphical object as part of the user-interface.
Definition widget.hpp:46
widget * parent
Pointer to the parent widget.
Definition widget.hpp:51
The layout of a widget.
Definition widget_layout.hpp:38
T move(T... args)