CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::UIControl::State Struct Reference

Constants describing the state of a control. More...

#include <CeresEngine/UI/UIControl.hpp>

Public Member Functions

constexpr State ()=default
 Creates a new default state object.
 
constexpr State (const UInt32 raw)
 Initialize the State object with a raw representation of the state.
 
constexpr State operator+ (const State &other) const noexcept
 
constexpr Stateoperator+= (const State &other) noexcept
 
constexpr State operator- (const State &other) const noexcept
 
constexpr Stateoperator-= (const State &other) noexcept
 
constexpr bool contains (const State &member) const noexcept
 Returns a Boolean value that indicates whether a given element is a member of the option set.
 
constexpr bool operator[] (const State &other) const noexcept
 Returns a Boolean value that indicates whether a given element is a member of the option set.
 
constexpr bool operator== (const State &other) const noexcept
 Compares two states if they are the same.
 
constexpr bool operator!= (const State &other) const noexcept
 Compares two states if they are not the same.
 
UIColor operator() (const UIColor &baseColor) const noexcept
 Applies a color transformation to the given baseColor such as that the returned color represents the current state.
 

Public Attributes

UInt32 raw = 0
 The raw numeric value of the represented state.
 

Static Public Attributes

static const State Normal
 The normal, or default state of a control—that is, enabled but neither selected nor highlighted.
 
static const State Highlighted
 Highlighted state of a control.
 
static const State Disabled
 Disabled state of a control.
 
static const State Selected
 Selected state of a control.
 
static const State Focused
 Focused state of a control.
 

Detailed Description

Constants describing the state of a control.

A control can have more than one state at a time. Controls can be configured differently based on their state. For example, a UIButton object can be configured to display one texture when it is in its normal state and a different texture when it is highlighted.

Constructor & Destructor Documentation

◆ State() [1/2]

constexpr CeresEngine::UIControl::State::State ( )
constexprdefault

Creates a new default state object.

◆ State() [2/2]

constexpr CeresEngine::UIControl::State::State ( const UInt32  raw)
inlineexplicitconstexpr

Initialize the State object with a raw representation of the state.

Member Function Documentation

◆ contains()

constexpr bool CeresEngine::UIControl::State::contains ( const State member) const
inlineconstexprnoexcept

Returns a Boolean value that indicates whether a given element is a member of the option set.

This example uses the contains() method to check whether the Focused state is set in the currentState instance:

// We are focused!
}
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Constants describing the state of a control.
Definition UIControl.hpp:38
static const State Focused
Focused state of a control.
Definition UIControl.hpp:126
Parameters
memberThe element to look for in the option set.
Returns
true if the option set contains member; otherwise, false.

◆ operator!=()

constexpr bool CeresEngine::UIControl::State::operator!= ( const State other) const
inlineconstexprnoexcept

Compares two states if they are not the same.

◆ operator()()

UIColor CeresEngine::UIControl::State::operator() ( const UIColor baseColor) const
noexcept

Applies a color transformation to the given baseColor such as that the returned color represents the current state.

◆ operator+()

constexpr State CeresEngine::UIControl::State::operator+ ( const State other) const
inlineconstexprnoexcept

◆ operator+=()

constexpr State & CeresEngine::UIControl::State::operator+= ( const State other)
inlineconstexprnoexcept

◆ operator-()

constexpr State CeresEngine::UIControl::State::operator- ( const State other) const
inlineconstexprnoexcept

◆ operator-=()

constexpr State & CeresEngine::UIControl::State::operator-= ( const State other)
inlineconstexprnoexcept

◆ operator==()

constexpr bool CeresEngine::UIControl::State::operator== ( const State other) const
inlineconstexprnoexcept

Compares two states if they are the same.

◆ operator[]()

constexpr bool CeresEngine::UIControl::State::operator[] ( const State other) const
inlineconstexprnoexcept

Returns a Boolean value that indicates whether a given element is a member of the option set.

This example uses the contains() method to check whether the Focused state is set in the currentState instance:

// We are focused!
}
Parameters
memberThe element to look for in the option set.
Returns
true if the option set contains member; otherwise, false.

Member Data Documentation

◆ Disabled

const State CeresEngine::UIControl::State::Disabled
static

Disabled state of a control.

Set the value of this property to true to disable the control or false to enable it. An enabled control is capable of responding to user interactions, whereas a disabled control ignores input events and may draw itself differently.

◆ Focused

const State CeresEngine::UIControl::State::Focused
static

Focused state of a control.

◆ Highlighted

const State CeresEngine::UIControl::State::Highlighted
static

Highlighted state of a control.

When the value of this property is true, the control draws a highlight; otherwise, the control does not draw a highlight. Controls automatically set and clear this state in response to appropriate input events. You can change the value of this property as needed to apply or remove a highlight programmatically.

◆ Normal

const State CeresEngine::UIControl::State::Normal
static

The normal, or default state of a control—that is, enabled but neither selected nor highlighted.

◆ raw

UInt32 CeresEngine::UIControl::State::raw = 0

The raw numeric value of the represented state.

◆ Selected

const State CeresEngine::UIControl::State::Selected
static

Selected state of a control.

Set the value of this property to true to select it or false to deselect it. Most controls do not modify their appearance or behavior when selected, but some do.


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