8#include "../GFX/draw_context.hpp"
9#include "../GUI/theme_text_style.hpp"
10#include "../text/shaped_text.hpp"
11#include "../observable.hpp"
49 template<
typename Text,
typename Alignment = tt::alignment,
typename TextStyle = tt::theme_text_style>
54 Alignment &&
alignment = alignment::middle_center,
55 TextStyle &&
text_style = theme_text_style::label) noexcept :
58 this->text = std::forward<Text>(
text);
59 this->alignment = std::forward<Alignment>(
alignment);
60 this->text_style = std::forward<TextStyle>(
text_style);
64 void init() noexcept override;
65 [[nodiscard]]
bool constrain(utc_nanoseconds display_time_point,
bool need_reconstrain) noexcept override;
66 [[nodiscard]]
void layout(utc_nanoseconds displayTimePoint,
bool need_layout) noexcept override;
67 void draw(
draw_context context, utc_nanoseconds display_time_point) noexcept override;
70 decltype(
text)::callback_ptr_type _text_callback;
alignment
Vertical and horizontal alignment.
Definition alignment.hpp:47
Draw context for drawing using the TTauri shaders.
Definition draw_context.hpp:28
Definition gui_window.hpp:39
A value which can be observed for modifications.
Definition observable.hpp:464
shaped_text represent a piece of text shaped to be displayed.
Definition shaped_text.hpp:23
Definition text_style.hpp:17
A text widget.
Definition text_widget.hpp:25
text_widget(gui_window &window, widget *parent, Text &&text, Alignment &&alignment=alignment::middle_center, TextStyle &&text_style=theme_text_style::label) noexcept
Construct a text widget.
Definition text_widget.hpp:50
observable< l10n > text
The text to be displayed.
Definition text_widget.hpp:31
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