ofxMUI
A Multi-touch GUI implementation built with ofxDOM for openFrameworks.
|
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. | |
A common class for setting shared Widget styles.
Get the ofColor for a given Role and State.
role | The Role desired. |
state | The State desired. |
const ofTrueTypeFont & ofx::MUI::Styles::getFont | ( | FontSize | size = FontSize::MEDIUM | ) | const |
Get the font for a given FontSize.
size | The font size to get. |
Set the ofColor for a given Role and State.
color | The color to set. |
role | The Role desired. |
state | The 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.
foreground | The foreground color. |
background | The background color. |
accent | The accent color. |
border | The border color. |
text | The text color. |
void ofx::MUI::Styles::setFont | ( | FontSize | size, |
std::shared_ptr< ofTrueTypeFont > | font | ||
) |
Set the font for a given FontSize.
size | The FontSize for the font. |
font | The cached font to use. |