18#include "../observer.hpp"
25namespace hi {
inline namespace v1 {
27template<
typename Context>
73 observer<alignment>
alignment = hi::alignment::top_right();
77 observer<semantic_text_style>
text_style = semantic_text_style::label;
124 different_from<std::shared_ptr<delegate_type>> Value,
125 forward_of<observer<std::vector<std::pair<observer_decay_t<Value>, label>>>> OptionList,
131 OptionList&& option_list,
132 Attributes&&...attributes)
noexcept requires requires
160 different_from<std::shared_ptr<delegate_type>> Value,
161 forward_of<observer<std::vector<std::pair<observer_decay_t<Value>, label>>>> OptionList,
162 forward_of<observer<observer_decay_t<Value>>> OffValue,
163 selection_widget_attribute... Attributes>
168 OptionList&& option_list,
169 OffValue&& off_value,
170 Attributes&&...attributes)
noexcept requires requires
183 [[nodiscard]] generator<widget *> children() const noexcept override;
186 void draw(draw_context const& context) noexcept override;
187 bool handle_event(
gui_event const& event) noexcept override;
188 [[nodiscard]] hitbox hitbox_test(point3 position) const noexcept override;
189 [[nodiscard]]
bool accepts_keyboard_focus(keyboard_focus_group group) const noexcept override;
190 [[nodiscard]] color focus_color() const noexcept override;
193 notifier<>::callback_token _delegate_cbt;
194 std::atomic<
bool> _notification_from_delegate = true;
199 aarectangle _option_rectangle;
200 aarectangle _left_box_rectangle;
202 glyph_ids _chevrons_glyph;
203 aarectangle _chevrons_rectangle;
205 bool _selecting = false;
206 bool _has_options = false;
208 aarectangle _overlay_rectangle;
213 decltype(
off_label)::callback_token _off_label_cbt;
215 std::vector<notifier<>::callback_token> _menu_button_tokens;
217 void set_attributes() noexcept {}
218 void set_attributes(label_widget_attribute
auto&& first, label_widget_attribute
auto&&...rest)
noexcept
220 if constexpr (forward_of<
decltype(first), observer<hi::label>>) {
222 }
else if constexpr (forward_of<
decltype(first), observer<hi::alignment>>) {
224 }
else if constexpr (forward_of<
decltype(first), observer<hi::semantic_text_style>>) {
227 hi_static_no_default();
233 [[nodiscard]] menu_button_widget
const *get_first_menu_button() const noexcept;
234 [[nodiscard]] menu_button_widget const *get_selected_menu_button() const noexcept;
235 void start_selecting() noexcept;
236 void stop_selecting() noexcept;
237 void repopulate_options() noexcept;
238 void draw_outline(draw_context const& context) noexcept;
239 void draw_left_box(draw_context const& context) noexcept;
240 void draw_chevrons(draw_context const& context) noexcept;
#define hi_forward(x)
Forward a value, based on the decltype of the value.
Definition utility.hpp:29
Defines delegate_delegate and some default selection delegates.
Defines row_column_widget.
Defines menu_button_widget.
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:15
The HikoGUI namespace.
Definition ascii.hpp:19
A user interface event.
Definition gui_event.hpp:66
The GUI widget displays and lays out text together with an icon.
Definition label_widget.hpp:41
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:39
The scroll widget allows a content widget to be shown in less space than is required.
Definition scroll_widget.hpp:48
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(gui_window &window, 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:99
selection_widget(gui_window &window, 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:127
selection_widget(gui_window &window, widget *parent, std::shared_ptr< delegate_type > delegate) noexcept
Construct a selection widget with a delegate.
selection_widget(gui_window &window, 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:164
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
An interactive graphical object as part of the user-interface.
Definition widget.hpp:44
widget_layout const & layout() const noexcept
Get the current layout for this widget.
Definition widget.hpp:198
widget *const parent
Pointer to the parent widget.
Definition widget.hpp:53
widget(gui_window &window, widget *parent) noexcept
gui_window & window
Convenient reference to the Window.
Definition widget.hpp:48
The constraints of a widget.
Definition widget_constraints.hpp:26
The layout of a widget.
Definition widget_layout.hpp:37
Definition label_widget.hpp:25
Definition selection_widget.hpp:28