8#include "grid_widget.hpp"
9#include "tab_delegate.hpp"
10#include "default_tab_delegate.hpp"
52 template<
typename Value>
54 requires(not std::is_convertible_v<Value, weak_or_unique_ptr<delegate_type>>) :
67 template<
typename WidgetType,
typename Key,
typename... Args>
68 WidgetType &
make_widget(Key
const &key, Args &&...args)
noexcept
70 tt_axiom(is_gui_thread());
72 if (
auto delegate = _delegate.lock()) {
73 delegate->add_tab(*
this,
static_cast<size_t>(key), std::size(_children));
75 auto &
widget = super::make_widget<WidgetType>(std::forward<Args>(args)...);
80 void init() noexcept override;
81 void deinit() noexcept override;
82 [[nodiscard]]
float margin() const noexcept override;
83 [[nodiscard]]
bool constrain(utc_nanoseconds display_time_point,
bool need_reconstrain) noexcept override;
84 [[nodiscard]]
void layout(utc_nanoseconds display_time_point,
bool need_layout) noexcept override;
85 [[nodiscard]]
widget const *find_next_widget(
86 widget const *current_widget,
87 keyboard_focus_group group,
88 keyboard_focus_direction direction) const noexcept override;
92 typename delegate_type::callback_ptr_type _delegate_callback;
95 [[nodiscard]] auto find_selected_child() const noexcept;
96 [[nodiscard]] auto find_selected_child() noexcept;
97 [[nodiscard]]
widget const &selected_child() const noexcept;
98 void draw_child(
draw_context context, utc_nanoseconds displayTimePoint,
widget &child) noexcept;
Draw context for drawing using the TTauri shaders.
Definition draw_context.hpp:28
Definition gui_window.hpp:39
Class that hold either a weak_ptr or a unique_ptr This class is to hold a weak_ptr,...
Definition weak_or_unique_ptr.hpp:25
Definition tab_delegate.hpp:13
A graphical element that shows only one of a predefined set of mutually exclusive child widgets.
Definition tab_widget.hpp:32
WidgetType & make_widget(Key const &key, Args &&...args) noexcept
Make and add a child widget.
Definition tab_widget.hpp:68
tab_widget(gui_window &window, widget *parent, Value &&value) noexcept
Construct a tab widget with an observable value.
Definition tab_widget.hpp:53
tab_widget(gui_window &window, widget *parent, std::weak_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:37
widget *const parent
Pointer to the parent widget.
Definition widget.hpp:46
gui_window & window
Convenient reference to the Window.
Definition widget.hpp:41
widget(gui_window &window, widget *parent) noexcept