CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::UIAppearanceProperty< T > Struct Template Reference

A UI appearance property that returns a color. More...

#include <CeresEngine/UI/UIAppearance.hpp>

Public Types

using DefaultValueFunction = UniqueFunction< T(const UIView &) const >
 A function that computes a default value.
 
using DefaultValueVariant = Variant< T, DefaultValueFunction, const UIAppearanceProperty * >
 A variant type that represents the default value.
 

Public Member Functions

 UIAppearanceProperty (const StringView &name, const T &defaultValue=T())
 Creates a new UIAppearanceProperty.
 
 UIAppearanceProperty (const StringView &name, DefaultValueFunction &&defaultValueFunction)
 Creates a new UIAppearanceProperty by using a computation function.
 
 UIAppearanceProperty (const StringView &name, const UIAppearanceProperty &aliasedProperty)
 Creates a new UIAppearanceProperty by aliasing another property.
 
T getDefaultValue (const UIView &aView) const noexcept
 Gets the default value for the property.
 
T operator[] (const UIView &view) const noexcept
 Computes the appearance property value for the given view.
 
T operator[] (const UIView *const aView) const noexcept
 

Public Attributes

StringView name
 A name for the appearance property.
 
DefaultValueVariant defaultValue
 The properties default value, to be used in case the appearance don't offer a custom value.
 

Detailed Description

template<typename T>
struct CeresEngine::UIAppearanceProperty< T >

A UI appearance property that returns a color.

Template Parameters
TThe appearance property value type.

Member Typedef Documentation

◆ DefaultValueFunction

A function that computes a default value.

◆ DefaultValueVariant

A variant type that represents the default value.

Constructor & Destructor Documentation

◆ UIAppearanceProperty() [1/3]

template<typename T >
CeresEngine::UIAppearanceProperty< T >::UIAppearanceProperty ( const StringView name,
const T defaultValue = T() 
)
inlineexplicit

Creates a new UIAppearanceProperty.

Parameters
nameThe property name.
defaultValueThe property default value.

◆ UIAppearanceProperty() [2/3]

template<typename T >
CeresEngine::UIAppearanceProperty< T >::UIAppearanceProperty ( const StringView name,
DefaultValueFunction &&  defaultValueFunction 
)
inlineexplicit

Creates a new UIAppearanceProperty by using a computation function.

Parameters
nameThe property name.
defaultValueFunctionThe function to be used to compute the property default value.

◆ UIAppearanceProperty() [3/3]

template<typename T >
CeresEngine::UIAppearanceProperty< T >::UIAppearanceProperty ( const StringView name,
const UIAppearanceProperty< T > &  aliasedProperty 
)
inlineexplicit

Creates a new UIAppearanceProperty by aliasing another property.

Parameters
nameThe property name.
aliasedPropertyThe property to alias as the default value.

Member Function Documentation

◆ getDefaultValue()

template<typename T >
T CeresEngine::UIAppearanceProperty< T >::getDefaultValue ( const UIView aView) const
noexcept

Gets the default value for the property.

Parameters
appearanceThe UIAppearance to be forwarded to the DefaultValueFunction.
Returns
A value, as stored in the default value.

◆ operator[]() [1/2]

template<typename T >
T CeresEngine::UIAppearanceProperty< T >::operator[] ( const UIView view) const
noexcept

Computes the appearance property value for the given view.

Parameters
viewThe view to compute the appearance property for.
Returns
The computed appearance property or a default value.

◆ operator[]() [2/2]

template<typename T >
T CeresEngine::UIAppearanceProperty< T >::operator[] ( const UIView *const  aView) const
inlinenoexcept

Member Data Documentation

◆ defaultValue

The properties default value, to be used in case the appearance don't offer a custom value.

◆ name

A name for the appearance property.

Used to uniquely identify a property in the appearance map.


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