class PreGameSubMenuGameController extends inkGameController
{
	protected var m_menuEventDispatcher : weak< inkMenuEventDispatcher >;

	protected event OnInitialize()
	{
		var menuName : weak< inkText >;
		var buttonsList : weak< inkVerticalPanel >;
		var dpadLogic : weak< fullscreenDpadSupported >;
		var firstButton : weak< inkWidget >;
		if( SpawnFromExternal( GetRootWidget(), R"base\gameplay\gui\fullscreen\main_menu\shared_data.inkwidget", 'MainColumn' ) )
		{
			menuName = ( ( inkText )( GetWidget( 'MainColumn\Container\MenuName' ) ) );
			if( menuName )
			{
				InitializeMenuName( menuName );
			}
			buttonsList = ( ( inkVerticalPanel )( GetWidget( 'MainColumn\Container\ButtonsList' ) ) );
			if( buttonsList )
			{
				InitializeButtons( buttonsList );
				dpadLogic = ( ( fullscreenDpadSupported )( GetRootWidget().GetController() ) );
				if( dpadLogic && ( buttonsList.GetNumChildren() > 0 ) )
				{
					firstButton = buttonsList.GetWidget( 0 );
					dpadLogic.SetDpadTargetsInList( buttonsList );
					dpadLogic.SetDpadTargets( NULL, firstButton, NULL, firstButton );
					SetCursorOverWidget( firstButton );
				}
			}
		}
	}

	protected event OnSetMenuEventDispatcher( menuEventDispatcher : weak< inkMenuEventDispatcher > )
	{
		m_menuEventDispatcher = menuEventDispatcher;
	}

	public virtual function InitializeMenuName( menuName : weak< inkText > );
	public virtual function InitializeButtons( buttonsList : weak< inkVerticalPanel > );

	protected function AddButton( buttonsList : inkVerticalPanel, const text : ref< String >, callBackName : CName )
	{
		var newButton : weak< inkWidget >;
		var currLogic : weak< inkButtonDpadSupportedController >;
		newButton = SpawnFromExternal( buttonsList, R"base\gameplay\gui\fullscreen\main_menu\shared_data.inkwidget", 'MenuButton' );
		newButton.RegisterToCallback( 'OnRelease', this, callBackName );
		currLogic = ( ( inkButtonDpadSupportedController )( newButton.GetController() ) );
		currLogic.SetButtonText( text );
	}

	protected function AddBigButton( buttonsList : inkCompoundWidget, const text : ref< String >, callBackName : CName )
	{
		var newButton : weak< inkWidget >;
		var currLogic : weak< inkButtonAnimatedController >;
		newButton = SpawnFromExternal( buttonsList, R"base\gameplay\gui\fullscreen\main_menu\shared_data.inkwidget", 'BigButton' );
		newButton.RegisterToCallback( 'OnRelease', this, callBackName );
		currLogic = ( ( inkButtonAnimatedController )( newButton.GetController() ) );
		currLogic.SetButtonText( text );
	}

	protected function AddSelector( selectorsList : inkVerticalPanel, const label : ref< String >, optional values : array< String > ) : weak< SelectorController >
	{
		var newSelector : weak< inkWidget >;
		var currLogic : weak< SelectorController >;
		newSelector = SpawnFromExternal( selectorsList, R"base\gameplay\gui\fullscreen\main_menu\shared_data.inkwidget", 'MenuSelector' );
		currLogic = ( ( SelectorController )( newSelector.GetController() ) );
		currLogic.SetLabel( label );
		currLogic.AddValues( values );
		if( values.Size() > 0 )
		{
			currLogic.SetCurrIndex( 0 );
		}
		return currLogic;
	}

}

