GUI
Class GUIPage

source: C:\XIII\GUI\Classes\GUIPage.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUIMultiComponent
            |
            +--GUI.GUIPage
Direct Known Subclasses:XIIIWindow

class GUIPage
extends GUI.GUIMultiComponent

// ==================================================================== // (c) 2002, Epic Games, Inc. All Rights Reserved // ====================================================================
Variables
 float LatentFloat
          
 bool bAllowedAsLast
           If this is true, closing this page will not bring up the main menu
 bool bDoStoreInSaveMenuStack
           if true, the page will be saved in the menu stack created when a map is loaded from the menu
 bool bHidePreviousPage
           if true, the previous pages in the stack won't be rendered
 bool bNeedRawKey
          

States
Newstate

Function Summary
 void CheckResolution(bool Closing)
     
//=================================================
// CheckResolution - Tests to see if this menu requires a resoltuion of at least 640x480 and if so, switches
 string GetPageParameters()
     
// if subclassed, this parent function must always be called first
 void InitComponent(GUIController MyController, GUIComponent MyOwner)
     
//=================================================
// InitComponent is responsible for initializing all components on the page.
 void PageLoadINI()
 void PageSaveINI()
 void PlayCloseSound()
 void PlayOpenSound()
     
//=================================================
// PlayOpenSound / PlayerClosedSound
 void SetPageParameters(string PageParameters)
     
// if GetPageParameters() is subclassed, you'd better have this one too !
 void Sleep(float Seconds)
     
// Latent functions.


State Newstate Function Summary



Source Code


