HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends
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_stateoperator= (widget_state const &) noexcept=default
 
constexpr widget_stateoperator= (widget_state &&) noexcept=default
 
constexpr widget_mode mode () const noexcept
 Get the mode of a widget.
 
constexpr widget_stateset_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_stateset_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_stateset_value (widget_value value) noexcept
 Set the value of the widget.
 
constexpr widget_phase phase () const noexcept
 Get the phase of the widget.
 
constexpr widget_stateset_pressed (bool pressed) noexcept
 Set if the mouse/finger presses the widget.
 
constexpr widget_stateset_hover (bool hover) noexcept
 Set if the mouse hovers over the widget.
 
constexpr widget_stateset_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_stateset_focus (bool focus) noexcept
 Set if the window has keyboard focus.
 
template<std::integral T>
requires (sizeof(T) >= 2)
constexpr operator T () const noexcept
 Get the numeric value of the window state.
 
constexpr widget_stateoperator++ () 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()

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

Start of the iteration of all possible widget states.

◆ end()

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

End of the iteration of all possible widget states.

◆ focus()

constexpr bool hi::v1::widget_state::focus ( ) const
inlineconstexprnoexcept

Get if the window has keyboard focus.

◆ layer()

constexpr size_t hi::v1::widget_state::layer ( ) const
inlineconstexprnoexcept

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()

constexpr widget_mode hi::v1::widget_state::mode ( ) const
inlineconstexprnoexcept

Get the mode of a widget.

See also
widget_mode

◆ operator T()

template<std::integral T>
requires (sizeof(T) >= 2)
constexpr 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++()

constexpr 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()

constexpr widget_phase hi::v1::widget_state::phase ( ) const
inlineconstexprnoexcept

Get the phase of the widget.

See also
widget_phase

◆ set_active()

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

Set if the window is active widget.

See also
widget_phase

◆ set_focus()

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

Set if the window has keyboard focus.

◆ set_hover()

constexpr 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()

constexpr 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()

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

Set the mode of a widget.

See also
widget_mode

◆ set_pressed()

constexpr 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()

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

Set the value of the widget.

See also
widget_value

◆ size()

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

The number if possible widget states.

◆ value()

constexpr widget_value hi::v1::widget_state::value ( ) const
inlineconstexprnoexcept

Get the value of the widget.

See also
widget_value

Friends And Related Symbol Documentation

◆ need_reconstrain

constexpr 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

constexpr 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

constexpr 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: