Files
eepp/src/ui/cuiskin.cpp
spartanj 4f1548c135 Added cUIScrollBar control.
Fixed a huge bug on the control states, now every control has a cUISkinState to keep the state data of the skined control.
Improved and made some fixes on cUISlider ( to work well with the scrollbar ).
2010-10-14 01:16:27 -03:00

82 lines
1.5 KiB
C++

#include "cuiskin.hpp"
namespace EE { namespace UI {
const char * UISkinStatesNames[] = {
"normal",
"focus",
"unfocus",
"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 );
}
}}