15namespace hi {
inline namespace v1 {
72 template<
typename WidgetType,
typename Key,
typename... Args>
77 auto tmp = std::make_unique<WidgetType>(
this, std::forward<Args>(args)...);
81 delegate->add_tab(*
this,
static_cast<std::size_t>(key), size(_children));
83 ++global_counter<
"tab_widget:make_widget:constrain">;
89 [[nodiscard]] generator<widget const &> children(
bool include_invisible)
const noexcept override
91 for (
hilet& child : _children) {
96 [[nodiscard]] box_constraints update_constraints() noexcept override;
97 void set_layout(widget_layout const& context) noexcept override;
98 void draw(draw_context const& context) noexcept override;
99 [[nodiscard]] hitbox hitbox_test(point2i position) const noexcept override;
100 [[nodiscard]] widget_id find_next_widget(
101 widget_id current_widget,
102 keyboard_focus_group group,
103 keyboard_focus_direction direction) const noexcept override;
106 widget const *_previous_selected_child =
nullptr;
108 notifier<>::callback_token _delegate_cbt;
110 using const_iterator = decltype(_children)::const_iterator;
112 [[nodiscard]] const_iterator find_selected_child() const noexcept;
113 [[nodiscard]]
widget& selected_child() const noexcept;
Defines delegate_delegate and some default tab delegates.
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:238
#define hi_assert_not_null(x,...)
Assert if an expression is not nullptr.
Definition assert.hpp:223
#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
@ window_reconstrain
Request that widget get constraint on the next frame.
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:13
geometry/margins.hpp
Definition cache.hpp:11
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(widget *parent, different_from< std::shared_ptr< delegate_type > > auto &&value) noexcept
Construct a tab widget with an observer value.
Definition tab_widget.hpp:58
WidgetType & make_widget(Key const &key, Args &&...args)
Make and add a child widget.
Definition tab_widget.hpp:73
tab_widget(widget *parent, std::shared_ptr< delegate_type > delegate) noexcept
Construct a tab widget with a delegate.
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