HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
hi::v1::widget_state Class Reference

#include <hikogui/GUI/widget_state.hpp>

Public Member Functions

constexpr widget_state (widget_state const &) noexcept=default
constexpr widget_state (widget_state &&) noexcept=default
constexpr widget_state & operator= (widget_state const &) noexcept=default
constexpr widget_state & operator= (widget_state &&) noexcept=default
constexpr widget_mode mode () const noexcept
 Get the mode of a widget.
constexpr widget_state & set_mode (widget_mode mode) noexcept
 Set the mode of a widget.
constexpr size_t layer () const noexcept
 Get the layer of a widget.
constexpr widget_state & set_layer (size_t layer) noexcept
 Set the layer of the widget.
constexpr widget_value value () const noexcept
 Get the value of the widget.
constexpr widget_state & set_value (widget_value value) noexcept
 Set the value of the widget.
constexpr widget_phase phase () const noexcept
 Get the phase of the widget.
constexpr bool pressed () const noexcept
constexpr widget_state & set_pressed (bool pressed) noexcept
 Set if the mouse/finger presses the widget.
constexpr bool hover () const noexcept
constexpr widget_state & set_hover (bool hover) noexcept
 Set if the mouse hovers over the widget.
constexpr bool active () const noexcept
constexpr widget_state & set_active (bool active) noexcept
 Set if the window is active widget.
constexpr bool focus () const noexcept
 Get if the window has keyboard focus.
constexpr widget_state & set_focus (bool focus) noexcept
 Set if the window has keyboard focus.
constexpr style_pseudo_class pseudo_class () const noexcept
template<std::integral T>
requires (sizeof(T) >= 2)
constexpr operator T () const noexcept
 Get the numeric value of the window state.
constexpr widget_state & operator++ () noexcept
 Increment the widget-state.

Static Public Member Functions

static constexpr widget_state begin () noexcept
 Start of the iteration of all possible widget states.
static constexpr widget_state end () noexcept
 End of the iteration of all possible widget states.
static constexpr size_t size () noexcept
 The number if possible widget states.

Friends

constexpr friend bool operator== (widget_state const &lhs, widget_state const &rhs) noexcept
constexpr friend bool need_reconstrain (widget_state const &lhs, widget_state const &rhs) noexcept
 Check if the change in widget-state requires the widget to reconstrain.
constexpr friend bool need_relayout (widget_state const &lhs, widget_state const &rhs) noexcept
 Check if the change in widget-state requires the widget to relayout.
constexpr friend bool need_redraw (widget_state const &lhs, widget_state const &rhs) noexcept
 Check if the change in widget-state requires the widget to redraw.

Detailed Description

The state the widget is in.

The numeric value of the state is used as an index into theme-values to select the appropriate visual style.

Member Function Documentation

◆ begin()

constexpr widget_state hi::v1::widget_state::begin ( )
inlinestaticconstexprnoexcept

Start of the iteration of all possible widget states.

◆ end()

constexpr widget_state hi::v1::widget_state::end ( )
inlinestaticconstexprnoexcept

End of the iteration of all possible widget states.

◆ focus()

bool hi::v1::widget_state::focus ( ) const
inlinenodiscardconstexprnoexcept

Get if the window has keyboard focus.

◆ layer()

size_t hi::v1::widget_state::layer ( ) const
inlinenodiscardconstexprnoexcept

Get the layer of a widget.

The layer between 0 and 3 is used to determine how to visual distinct widget at different nesting levels.

◆ mode()

widget_mode hi::v1::widget_state::mode ( ) const
inlinenodiscardconstexprnoexcept

Get the mode of a widget.

See also
widget_mode

◆ operator T()

template<std::integral T>
requires (sizeof(T) >= 2)
hi::v1::widget_state::operator T ( ) const
inlineexplicitconstexprnoexcept

Get the numeric value of the window state.

The numeric value is used for indexing into theme tables for quick lookup of, for example, the background color of the widget in a certain state.

◆ operator++()

widget_state & hi::v1::widget_state::operator++ ( )
inlineconstexprnoexcept

Increment the widget-state.

This is used to iterate over each unique widget_state, to fill in the theme tables.

◆ phase()

widget_phase hi::v1::widget_state::phase ( ) const
inlinenodiscardconstexprnoexcept

Get the phase of the widget.

See also
widget_phase

◆ set_active()

widget_state & hi::v1::widget_state::set_active ( bool active)
inlineconstexprnoexcept

Set if the window is active widget.

See also
widget_phase

◆ set_focus()

widget_state & hi::v1::widget_state::set_focus ( bool focus)
inlineconstexprnoexcept

Set if the window has keyboard focus.

◆ set_hover()

widget_state & hi::v1::widget_state::set_hover ( bool hover)
inlineconstexprnoexcept

Set if the mouse hovers over the widget.

See also
widget_phase

◆ set_layer()

widget_state & hi::v1::widget_state::set_layer ( size_t layer)
inlineconstexprnoexcept

Set the layer of the widget.

Parameters
layerThe layer is modulo 4.

◆ set_mode()

widget_state & hi::v1::widget_state::set_mode ( widget_mode mode)
inlineconstexprnoexcept

Set the mode of a widget.

See also
widget_mode

◆ set_pressed()

widget_state & hi::v1::widget_state::set_pressed ( bool pressed)
inlineconstexprnoexcept

Set if the mouse/finger presses the widget.

See also
widget_phase

◆ set_value()

widget_state & hi::v1::widget_state::set_value ( widget_value value)
inlineconstexprnoexcept

Set the value of the widget.

See also
widget_value

◆ size()

constexpr size_t hi::v1::widget_state::size ( )
inlinestaticconstexprnoexcept

The number if possible widget states.

◆ value()

widget_value hi::v1::widget_state::value ( ) const
inlinenodiscardconstexprnoexcept

Get the value of the widget.

See also
widget_value

◆ need_reconstrain

friend bool need_reconstrain ( widget_state const & lhs,
widget_state const & rhs )
friend

Check if the change in widget-state requires the widget to reconstrain.

◆ need_redraw

friend bool need_redraw ( widget_state const & lhs,
widget_state const & rhs )
friend

Check if the change in widget-state requires the widget to redraw.

◆ need_relayout

friend bool need_relayout ( widget_state const & lhs,
widget_state const & rhs )
friend

Check if the change in widget-state requires the widget to relayout.


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