11#include "../geometry/matrix.hpp"
12#include "../geometry/axis_aligned_rectangle.hpp"
13#include "../geometry/transform.hpp"
14#include "../geometry/translate.hpp"
15#include "../unicode/unicode_bidi_class.hpp"
17#include "../chrono.hpp"
20namespace hi {
inline namespace v1 {
105 hi_axiom((lhs.to_parent == rhs.to_parent) == (lhs.from_parent == rhs.from_parent));
106 hi_axiom((lhs.to_window == rhs.to_window) == (lhs.from_window == rhs.from_window));
109 return lhs.size == rhs.size and lhs.to_parent == rhs.to_parent and lhs.to_window == rhs.to_window and
110 lhs.clipping_rectangle == rhs.clipping_rectangle and lhs.sub_pixel_size == rhs.sub_pixel_size and
111 lhs.writing_direction == rhs.writing_direction and lhs.baseline == rhs.baseline;
120 [[nodiscard]]
constexpr bool contains(point3 mouse_position)
const noexcept
122 return rectangle().contains(mouse_position) and
clipping_rectangle.contains(mouse_position);
125 [[nodiscard]]
constexpr aarectangle rectangle() const noexcept
127 return aarectangle{
size};
147 [[nodiscard]]
constexpr float width() const noexcept
152 [[nodiscard]]
constexpr float height() const noexcept
154 return size.height();
161 hi::subpixel_orientation subpixel_orientation,
188 auto to_parent3 = translate3{child_rectangle, elevation};
189 auto from_parent3 = ~to_parent3;
196 r.
size = child_rectangle.size();
197 r.
clipping_rectangle = bounding_rectangle(from_parent3 * intersect(this->clipping_rectangle, new_clipping_rectangle));
201 if (new_baseline.empty()) {
202 r.
baseline = this->baseline - child_rectangle.bottom();
204 r.
baseline = new_baseline.absolute(child_rectangle.height());
DOXYGEN BUG.
Definition algorithm.hpp:15
The HikoGUI namespace.
Definition ascii.hpp:19
The base-line of a widget on which to set the text and graphics.
Definition widget_baseline.hpp:19
The layout of a widget.
Definition widget_layout.hpp:37
utc_nanoseconds display_time_point
The layout created for displaying at this time point.
Definition widget_layout.hpp:91
matrix3 to_parent
This matrix transforms local coordinates to the coordinates of the parent widget.
Definition widget_layout.hpp:47
constexpr widget_layout transform(aarectangle const &child_rectangle, float elevation=1.0f, widget_baseline new_baseline=widget_baseline{}) const noexcept
Create a new widget_layout for the child widget.
Definition widget_layout.hpp:216
constexpr widget_layout transform(aarectangle const &child_rectangle, float elevation, aarectangle new_clipping_rectangle, widget_baseline new_baseline=widget_baseline{}) const noexcept
Create a new widget_layout for the child widget.
Definition widget_layout.hpp:186
constexpr widget_layout transform(aarectangle const &child_rectangle, widget_baseline new_baseline) const noexcept
Create a new widget_layout for the child widget.
Definition widget_layout.hpp:227
aarectangle clipping_rectangle
The clipping rectangle.
Definition widget_layout.hpp:75
matrix3 from_window
This matrix transforms window coordinates to local coordinates.
Definition widget_layout.hpp:59
constexpr bool contains(point3 mouse_position) const noexcept
Check if the mouse position is inside the widget.
Definition widget_layout.hpp:120
static constexpr float redraw_overhang
The amount of pixels that the redraw request will overhang the widget.
Definition widget_layout.hpp:43
constexpr aarectangle window_clipping_rectangle() const noexcept
Get the clipping rectangle in window coordinate system.
Definition widget_layout.hpp:132
float baseline
The base-line in widget local y-coordinate.
Definition widget_layout.hpp:95
extent2 sub_pixel_size
The size of a sub-pixel.
Definition widget_layout.hpp:81
constexpr widget_layout(extent2 window_size, hi::subpixel_orientation subpixel_orientation, unicode_bidi_class writing_direction, utc_nanoseconds display_time_point) noexcept
Construct a widget_layout from inside the window.
Definition widget_layout.hpp:159
constexpr widget_layout override_clip(aarectangle new_clipping_rectangle) const noexcept
Override e context with the new clipping rectangle.
Definition widget_layout.hpp:237
extent2 size
Size of the widget.
Definition widget_layout.hpp:63
matrix3 to_window
This matrix transforms local coordinates to window coordinates.
Definition widget_layout.hpp:55
matrix3 from_parent
This matrix transforms parent widget's coordinates to local coordinates.
Definition widget_layout.hpp:51
constexpr aarectangle window_clipping_rectangle(aarectangle narrow_clipping_rectangle) const noexcept
Get the clipping rectangle in window coordinate system.
Definition widget_layout.hpp:142
unicode_bidi_class writing_direction
The default writing direction.
Definition widget_layout.hpp:87