class ComputerMenuButtonController extends DeviceButtonLogicControllerBase
{
	default selectable = true;
	[ category = "Widget Refs" ]
	protected editable var m_counterWidget : inkTextRef;
	[ category = "Widget Refs" ]
	protected editable var m_notificationidget : inkWidgetRef;
	private var m_menuID : String;

	protected event OnInitialize()
	{
		super.OnInitialize();
		SetSelectable( true );
	}

	public virtual function Initialize( gameController : ComputerInkGameController, widgetData : SComputerMenuButtonWidgetPackage )
	{
		var currentManuID : String;
		m_menuID = widgetData.widgetName;
		inkTextRef.SetText( m_displayNameWidget, widgetData.displayName );
		if( widgetData.counter <= 0 )
		{
			inkWidgetRef.SetVisible( m_notificationidget, false );
		}
		else
		{
			inkWidgetRef.SetVisible( m_notificationidget, true );
			inkTextRef.SetText( m_counterWidget, ( ( String )( widgetData.counter ) ) );
		}
		if( inkImageRef.Get( m_iconWidget ) != NULL )
		{
			inkImageRef.SetTexturePart( m_iconWidget, widgetData.iconID );
		}
		RegisterMenuCallback( gameController );
		currentManuID = gameController.GetCurrentBreadcrumbElementName();
		if( IsStringValid( currentManuID ) && currentManuID == m_menuID )
		{
			ToggleSelection( true );
		}
		m_isInitialized = true;
	}

	protected function RegisterMenuCallback( gameController : ComputerInkGameController )
	{
		if( !( m_isInitialized ) )
		{
			m_targetWidget.RegisterToCallback( 'OnRelease', gameController, 'OnMenuButtonCallback' );
			RegisterAudioCallbacks( gameController );
		}
	}

	public function GetMenuID() : String
	{
		return m_menuID;
	}

}

