importonly class inkMenusState extends IScriptable
{
	public import const function IsMenusVisible() : Bool;
	public import const function ShowMenus( vakue : Bool );
	public import final function GetControllerMenuName() : CName;
	public import final function OpenMenu( menuName : CName, optional userData : IScriptable ) : weak< inkWidget >;
	public import final function CloseMenu( menuName : CName );
	public import final function CloseAllMenus();
	public import final function IsMenuOpened( menuName : CName ) : Bool;
	public import final function GetMenu( menuName : CName ) : weak< inkWidget >;
	public import final function IsHubMenuBlocked() : Bool;
	public import final function SetHubMenuBlocked( blocked : Bool );
	public import final function DispatchEvent( menuName : CName, eventName : CName, optional userData : IScriptable ) : Bool;
}

importonly abstract class inkMenuEventDispatcher extends IScriptable
{
	public import final function SpawnEvent( name : CName, optional userData : IScriptable );
	public import final function SpawnAddressedEvent( scenario : CName, name : CName, optional userData : IScriptable );
	public import final function RegisterToEvent( eventName : CName, object : IScriptable, functionName : CName );
	public import final function UnregisterFromEvent( eventName : CName, object : IScriptable, functionName : CName );
}

importonly class inkMenuScenario extends IScriptable
{
	public import final function SwitchToScenario( name : CName, optional userData : IScriptable );
	public import final function GetMenusState() : weak< inkMenusState >;
	public import function GetSystemRequestsHandler() : weak< inkISystemRequestsHandler >;
	public import function QueueEvent( evt : Event );
	public import function QueueBroadcastEvent( evt : Event );
}

importonly class inkClippedMenuScenarioData extends IScriptable
{
	import var menus : array< CName >;
}

class MenuScenario_ClippedMenu extends inkMenuScenario
{

	protected event OnEnterScenario( prevScenario : CName, userData : IScriptable )
	{
		var menuState : weak< inkMenusState >;
		var data : inkClippedMenuScenarioData;
		var i : Int32;
		menuState = GetMenusState();
		menuState.ShowMenus( false );
		data = ( ( inkClippedMenuScenarioData )( userData ) );
		if( data )
		{
			for( i = 0; i < data.menus.Size(); i += 1 )
			{
				menuState.OpenMenu( data.menus[ i ] );
			}
		}
	}

	protected event OnOpenPauseMenu()
	{
		var menuState : weak< inkMenusState >;
		menuState = GetMenusState();
		menuState.ShowMenus( !( menuState.IsMenusVisible() ) );
	}

	protected event OnOpenHubMenu()
	{
		var menuState : weak< inkMenusState >;
		menuState = GetMenusState();
		menuState.ShowMenus( !( menuState.IsMenusVisible() ) );
	}

}

