54 template<
typename Value>
56 requires(not std::is_convertible_v<Value, weak_or_unique_ptr<delegate_type>>) :
57 tab_widget(window, parent, make_unique_default_tab_delegate(
std::forward<Value>(value)))
69 template<
typename WidgetType,
typename Key,
typename... Args>
72 hi_axiom(is_gui_thread());
74 auto tmp = std::make_unique<WidgetType>(window,
this, std::forward<Args>(args)...);
76 if (
auto delegate = _delegate.lock()) {
77 delegate->add_tab(*
this,
static_cast<std::size_t>(key), size(_children));
80 request_reconstrain();
87 for (
hilet &child : _children) {
92 widget_constraints
const &set_constraints() noexcept override;
93 void set_layout(widget_layout const &layout) noexcept override;
94 void draw(draw_context const &context) noexcept override;
95 [[nodiscard]] hitbox hitbox_test(point3 position) const noexcept override;
96 [[nodiscard]] widget const *find_next_widget(
97 widget const *current_widget,
98 keyboard_focus_group group,
99 keyboard_focus_direction direction) const noexcept override;
102 widget const *_previous_selected_child =
nullptr;
103 std::vector<
std::unique_ptr<widget>> _children;
104 weak_or_unique_ptr<delegate_type> _delegate;
105 notifier<>::token_type _delegate_cbt;
107 using const_iterator = decltype(_children)::const_iterator;
109 tab_widget(gui_window &window, widget *parent, weak_or_unique_ptr<delegate_type> delegate) noexcept;
110 [[nodiscard]] const_iterator find_selected_child() const noexcept;
111 [[nodiscard]] widget &selected_child() const noexcept;
WidgetType & make_widget(Key const &key, Args &&...args)
Make and add a child widget.
Definition tab_widget.hpp:70
tab_widget(gui_window &window, widget *parent, std::weak_ptr< delegate_type > delegate) noexcept
Construct a tab widget with a delegate.
tab_widget(gui_window &window, widget *parent, Value &&value) noexcept
Construct a tab widget with an observable value.
Definition tab_widget.hpp:55