HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Static Public Attributes | Friends
hi::v1::widget_layout Class Reference

#include <hikogui/GUI/widget_layout.hpp>

Public Member Functions

constexpr widget_layout (widget_layout const &) noexcept=default
 
constexpr widget_layout (widget_layout &&) noexcept=default
 
constexpr widget_layoutoperator= (widget_layout const &) noexcept=default
 
constexpr widget_layoutoperator= (widget_layout &&) noexcept=default
 
constexpr bool empty () const noexcept
 
constexpr operator bool () const noexcept
 
constexpr translate3 to_window3 () const noexcept
 
constexpr bool contains (point3i mouse_position) const noexcept
 Check if the mouse position is inside the widget.
 
constexpr aarectanglei rectangle () const noexcept
 
constexpr aarectanglei rectangle_on_window () const noexcept
 Get the rectangle in window coordinate system.
 
constexpr aarectanglei clipping_rectangle_on_window () const noexcept
 Get the clipping rectangle in window coordinate system.
 
constexpr aarectanglei clipping_rectangle_on_window (aarectanglei narrow_clipping_rectangle) const noexcept
 Get the clipping rectangle in window coordinate system.
 
constexpr int width () const noexcept
 
constexpr int height () const noexcept
 
constexpr extent2i size () const noexcept
 
constexpr widget_layout (extent2i window_size, gui_window_size window_size_state, hi::subpixel_orientation subpixel_orientation, utc_nanoseconds display_time_point) noexcept
 Construct a widget_layout from inside the window.
 
constexpr widget_layout transform (box_shape const &child_shape, float child_elevation, aarectanglei new_clipping_rectangle) const noexcept
 Create a new widget_layout for the child widget.
 
constexpr widget_layout transform (box_shape const &child_shape, float child_elevation=1.0f) const noexcept
 Create a new widget_layout for the child widget.
 
constexpr widget_layout override_clip (aarectanglei new_clipping_rectangle) const noexcept
 Override e context with the new clipping rectangle.
 

Data Fields

box_shape shape
 Shape of the widget.
 
translate2i to_parent = {}
 This matrix transforms local coordinates to the coordinates of the parent widget.
 
translate2i from_parent = {}
 This matrix transforms parent widget's coordinates to local coordinates.
 
translate2i to_window = {}
 This matrix transforms local coordinates to window coordinates.
 
translate2i from_window = {}
 This matrix transforms window coordinates to local coordinates.
 
extent2i window_size = {}
 Size of the window.
 
float elevation = 0.0f
 The elevation of the widget above the window.
 
gui_window_size window_size_state = gui_window_size::normal
 
aarectanglei clipping_rectangle = {}
 The clipping rectangle.
 
extent2 sub_pixel_size = {1.0f, 1.0f}
 The size of a sub-pixel.
 
utc_nanoseconds display_time_point = {}
 The layout created for displaying at this time point.
 

Static Public Attributes

static constexpr int redraw_overhang = 2
 The amount of pixels that the redraw request will overhang the widget.
 

Friends

constexpr friend bool operator== (widget_layout const &, widget_layout const &) noexcept=default
 

Detailed Description

The layout of a widget.

This object is created by a container to position a child-widget within it.

The layout includes:

Constructor & Destructor Documentation

◆ widget_layout()

constexpr hi::v1::widget_layout::widget_layout ( extent2i window_size,
gui_window_size window_size_state,
hi::subpixel_orientation subpixel_orientation,
utc_nanoseconds display_time_point )
inlineconstexprnoexcept

Construct a widget_layout from inside the window.

Member Function Documentation

◆ clipping_rectangle_on_window() [1/2]

constexpr aarectanglei hi::v1::widget_layout::clipping_rectangle_on_window ( ) const
inlineconstexprnoexcept

Get the clipping rectangle in window coordinate system.

◆ clipping_rectangle_on_window() [2/2]

constexpr aarectanglei hi::v1::widget_layout::clipping_rectangle_on_window ( aarectanglei narrow_clipping_rectangle) const
inlineconstexprnoexcept

