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"
16#include "../text/font_book.hpp"
17#include "../GUI/gui_window_size.hpp"
18#include "../GUI/theme.hpp"
20#include "../chrono.hpp"
23namespace hi {
inline namespace v1 {
72 gui_window_size window_size_state = gui_window_size::normal;
74 hi::font_book *font_book =
nullptr;
76 hi::theme
const *theme =
nullptr;
117 [[nodiscard]] constexpr
bool empty() const noexcept
120 return theme ==
nullptr;
123 [[nodiscard]]
constexpr explicit operator bool() const noexcept
133 [[nodiscard]]
constexpr bool contains(point3 mouse_position)
const noexcept
135 return rectangle().contains(mouse_position) and
clipping_rectangle.contains(mouse_position);
138 [[nodiscard]]
constexpr aarectangle rectangle() const noexcept
140 return aarectangle{
size};
147 return bounding_rectangle(
to_window * rectangle());
167 [[nodiscard]]
constexpr float width() const noexcept
172 [[nodiscard]]
constexpr float height() const noexcept
174 return size.height();
195 gui_window_size window_size_state,
196 hi::font_book& font_book,
197 hi::theme
const& theme,
198 hi::subpixel_orientation subpixel_orientation,
207 window_size_state(window_size_state),
208 font_book(&font_book),
229 auto to_parent3 = translate3{child_rectangle, elevation};
230 auto from_parent3 = ~to_parent3;
237 r.
size = child_rectangle.size();
238 r.
clipping_rectangle = bounding_rectangle(from_parent3 * intersect(this->clipping_rectangle, new_clipping_rectangle));
239 if (new_baseline.empty()) {
240 r.
baseline = this->baseline - child_rectangle.bottom();
242 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:40
utc_nanoseconds display_time_point
The layout created for displaying at this time point.
Definition widget_layout.hpp:104
matrix3 to_parent
This matrix transforms local coordinates to the coordinates of the parent widget.
Definition widget_layout.hpp:50
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:254
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:227
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:265
constexpr aarectangle clipping_rectangle_on_window() const noexcept
Get the clipping rectangle in window coordinate system.
Definition widget_layout.hpp:152
aarectangle clipping_rectangle
The clipping rectangle.
Definition widget_layout.hpp:88
matrix3 from_window
This matrix transforms window coordinates to local coordinates.
Definition widget_layout.hpp:62
constexpr bool left_to_right() const noexcept
Check if the writing direction is left-to-right.
Definition widget_layout.hpp:179
constexpr bool contains(point3 mouse_position) const noexcept
Check if the mouse position is inside the widget.
Definition widget_layout.hpp:133
constexpr aarectangle clipping_rectangle_on_window(aarectangle narrow_clipping_rectangle) const noexcept
Get the clipping rectangle in window coordinate system.
Definition widget_layout.hpp:162
static constexpr float redraw_overhang
The amount of pixels that the redraw request will overhang the widget.
Definition widget_layout.hpp:46
float baseline
The base-line in widget local y-coordinate.
Definition widget_layout.hpp:108
constexpr bool right_to_left() const noexcept
Check if the writing direction is right_to_left.
Definition widget_layout.hpp:186
extent2 sub_pixel_size
The size of a sub-pixel.
Definition widget_layout.hpp:94
constexpr widget_layout override_clip(aarectangle new_clipping_rectangle) const noexcept
Override e context with the new clipping rectangle.
Definition widget_layout.hpp:275
extent2 window_size
Size of the window.
Definition widget_layout.hpp:70
extent2 size
Size of the widget.
Definition widget_layout.hpp:66
constexpr aarectangle rectangle_on_window() const noexcept
Get the rectangle in window coordinate system.
Definition widget_layout.hpp:145
matrix3 to_window
This matrix transforms local coordinates to window coordinates.
Definition widget_layout.hpp:58
constexpr widget_layout(extent2 window_size, gui_window_size window_size_state, hi::font_book &font_book, hi::theme const &theme, 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:193
matrix3 from_parent
This matrix transforms parent widget's coordinates to local coordinates.
Definition widget_layout.hpp:54
unicode_bidi_class writing_direction
The default writing direction.
Definition widget_layout.hpp:100