class RefreshTooltipEvent extends Event
{
	var widget : weak< inkWidget >;
}

class InvalidateTooltipHiddenStateEvent extends Event
{
	var widget : weak< inkWidget >;
}

class TooltipProvider extends inkLogicController
{
	private var m_TooltipsData : array< ATooltipData >;
	private var m_visible : Bool;

	public function ClearTooltipData()
	{
		m_TooltipsData.Clear();
	}

	public function PushData( data : ATooltipData )
	{
		m_TooltipsData.PushBack( data );
	}

	public function AddData( data : ATooltipData )
	{
		m_TooltipsData.Insert( 0, data );
	}

	public function RefreshTooltips()
	{
		var refreshTooltipEvent : RefreshTooltipEvent;
		refreshTooltipEvent = new RefreshTooltipEvent;
		refreshTooltipEvent.widget = GetRootWidget();
		QueueEvent( refreshTooltipEvent );
	}

	public function InvalidateHidden()
	{
		var invalidateHiddenEvent : InvalidateTooltipHiddenStateEvent;
		invalidateHiddenEvent = new InvalidateTooltipHiddenStateEvent;
		invalidateHiddenEvent.widget = GetRootWidget();
		QueueEvent( invalidateHiddenEvent );
	}

	public function GetIdentifiedTooltipOwner( index : Int32 ) : EntityID
	{
		var identifiedTooltip : IdentifiedWrappedTooltipData;
		if( HasTooltipData( index ) )
		{
			identifiedTooltip = ( ( IdentifiedWrappedTooltipData )( m_TooltipsData[ index ] ) );
			if( identifiedTooltip )
			{
				return identifiedTooltip.m_tooltipOwner;
			}
			return EMPTY_ENTITY_ID();
		}
		return EMPTY_ENTITY_ID();
	}

	public function HasTooltipData( index : Int32 ) : Bool
	{
		return index < m_TooltipsData.Size();
	}

	public function HasAnyTooltipData() : Bool
	{
		return m_TooltipsData.Size() > 0;
	}

	public function GetTooltipData( index : Int32 ) : ATooltipData
	{
		if( HasTooltipData( index ) )
		{
			return m_TooltipsData[ index ];
		}
		return NULL;
	}

	public function GetTooltipsData() : array< ATooltipData >
	{
		return m_TooltipsData;
	}

	public function IsVisible() : Bool
	{
		return m_visible;
	}

	public function SetVisible( visible : Bool )
	{
		m_visible = visible;
	}

}

