8#include "grid_layout_widget.hpp"
22 ttlet lock = std::scoped_lock(gui_system_mutex);
36 if (has_updated_contraints) {
38 _preferred_size = _content->preferred_size();
41 return has_updated_contraints;
48 need_layout |= std::exchange(_request_relayout,
false);
61 if (overlaps(context, _clipping_rectangle)) {
62 draw_background(context);
76 if (
auto parent = _parent.lock()) {
77 ttlet requested_window_rectangle =
aarectangle{
parent->local_to_window() * requested_rectangle};
79 ttlet response_window_rectangle = fit(window_bounds, requested_window_rectangle);
89 ttlet lock = std::scoped_lock(gui_system_mutex);
91 auto widget = super::make_widget<WidgetType>(std::forward<Args>(args)...);
97 [[nodiscard]] color background_color() const noexcept
override
99 return theme::global->fillColor(_semantic_layer + 1);
102 [[nodiscard]] color foreground_color() const noexcept
override
104 return theme::global->borderColor(_semantic_layer + 1);
110 void draw_background(draw_context context)
noexcept
112 context.draw_box_with_border_inside(
rectangle(), background_color(), foreground_color());
Class which represents an axis-aligned rectangle.
Definition axis_aligned_rectangle.hpp:18
constexpr float & width() noexcept
Access the x-as-width element from the extent.
Definition extent.hpp:91
constexpr float & height() noexcept
Access the y-as-height element from the extent.
Definition extent.hpp:102
Draw context for drawing using the TTauri shaders.
Definition draw_context.hpp:33
Definition gui_window.hpp:37
extent2 extent
The current window extent as set by the GPU library.
Definition gui_window.hpp:76
int recurse_lock_count() const noexcept
This function should be used in tt_axiom() to check if the lock is held by current thread.
Definition unfair_recursive_mutex.hpp:60
Definition abstract_container_widget.hpp:11
void update_layout(hires_utc_clock::time_point display_time_point, bool need_layout) noexcept
Update the internal layout of the widget.
Definition abstract_container_widget.hpp:110
void draw(draw_context context, hires_utc_clock::time_point display_time_point) noexcept
Draw the widget.
Definition abstract_container_widget.hpp:124
bool update_constraints(hires_utc_clock::time_point display_time_point, bool need_reconstrain) noexcept
Update the constraints of the widget.
Definition abstract_container_widget.hpp:95
Definition grid_layout_widget.hpp:16
Definition overlay_view_widget.hpp:12
aarectangle make_overlay_rectangle_from_parent(aarectangle requested_rectangle) const noexcept
Make an overlay rectangle.
Definition overlay_view_widget.hpp:72
void update_layout(hires_utc_clock::time_point display_time_point, bool need_layout) noexcept override
Update the internal layout of the widget.
Definition overlay_view_widget.hpp:44
bool update_constraints(hires_utc_clock::time_point display_time_point, bool need_reconstrain) noexcept override
Update the constraints of the widget.
Definition overlay_view_widget.hpp:30
void draw(draw_context context, hires_utc_clock::time_point display_time_point) noexcept override
Draw the widget.
Definition overlay_view_widget.hpp:57
float draw_layer() const noexcept
The first drawing layer of the widget.
Definition widget.hpp:149
widget(gui_window &window, std::shared_ptr< abstract_container_widget > parent) noexcept
aarectangle rectangle() const noexcept
Get the rectangle in local coordinates.
Definition widget.hpp:342
gui_window & window
Convenient reference to the Window.
Definition widget.hpp:101
abstract_container_widget const & parent() const noexcept
Get a reference to the parent.