Added cUISelectButton control.

Added cUIWinMenu control ( window menu ).
Some minor changes on the UI controls.
This commit is contained in:
spartanj
2011-04-18 19:45:13 -03:00
parent e6f8b70a1c
commit 9f4f013a9e
25 changed files with 543 additions and 23 deletions

View File

@@ -0,0 +1,57 @@
#include "cuiselectbutton.hpp"
#include "cuiwinmenu.hpp"
namespace EE { namespace UI {
cUISelectButton::cUISelectButton( const cUIPushButton::CreateParams& Params ) :
cUIPushButton( Params )
{
mType |= UI_TYPE_GET(UI_TYPE_SELECTBUTTON);
}
cUISelectButton::~cUISelectButton() {
}
void cUISelectButton::Select() {
bool wasSelected = Selected();
SetSkinState( cUISkinState::StateSelected );
mControlFlags |= UI_CTRL_FLAG_SELECTED;
if ( !wasSelected ) {
cUIMessage tMsg( this, cUIMessage::MsgSelected, 0 );
MessagePost( &tMsg );
}
}
void cUISelectButton::Unselect() {
if ( mControlFlags & UI_CTRL_FLAG_SELECTED )
mControlFlags &= ~UI_CTRL_FLAG_SELECTED;
SetSkinState( cUISkinState::StateNormal );
}
bool cUISelectButton::Selected() const {
return 0 != ( mControlFlags & UI_CTRL_FLAG_SELECTED );
}
void cUISelectButton::OnStateChange() {
if ( mSkinState->GetState() != cUISkinState::StateSelected && Selected() ) {
SetSkinState( cUISkinState::StateSelected );
}
if ( Parent()->Type() & UI_TYPE_WINMENU ) {
cUIWinMenu * Menu = reinterpret_cast<cUIWinMenu*> ( Parent() );
if ( mSkinState->GetState() == cUISkinState::StateSelected ) {
TextBox()->Color( Menu->FontSelectedColor() );
} else if ( mSkinState->GetState() == cUISkinState::StateMouseEnter ) {
TextBox()->Color( Menu->FontOverColor() );
} else {
TextBox()->Color( Menu->FontColor() );
}
}
}
}}