8#include "../GFX/draw_context.hpp"
9#include "../GFX/pipeline_image_image.hpp"
10#include "../GUI/theme_color.hpp"
42 template<
typename Icon,
typename Color = tt::theme_color>
48 this->icon = std::forward<Icon>(
icon);
49 this->color = std::forward<Color>(
color);
53 void init() noexcept override;
54 [[nodiscard]]
bool constrain(utc_nanoseconds display_time_point,
bool need_reconstrain) noexcept override;
55 [[nodiscard]]
void layout(utc_nanoseconds displayTimePoint,
bool need_layout) noexcept override;
56 void draw(
draw_context context, utc_nanoseconds display_time_point) noexcept override;
59 enum class icon_type { no, glyph, pixmap };
61 decltype(
icon)::callback_ptr_type _icon_callback;
64 font_glyph_ids _glyph;
66 pipeline_image::image _pixmap_backing;
68 aarectangle _icon_bounding_box;
69 matrix2 _icon_transform;
alignment
Vertical and horizontal alignment.
Definition alignment.hpp:47
This is a RGBA floating point color.
Definition color.hpp:36
Draw context for drawing using the TTauri shaders.
Definition draw_context.hpp:28
Definition gui_window.hpp:39
An image, in different formats.
Definition icon.hpp:19
A value which can be observed for modifications.
Definition observable.hpp:464
An simple GUI widget that displays an icon.
Definition icon_widget.hpp:26
observable< icon > icon
The icon to be displayed.
Definition icon_widget.hpp:32
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