class KeyboardHintItemController extends AHintItemController
{
	private editable var m_NumberText : inkTextRef;
	private editable var m_Frame : inkImageRef;
	private editable var m_DisabledStateName : CName;
	default m_DisabledStateName = 'Disabled';
	private editable var m_SelectedStateName : CName;
	default m_SelectedStateName = 'Selected';
	private editable var m_FrameSelectedName : CName;
	default m_FrameSelectedName = 'top_button_selected';
	private editable var m_FrameUnselectedName : CName;
	default m_FrameUnselectedName = 'top_button';
	private editable var m_AnimationName : CName;
	default m_AnimationName = 'AnimRootOnThenOff';

	public function Setup( itemNumber : Int32 )
	{
		inkTextRef.SetText( m_NumberText, IntToString( itemNumber ) );
	}

	protected override function CacheAnimations() {}

	public function SetState( isEnabled : Bool, isSelected : Bool )
	{
		if( isEnabled )
		{
			m_Root.SetState( ( ( isSelected ) ? ( m_SelectedStateName ) : ( inkWidget.DefaultState() ) ) );
		}
		else
		{
			m_Root.SetState( m_DisabledStateName );
		}
		inkImageRef.SetTexturePart( m_Frame, ( ( isEnabled && isSelected ) ? ( m_FrameSelectedName ) : ( m_FrameUnselectedName ) ) );
	}

	public override function Animate( isEnabled : Bool )
	{
		super.Animate( isEnabled );
		if( isEnabled )
		{
			inkImageRef.SetOpacity( m_Icon, 1.0 );
		}
		else
		{
			inkImageRef.SetOpacity( m_Icon, 0.40000001 );
		}
		PlayLibraryAnimationOnTargets( m_AnimationName, SelectWidgets( m_Root ) );
	}

}

abstract class AHintItemController extends inkLogicController
{
	protected editable var m_Icon : inkImageRef;
	protected editable var m_UnavaliableText : inkTextRef;
	protected var m_Root : weak< inkWidget >;

	protected event OnInitialize()
	{
		m_Root = GetRootWidget();
		m_Root.SetOpacity( 0.0 );
		CacheAnimations();
	}

	public function SetIcon( atlasPath : CName, iconName : CName )
	{
		inkImageRef.SetTexturePart( m_Icon, iconName );
	}

	protected virtual function CacheAnimations();

	public virtual function Animate( isEnabled : Bool )
	{
		inkTextRef.Get( m_UnavaliableText ).SetVisible( !( isEnabled ) );
	}

	protected virtual function OnAnimFinished( anim : inkAnimProxy )
	{
		m_Root.SetOpacity( 0.0 );
	}

}

