15namespace hi {
inline namespace v1 {
74 template<
typename WidgetType,
typename Key,
typename... Args>
77 hi_axiom(is_gui_thread());
79 auto tmp = std::make_unique<WidgetType>(
window,
this, std::forward<Args>(args)...);
82 hi_axiom(delegate !=
nullptr);
83 delegate->add_tab(*
this,
static_cast<std::size_t>(key), size(_children));
85 hi_request_reconstrain(
"tab_widget::make_widget({})", key);
90 [[nodiscard]] generator<widget *> children() const noexcept
override
92 for (
hilet& child : _children) {
97 widget_constraints
const& set_constraints() noexcept override;
98 void set_layout(widget_layout const&
layout) noexcept override;
99 void draw(draw_context const& context) noexcept override;
100 [[nodiscard]] hitbox hitbox_test(point3 position) const noexcept override;
101 [[nodiscard]]
widget const *find_next_widget(
102 widget const *current_widget,
103 keyboard_focus_group group,
104 keyboard_focus_direction direction) const noexcept override;
107 widget const *_previous_selected_child =
nullptr;
109 notifier<>::callback_token _delegate_cbt;
111 using const_iterator = decltype(_children)::const_iterator;
113 [[nodiscard]] const_iterator find_selected_child() const noexcept;
114 [[nodiscard]]
widget& selected_child() const noexcept;
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
#define hi_forward(x)
Forward a value, based on the decltype of the value.
Definition utility.hpp:29
Defines delegate_delegate and some default tab delegates.
std::shared_ptr< tab_delegate > make_default_tab_delegate(auto &&value) noexcept
Create a shared pointer to a default tab delegate.
Definition tab_delegate.hpp:102
DOXYGEN BUG.
Definition algorithm.hpp:15
The HikoGUI namespace.
Definition ascii.hpp:19
A delegate that controls the state of a tab_widget.
Definition tab_delegate.hpp:21
A graphical element that shows only one of a predefined set of mutually exclusive child widgets.
Definition tab_widget.hpp:36
tab_widget(gui_window &window, widget *parent, std::shared_ptr< delegate_type > delegate) noexcept
Construct a tab widget with a delegate.
WidgetType & make_widget(Key const &key, Args &&...args)
Make and add a child widget.
Definition tab_widget.hpp:75
tab_widget(gui_window &window, widget *parent, different_from< std::shared_ptr< delegate_type > > auto &&value) noexcept
Construct a tab widget with an observer value.
Definition tab_widget.hpp:60
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