ofxMUI
A Multi-touch GUI implementation built with ofxDOM for openFrameworks.
ofx::MUI::Styles Class Reference

A common class for setting shared Widget styles. More...

#include <Styles.h>

Public Types

enum  Role {
  ROLE_FOREGROUND = 0, ROLE_BACKGROUND, ROLE_ACCENT, ROLE_BORDER,
  ROLE_TEXT
}
 Each Style has a role. More...
 
enum  State { STATE_NORMAL = 0, STATE_OVER, STATE_DOWN, STATE_DISABLED }
 Each style can also be applied to an interaction state. More...
 

Public Member Functions

 Styles ()
 Create a default styles.
 
virtual ~Styles ()
 Destroy these styles.
 
void setColors (const ofColor &foreground, const ofColor &background, const ofColor &accent, const ofColor &border, const ofColor &text)
 Set colors for each role in the Style. More...
 
const ofColor & getColor (Role role, State state) const
 Get the ofColor for a given Role and State. More...
 
void setColor (const ofColor &color, Role role, State state)
 Set the ofColor for a given Role and State. More...
 
const ofTrueTypeFont & getFont (FontSize size=FontSize::MEDIUM) const
 Get the font for a given FontSize. More...
 
void setFont (FontSize size, std::shared_ptr< ofTrueTypeFont > font)
 Set the font for a given FontSize. More...
 

Protected Attributes

std::vector< std::vector< ofColor > > _colors
 A collection of colros for this Style.
 
std::vector< std::shared_ptr< ofTrueTypeFont > > _fonts
 A font cache for this Style.
 

Detailed Description

A common class for setting shared Widget styles.

Member Enumeration Documentation

Each Style has a role.

Enumerator
ROLE_FOREGROUND 

Styles applied to the foreground.

ROLE_BACKGROUND 

Styles applied to the background.

ROLE_ACCENT 

Styles applied to the accent areas.

ROLE_BORDER 

Styles applied to the borders.

ROLE_TEXT 

Styles applied to the text.

Each style can also be applied to an interaction state.

Enumerator
STATE_NORMAL 

The normal target is idle.

STATE_OVER 

The state when a pointer is over the target.

STATE_DOWN 

The state when a target is down.

STATE_DISABLED 

The state when a target is disabled.

Member Function Documentation

const ofColor & ofx::MUI::Styles::getColor ( Role  role,
State  state 
) const

Get the ofColor for a given Role and State.

Parameters
roleThe Role desired.
stateThe State desired.
Returns
an ofColor for the given role and state.
const ofTrueTypeFont & ofx::MUI::Styles::getFont ( FontSize  size = FontSize::MEDIUM) const

Get the font for a given FontSize.

Parameters
sizeThe font size to get.
Returns
a reference to the requested font.
void ofx::MUI::Styles::setColor ( const ofColor &  color,
Role  role,
State  state 
)

Set the ofColor for a given Role and State.

Parameters
colorThe color to set.
roleThe Role desired.
stateThe State desired.
void ofx::MUI::Styles::setColors ( const ofColor &  foreground,
const ofColor &  background,
const ofColor &  accent,
const ofColor &  border,
const ofColor &  text 
)

Set colors for each role in the Style.

Parameters
foregroundThe foreground color.
backgroundThe background color.
accentThe accent color.
borderThe border color.
textThe text color.
void ofx::MUI::Styles::setFont ( FontSize  size,
std::shared_ptr< ofTrueTypeFont >  font 
)

Set the font for a given FontSize.

Parameters
sizeThe FontSize for the font.
fontThe cached font to use.

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