class sampleUILoadingBarController extends inkLogicController
{
	editable var minSize : Vector2;
	editable var maxSize : Vector2;
	editable var imageWidgetPath : CName;
	editable var textWidgetPath : CName;
	private var m_currentSize : Vector2;
	private var m_imageWidget : weak< inkImage >;
	private var m_textWidget : weak< inkText >;

	protected event OnInitialize()
	{
		m_imageWidget = ( ( inkImage )( GetWidget( imageWidgetPath ) ) );
		m_textWidget = ( ( inkText )( GetWidget( textWidgetPath ) ) );
		m_currentSize = minSize;
		m_imageWidget.SetSize( m_currentSize );
		m_textWidget.SetText( "Waiting" );
	}

	public function OnHold( e : inkPointerEvent )
	{
		if( e.IsAction( 'click' ) )
		{
			m_currentSize.X = minSize.X + ( ( maxSize.X - minSize.X ) * e.GetHoldProgress() );
			m_imageWidget.SetSize( m_currentSize );
			m_textWidget.SetText( ( ( String )( e.GetHoldProgress() ) ) );
		}
	}

	public function OnRelease( e : inkPointerEvent )
	{
		if( e.IsAction( 'click' ) )
		{
			m_textWidget.SetText( "Waiting" );
		}
	}

}

class sampleUIEventTestLogicController extends inkLogicController
{
	editable var eventTextWidgetPath : CName;
	editable var eventVerticalPanelPath : CName;
	editable var callbackTextWidgetPath : CName;
	editable var callbackVerticalPanelPath : CName;
	editable var customCallbackName : CName;
	private var m_textWidget : weak< inkText >;
	private var m_verticalPanelWidget : weak< inkVerticalPanel >;
	private var m_isEnabled : Bool;

	protected event OnInitialize()
	{
		m_isEnabled = true;
	}

	private function ToggleVisibility( const text : ref< String > )
	{
		if( m_isEnabled == true )
		{
			m_isEnabled = false;
			m_textWidget.SetText( "HIDDEN " + text );
			m_verticalPanelWidget.SetVisible( false );
		}
		else
		{
			m_isEnabled = true;
			m_textWidget.SetText( "SHOWN " + text );
			m_verticalPanelWidget.SetVisible( true );
		}
	}

	public function OnButtonClickEventTest( e : inkPointerEvent )
	{
		if( e.IsAction( 'click' ) )
		{
			m_textWidget = ( ( inkText )( GetWidget( callbackTextWidgetPath ) ) );
			m_verticalPanelWidget = ( ( inkVerticalPanel )( GetWidget( callbackVerticalPanelPath ) ) );
			ToggleVisibility( "(Callback test)" );
		}
	}

	public function CallbackTest( widget : weak< inkWidget > )
	{
		m_textWidget = ( ( inkText )( GetWidget( eventTextWidgetPath ) ) );
		m_verticalPanelWidget = ( ( inkVerticalPanel )( GetWidget( eventVerticalPanelPath ) ) );
		ToggleVisibility( "(Event test)" );
	}

	public function OnButtonClickCallbackTest( e : inkPointerEvent )
	{
		if( e.IsAction( 'click' ) )
		{
			GetWidget( callbackVerticalPanelPath ).CallCustomCallback( customCallbackName );
		}
	}

}