00001	// ====================================================================
00002	//  (c) 2002, Epic Games, Inc.  All Rights Reserved
00003	// ====================================================================
00004	
00005	class GUIPage extends GUIMultiComponent
00006		Native 	Abstract;
00007	
00008	
00009	// Variables
00010	
00011	var(Menu)   					Material				Background;			// The background image for the menu
00012	var(Menu)						Color					BackgroundColor;	// The color of the background
00013	var(Menu)						Color					InactiveFadeColor;	// Color Modulation for Inactive Page
00014	var(Menu)						EMenuRenderStyle		BackgroundRStyle;
00015	var(Menu)						bool					bRenderWorld;		// Should this menu hide the world
00016	var(Menu)						bool					bPauseIfPossible;	// Should this menu pause the game if possible
00017	var(Menu)						bool					bCheckResolution;	// If true, the menu will be force to run at least 640x480
00018	var(Menu)						Sound					OpenSound;			// Sound to play when opened
00019	var(Menu)						Sound					CloseSound;			// Sound to play when closed
00020	
00021	
00022	var								bool					bRequire640x480;	// Does this menu require at least 640x480
00023	// NL static load var								bool					bPersistent;		// If set in defprops, page is saved across open/close/reopen.
00024	
00025	var								GUIPage					ParentPage;			// The page that exists before this one
00026	var	const						array<GUIComponent>		Timers;				// List of components with Active Timers
00027	var 							bool					bAllowedAsLast;		// If this is true, closing this page will not bring up the main menu
00028	
00029	var                             bool                    bHidePreviousPage;  // if true, the previous pages in the stack won't be rendered
00030	var                             bool                    bDoStoreInSaveMenuStack;  // if true, the page will be saved in the menu stack created when a map is loaded from the menu
00031	var                             bool                    bNeedRawKey;		//
00032	var const float LatentFloat;
00033	
00034	
00035	// Latent functions.
00036	native(430) final latent function Sleep( float Seconds );
00037	
00038	
00039	// if last on the stack.
00040	// Delegates
00041	
00042	delegate OnOpen()
00043	{
00044		PageLoadINI();
00045	}
00046	
00047	delegate OnReOpen()
00048	{
00049	}
00050	
00051	delegate bool OnCanClose(optional Bool bCanceled)
00052	{
00053		return true;
00054	}
00055	
00056	delegate OnClose(optional Bool bCanceled)
00057	{
00058		if (!bCanceled)
00059			PageSaveINI();
00060	}
00061	
00062	function PageLoadINI()
00063	{
00064		local int i;
00065	
00066		for (i=0;i<Controls.Length;i++)
00067			Controls[i].LoadINI();
00068	
00069		return;
00070	}
00071	
00072	function PageSaveINI()
00073	{
00074		local int i;
00075	
00076		for (i=0;i<Controls.Length;i++)
00077			Controls[i].SaveINI("");
00078	}
00079	
00080	//=================================================
00081	// PlayOpenSound / PlayerClosedSound
00082	
00083	function PlayOpenSound()
00084	{
00085		//PlayerOwner().PlayOwnedSound(OpenSound,SLOT_Interface,1.0);
00086	}
00087	
00088	function PlayCloseSound()
00089	{
00090		//PlayerOwner().PlayOwnedSound(CloseSound,SLOT_Interface,1.0);
00091	}
00092	
00093	
00094	//=================================================
00095	// InitComponent is responsible for initializing all components on the page.
00096	
00097	function InitComponent(GUIController MyController, GUIComponent MyOwner)
00098	{
00099		Super.Initcomponent(MyController, MyOwner);
00100		FocusFirst(None,true);
00101	}
00102	
00103	//=================================================
00104	// CheckResolution - Tests to see if this menu requires a resoltuion of at least 640x480 and if so, switches
00105	
00106	function CheckResolution(bool Closing)
00107	{
00108		local string CurrentRes;
00109		local int I,X,Y;
00110	
00111		if (!Closing)
00112		{
00113			CurrentRes = PlayerOwner().ConsoleCommand( "GETCURRENTRES" );
00114		    I = InStr( CurrentRes, "x" );
00115		    if( i > 0 )
00116		    {
00117				X = int( Left ( CurrentRes, i )  );
00118				Y = int( Mid( CurrentRes, i+1 ) );
00119		    }
00120			else
00121			{
00122				log("Couldn't parse GetCurrentRes call");
00123				return;
00124			}
00125			if ( ( (x<640) || (y<480) ) && (bRequire640x480) )
00126			{
00127				log("GUIPage::CheckResolution Setting GameResolution to"@CurrentRes);
00128				Controller.GameResolution = CurrentRes;
00129				PlayerOwner().ConsoleCommand("TEMPSETRES 640x480");
00130			}
00131	
00132			return;
00133	
00134		}
00135	
00136		if ( (bRequire640x480) || (Controller.GameResolution=="") )
00137			return;
00138	
00139		CurrentRes = PlayerOwner().ConsoleCommand( "GETCURRENTRES" );
00140		if (CurrentRes != Controller.GameResolution)
00141		{
00142			log("GUIPage::CheckResolution switching to"@CurrentRes);
00143			PlayerOwner().Player.Console.ConsoleCommand("SETRES"@Controller.GameResolution);
00144			Controller.GameResolution = "";
00145		}
00146	
00147	}
00148	
00149	event Tick( float DeltaTime );      // One page is ticked at once: the active one
00150	
00151	event ChangeHint(string NewHint)
00152	{
00153		Hint = NewHint;
00154	}
00155	
00156	event MenuStateChange(eMenuState Newstate)
00157	{
00158		Super(GUIComponent).MenuStateChange(NewState);	// Skip the Multicomp's state change
00159	}
00160	
00161	event SetFocus(GUIComponent Who)
00162	{
00163		if (Who==None)
00164			return;
00165	
00166		Super.SetFocus(Who);
00167	}
00168	
00169	event HandleParameters(string Param1, string Param2);	// Should be subclassed
00170	
00171	
00172	// if subclassed, this parent function must always be called first
00173	function string GetPageParameters()
00174	{
00175	    return string(Class);
00176	}
00177	
00178	// if GetPageParameters() is subclassed, you'd better have this one too !
00179	function SetPageParameters(string PageParameters)
00180	{
00181	    log("SetPageParameters("$PageParameters$") called for "$self);
00182	}
00183	
00184	
00185	
00186	
00187	defaultproperties
00188	{
00189	     BackgroundColor=(B=255,G=255,R=255,A=255)
00190	     InactiveFadeColor=(B=128,G=128,R=128,A=255)
00191	     BackgroundRStyle=MSTY_Normal
00192	     bRequire640x480=True
00193	     bHidePreviousPage=True
00194	     bDoStoreInSaveMenuStack=True
00195	     bAcceptsInput=True
00196	}

End Source Code