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;
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 *> children() 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(point3 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;
190 aarectangle _option_rectangle;
191 aarectangle _left_box_rectangle;
193 glyph_ids _chevrons_glyph;
194 aarectangle _chevrons_rectangle;
196 bool _selecting = false;
197 bool _has_options = false;
199 aarectangle _overlay_rectangle;
204 decltype(
off_label)::callback_token _off_label_cbt;
206 std::vector<notifier<>::callback_token> _menu_button_tokens;
208 void set_attributes() noexcept {}
209 void set_attributes(label_widget_attribute
auto&& first, label_widget_attribute
auto&&...rest)
noexcept
211 if constexpr (forward_of<
decltype(first), observer<hi::label>>) {
213 }
else if constexpr (forward_of<
decltype(first), observer<hi::alignment>>) {
215 }
else if constexpr (forward_of<
decltype(first), observer<hi::semantic_text_style>>) {
224 [[nodiscard]] menu_button_widget
const *get_first_menu_button() const noexcept;
225 [[nodiscard]] menu_button_widget const *get_selected_menu_button() const noexcept;
226 void start_selecting() noexcept;
227 void stop_selecting() noexcept;
228 void repopulate_options() noexcept;
229 void draw_outline(draw_context const& context) noexcept;
230 void draw_left_box(draw_context const& context) noexcept;
231 void draw_chevrons(draw_context const& context) noexcept;
#define hi_static_no_default()
This part of the code should not be reachable, unless a programming bug.
Definition assert.hpp:172
#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:76
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:45
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
Definition set_constraints_context.hpp:15
An interactive graphical object as part of the user-interface.
Definition widget.hpp:45
widget(widget *parent) noexcept
widget * parent
Pointer to the parent widget.
Definition widget.hpp:50
The constraints of a widget.
Definition widget_constraints.hpp:26
The layout of a widget.
Definition widget_layout.hpp:40
Definition label_widget.hpp:25
Definition selection_widget.hpp:28