Get the clipping rectangle in window coordinate system.

Parameters
narrow_clipping_rectangleA clipping rectangle in local coordinate system that will be intersected with the layout's clipping rectangle.

◆ contains()

constexpr bool hi::v1::widget_layout::contains ( point3i mouse_position) const
inlineconstexprnoexcept

Check if the mouse position is inside the widget.

Parameters
mouse_positionThe mouse position in local coordinates.
Returns
True if the mouse position is on the widget and is not clipped.

◆ override_clip()

constexpr widget_layout hi::v1::widget_layout::override_clip ( aarectanglei new_clipping_rectangle) const
inlineconstexprnoexcept

Override e context with the new clipping rectangle.

Parameters
new_clipping_rectangleThe new clipping rectangle.
Returns
A new context that is clipped..

◆ rectangle_on_window()

constexpr aarectanglei hi::v1::widget_layout::rectangle_on_window ( ) const
inlineconstexprnoexcept

Get the rectangle in window coordinate system.

◆ transform() [1/2]

constexpr widget_layout hi::v1::widget_layout::transform ( box_shape const & child_shape,
float child_elevation,
aarectanglei new_clipping_rectangle ) const
inlineconstexprnoexcept

Create a new widget_layout for the child widget.

Parameters
child_shapeThe location and size of the child widget, relative to the current widget.
child_elevationThe elevation of the child widget, relative to the current widget.
new_clipping_rectangleThe new clipping rectangle of the child widget, relative to the current widget.
Returns
A new widget_layout for use by the child widget.

◆ transform() [2/2]

constexpr widget_layout hi::v1::widget_layout::transform ( box_shape const & child_shape,
float child_elevation = 1.0f ) const
inlineconstexprnoexcept

Create a new widget_layout for the child widget.

Parameters
child_shapeThe location and size of the child widget, relative to the current widget.
child_elevationThe elevation of the child widget, relative to the current widget.
Returns
A new widget_layout for use by the child widget.

Field Documentation

◆ clipping_rectangle

aarectanglei hi::v1::widget_layout::clipping_rectangle = {}

The clipping rectangle.

This is the rectangle that all drawing must be clipped to. This rectangle often includes the margin, as widget may draw in their own margin.

The clipping rectangle may be smaller than the widget, or even empty when the widget is scrolled outside of the aperture of a scroll widget.

Note
widget's coordinate system.

◆ display_time_point

utc_nanoseconds hi::v1::widget_layout::display_time_point = {}

The layout created for displaying at this time point.

◆ elevation

float hi::v1::widget_layout::elevation = 0.0f

The elevation of the widget above the window.

◆ from_parent

translate2i hi::v1::widget_layout::from_parent = {}

This matrix transforms parent widget's coordinates to local coordinates.

◆ from_window

translate2i hi::v1::widget_layout::from_window = {}

This matrix transforms window coordinates to local coordinates.

◆ redraw_overhang

constexpr int hi::v1::widget_layout::redraw_overhang = 2
staticconstexpr

The amount of pixels that the redraw request will overhang the widget.

Widgets are allowed to draw inside their margins, in most cases this will just be a border.

◆ shape

box_shape hi::v1::widget_layout::shape

Shape of the widget.

Since a widget_layout is always in local coordinates, the left and bottom values are zero.

◆ sub_pixel_size

extent2 hi::v1::widget_layout::sub_pixel_size = {1.0f, 1.0f}

The size of a sub-pixel.

Note
the sub-pixel-size is represented in the widget's coordinate system.

◆ to_parent

translate2i hi::v1::widget_layout::to_parent = {}

This matrix transforms local coordinates to the coordinates of the parent widget.

◆ to_window

translate2i hi::v1::widget_layout::to_window = {}

This matrix transforms local coordinates to window coordinates.

◆ window_size

extent2i hi::v1::widget_layout::window_size = {}

Size of the window.


The documentation for this class was generated from the following file: