Files
eepp/src/ui/cuiskin.cpp
spartanj e5744e349c Added a mutex on HaikuTTF, to fix a problem ( a.k.a. bug ) with multiple concurrence on FT calls.
Added Icon possibility to cUIPushButton.
Added default fonts for ui themes and global default font for all ui themes.
Changed how cUIGfx get shapes, now accept a new instance without shape.
Fixed how padding works on cUITextBox and cUITextInput.
Fixed font rendering in cTextCache when some text rendered with angle or/and scale ( it was breaking the model view matrix ).
Fixed a miscounting of the number of vertex for the cached text.
Fixed HaikuTTF destroy singleton ( now release fine the memory ).
2010-10-18 04:38:24 -03:00

82 lines
1.5 KiB
C++

#include "cuiskin.hpp"
namespace EE { namespace UI {
const char * UISkinStatesNames[] = {
"normal",
"focus",
"selected",
"menter",
"mexit",
"mdown"
};
const char * cUISkin::GetSkinStateName( const Uint32& State ) {
return UISkinStatesNames[ State ];
}
cUISkin::cUISkin( const std::string& Name, const Uint32& Type ) :
mType( Type ),
mName( Name ),
mNameHash( MakeHash( mName ) ),
mTheme(NULL)
{
mColorDefault = 0xFFFFFFFF;
for ( Int32 i = 0; i < cUISkinState::StateCount; i++ )
mColor[ i ] = eeColorA( 0xFFFFFFFF );
}
cUISkin::~cUISkin() {
}
void cUISkin::SetColor( const Uint32& State, const eeColorA& Color ) {
eeASSERT ( State < cUISkinState::StateCount );
Write32BitKey( &mColorDefault, State, 0 );
mColor[ State ] = Color;
}
const eeColorA& cUISkin::GetColor( const Uint32& State ) const {
eeASSERT ( State < cUISkinState::StateCount );
return mColor[ State ];
}
const std::string& cUISkin::Name() const {
return mName;
}
void cUISkin::Name( const std::string& name ) {
mName = name;
mNameHash = MakeHash( mName );
}
const Uint32& cUISkin::Id() const {
return mNameHash;
}
void cUISkin::SetSkins() {
for ( Int32 i = 0; i < cUISkinState::StateCount; i++ )
SetSkin( i );
}
cUITheme * cUISkin::Theme() const {
return mTheme;
}
void cUISkin::Theme( cUITheme * theme ) {
mTheme = theme;
}
const Uint32& cUISkin::GetType() const {
return mType;
}
bool cUISkin::GetColorDefault( const Uint32& State ) {
return Read32BitKey( &mColorDefault, State );
}
}}