class DropdownButtonController extends inkLogicController
{
	protected editable var m_label : inkTextRef;
	protected editable var m_icon : inkImageRef;
	protected editable var m_frame : inkWidgetRef;
	protected editable var m_arrow : inkImageRef;

	protected event OnInitialize()
	{
		RegisterToCallback( 'OnHoverOver', this, 'OnHoverOver' );
		RegisterToCallback( 'OnHoverOut', this, 'OnHoverOut' );
	}

	public function SetData( data : DropdownItemData )
	{
		inkTextRef.SetText( m_label, NameToString( data.labelKey ) );
		inkImageRef.SetVisible( m_icon, data.direction != DropdownItemDirection.None );
		if( data.direction == DropdownItemDirection.Up )
		{
			inkImageRef.SetBrushMirrorType( m_icon, inkBrushMirrorType.Vertical );
		}
		else
		{
			inkImageRef.SetBrushMirrorType( m_icon, inkBrushMirrorType.NoMirror );
		}
	}

	public function SetOpened( opened : Bool )
	{
		inkImageRef.SetBrushMirrorType( m_arrow, ( ( opened ) ? ( inkBrushMirrorType.Vertical ) : ( inkBrushMirrorType.NoMirror ) ) );
	}

	protected event OnHoverOut( evt : inkPointerEvent )
	{
		GetRootWidget().SetState( 'Default' );
	}

	protected event OnHoverOver( evt : inkPointerEvent )
	{
		GetRootWidget().SetState( 'Hover' );
	}

}

