18#include "../observer.hpp"
25namespace hi {
inline namespace v1 {
27template<
typename Context>
73 observer<alignment>
alignment = hi::alignment::middle_flush();
77 observer<semantic_text_style>
text_style = semantic_text_style::label;
120 different_from<std::shared_ptr<delegate_type>> Value,
121 forward_of<observer<std::vector<std::pair<observer_decay_t<Value>, label>>>> OptionList,
126 OptionList&& option_list,
127 Attributes&&...attributes)
noexcept requires requires
153 different_from<std::shared_ptr<delegate_type>> Value,
154 forward_of<observer<std::vector<std::pair<observer_decay_t<Value>, label>>>> OptionList,
155 forward_of<observer<observer_decay_t<Value>>> OffValue,
156 selection_widget_attribute... Attributes>
160 OptionList&& option_list,
161 OffValue&& off_value,
162 Attributes&&...attributes)
noexcept requires requires
174 [[nodiscard]] generator<widget const &> children(
bool include_invisible)
const noexcept override;
176 void set_layout(
widget_layout const& context) noexcept override;
177 void draw(
draw_context const& context) noexcept override;
178 bool handle_event(
gui_event const& event) noexcept override;
179 [[nodiscard]] hitbox hitbox_test(point2i position) const noexcept override;
180 [[nodiscard]]
bool accepts_keyboard_focus(keyboard_focus_group group) const noexcept override;
181 [[nodiscard]]
color focus_color() const noexcept override;
184 notifier<>::callback_token _delegate_cbt;
185 std::atomic<
bool> _notification_from_delegate = true;
195 aarectanglei _left_box_rectangle;
197 glyph_ids _chevrons_glyph;
198 aarectanglei _chevrons_rectangle;
200 bool _selecting = false;
201 bool _has_options = false;
210 decltype(
off_label)::callback_token _off_label_cbt;
212 std::vector<notifier<>::callback_token> _menu_button_tokens;
214 void set_attributes() noexcept {}
215 void set_attributes(label_widget_attribute
auto&& first, label_widget_attribute
auto&&...rest)
noexcept
217 if constexpr (forward_of<
decltype(first), observer<hi::label>>) {
219 }
else if constexpr (forward_of<
decltype(first), observer<hi::alignment>>) {
221 }
else if constexpr (forward_of<
decltype(first), observer<hi::semantic_text_style>>) {
230 [[nodiscard]] menu_button_widget
const *get_first_menu_button() const noexcept;
231 [[nodiscard]] menu_button_widget const *get_selected_menu_button() const noexcept;
232 void start_selecting() noexcept;
233 void stop_selecting() noexcept;
234 void repopulate_options() noexcept;
235 void draw_outline(draw_context const& context) noexcept;
236 void draw_left_box(draw_context const& context) noexcept;
237 void draw_chevrons(draw_context const& context) noexcept;
Defines delegate_delegate and some default selection delegates.
Defines row_column_widget.
Defines menu_button_widget.
#define hi_static_no_default(...)
This part of the code should not be reachable, unless a programming bug.
Definition assert.hpp:308
#define hi_forward(x)
Forward a value, based on the decltype of the value.
Definition utility.hpp:29
std::shared_ptr< selection_delegate > make_default_selection_delegate(auto &&value, auto &&options, auto &&...off_value) noexcept
Create a shared pointer to a default selection delegate.
Definition selection_delegate.hpp:153
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
This is a RGBA floating point color.
Definition color.hpp:42
Draw context for drawing using the HikoGUI shaders.
Definition draw_context.hpp:211
A user interface event.
Definition gui_event.hpp:74
2D constraints.
Definition box_constraints.hpp:22
Definition box_shape.hpp:15
The GUI widget displays and lays out text together with an icon.
Definition label_widget.hpp:42
A button that is part of a menu.
Definition menu_button_widget.hpp:30
A GUI widget which may exist anywhere on a window overlaid above any other widget.
Definition overlay_widget.hpp:38
A row/column widget lays out child widgets along a row or column.
Definition row_column_widget.hpp:40
The scroll widget allows a content widget to be shown in less space than is required.
Definition scroll_widget.hpp:46
A delegate that controls the state of a selection_widget.
Definition selection_delegate.hpp:23
A graphical control element that allows the user to choose only one of a predefined set of mutually e...
Definition selection_widget.hpp:44
selection_widget(widget *parent, Value &&value, OptionList &&option_list, OffValue &&off_value, Attributes &&...attributes) noexcept
Construct a selection widget which will monitor an option list and a value.
Definition selection_widget.hpp:157
selection_widget(widget *parent, std::shared_ptr< delegate_type > delegate, selection_widget_attribute auto &&first_attribute, selection_widget_attribute auto &&...attributes) noexcept
Construct a selection widget with a delegate.
Definition selection_widget.hpp:97
selection_widget(widget *parent, std::shared_ptr< delegate_type > delegate) noexcept
Construct a selection widget with a delegate.
observer< label > off_label
The label to show when nothing is selected.
Definition selection_widget.hpp:53
observer< semantic_text_style > text_style
The text style to display the label's text in and color of the label's (non-color) icon.
Definition selection_widget.hpp:77
observer< alignment > alignment
How the label and icon are aligned.
Definition selection_widget.hpp:73
selection_widget(widget *parent, Value &&value, OptionList &&option_list, Attributes &&...attributes) noexcept
Construct a selection widget which will monitor an option list and a value.
Definition selection_widget.hpp:123
An interactive graphical object as part of the user-interface.
Definition widget.hpp:46
widget(widget *parent) noexcept
widget * parent
Pointer to the parent widget.
Definition widget.hpp:51
The layout of a widget.
Definition widget_layout.hpp:38
Definition label_widget.hpp:26
Definition selection_widget.hpp:28