StyleOptions Class Reference

#include <Pt/Forms/StyleOptions.h>

Style options container. More...

Public Member Functions

 StyleOptions ()
 Constructs an empty container.
 
 StyleOptions (const StyleOptions &o)
 Copy Constructor.
 
 ~StyleOptions ()
 Destructor.
 
StyleOptionsoperator= (const StyleOptions &o)
 Assigns style options.
 
std::size_t generation () const
 Returns the current change generation.
 
bool hasOptions () const
 Returns true if the container contains any local option. More...
 
bool isDefault (const StyleOptions &base) const
 Returns true if no options override base.
 
void bind (const StyleOptions *inherited)
 Binds local options to inherited and materializes effective values. More...
 
const StyleOptionsparent () const
 Returns the parent container that provides inherited options, or 0.
 
template<typename T >
const T * findLocal () const
 Returns the local option of type T, or 0 if absent.
 
template<typename T >
const T * find () const
 Returns the local or inherited option of type T, or 0 if absent.
 
template<typename T >
const T & get () const
 Returns the local or inherited option of type T.
 
template<typename T >
void set (const T &option)
 Sets or replaces the local option of type T.
 
template<typename T >
void reset ()
 Removes the local option of type T if present.
 

Static Public Member Functions

static StyleOptions defaults ()
 Returns a complete container with the built-in default options.
 

Detailed Description

Contains local style options such as ForegroundOption or FontOption. The default constructor creates an empty container. defaults() returns a container populated with the built-in default options.

bind() associates an inherited container and materializes local partial options against its effective values. find() and get() consider both local and inherited options. findLocal() and hasOptions() only consider locally stored options. set() and reset() modify the local options.

Member Function Documentation

◆ hasOptions()

bool hasOptions ( ) const

TODO: remove this in favour of isDefault

◆ bind()

void bind ( const StyleOptions inherited)

Rebinding with unchanged local and inherited generations performs no option traversal. Passing 0 removes the inherited container.