UBrowser
Class UBrowserMainWindow

source: e:\games\UnrealTournament\UBrowser\Classes\UBrowserMainWindow.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowFramedWindow
            |
            +--UBrowser.UBrowserMainWindow
Direct Known Subclasses:UTBrowserMainWindow

class UBrowserMainWindow
extends UWindow.UWindowFramedWindow

//============================================================================= // UBrowserMainWindow - The main window //=============================================================================
Variables
 UBrowserBannerBar BannerWindow
 string StatusBarDefaultText
 string WindowTitleString
 bool bStandaloneBrowser


Function Summary
 void BeforePaint(Canvas C, float X, float Y)
 void BeginPlay()
 void Close(optional bool)
 void Created()
 void DefaultStatusBarText(string Text)
 void OpenURL(string URL)
 void ResolutionChanged(float W, float H)
 void SelectInternet()
 void SelectLAN()
 void SetSizePos()
 void ShowOpenWindow()
     
// External entry points
 void WindowShown()



Source Code


00001	//=============================================================================
00002	// UBrowserMainWindow - The main window
00003	//=============================================================================
00004	class UBrowserMainWindow extends UWindowFramedWindow;
00005	
00006	var UBrowserBannerBar			BannerWindow;
00007	var string						StatusBarDefaultText;
00008	var bool						bStandaloneBrowser;
00009	var localized string			WindowTitleString;
00010	
00011	function DefaultStatusBarText(string Text)
00012	{
00013		StatusBarDefaultText = Text;
00014		StatusBarText = Text;
00015	}
00016	
00017	function BeginPlay()
00018	{
00019		Super.BeginPlay();
00020	
00021		WindowTitle = WindowTitleString;
00022		ClientClass = class'UBrowserMainClientWindow';
00023	}
00024	
00025	function WindowShown()
00026	{
00027		Super.WindowShown();
00028		if(WinLeft < 0 || WinTop < 16 || WinLeft + WinWidth > Root.WinWidth || WinTop + WinHeight > Root.WinHeight)
00029			SetSizePos();
00030	}
00031	
00032	function Created()
00033	{
00034		bSizable = True;
00035		bStatusBar = True;
00036	
00037		Super.Created();
00038	
00039		MinWinWidth = 300;
00040	
00041		SetSizePos();
00042	}
00043	
00044	function BeforePaint(Canvas C, float X, float Y)
00045	{
00046		if(StatusBarText == "")
00047			StatusBarText = StatusBarDefaultText;
00048	
00049		Super.BeforePaint(C, X, Y);
00050	}
00051	
00052	function Close(optional bool bByParent) 
00053	{
00054		if(bStandaloneBrowser)
00055			Root.Console.CloseUWindow();
00056		else
00057			Super.Close(bByParent);
00058	}
00059	
00060	function ResolutionChanged(float W, float H)
00061	{
00062		SetSizePos();
00063		Super.ResolutionChanged(W, H);
00064	}
00065	
00066	function SetSizePos()
00067	{
00068		if(Root.WinHeight < 400)
00069			SetSize(Min(620, Root.WinWidth - 10), Root.WinHeight-32);
00070		else
00071			SetSize(Min(620, Root.WinWidth - 10), Root.WinHeight-50);
00072	
00073		WinLeft = Int((Root.WinWidth - WinWidth) / 2);
00074		WinTop = Int((Root.WinHeight - WinHeight) / 2);
00075	
00076		MinWinHeight = Min(300, WinHeight - 20);
00077	}
00078	
00079	// External entry points
00080	function ShowOpenWindow()
00081	{
00082		local UBrowserOpenWindow W;
00083	
00084		W = UBrowserOpenWindow(Root.CreateWindow(class'UBrowserOpenWindow', 300, 80, 100, 100, Self, True));
00085		ShowModal(W);	
00086	}
00087	
00088	function OpenURL(string URL)
00089	{
00090		if( Left(URL, 7) ~= "http://" )
00091			GetPlayerOwner().ConsoleCommand("start "$URL);
00092		else
00093		if( Left(URL, 9) ~= "unreal://" )
00094			GetPlayerOwner().ClientTravel(URL, TRAVEL_Absolute, false);
00095		else
00096			GetPlayerOwner().ClientTravel("unreal://"$URL, TRAVEL_Absolute, false);
00097	
00098		Close();
00099		Root.Console.CloseUWindow();
00100	}
00101	
00102	function SelectInternet()
00103	{
00104		UBrowserMainClientWindow(ClientArea).SelectInternet();
00105	}
00106	
00107	function SelectLAN()
00108	{
00109		UBrowserMainClientWindow(ClientArea).SelectLAN();
00110	}
00111	
00112	defaultproperties
00113	{
00114	     WindowTitleString="Unreal Server Browser"
00115	}

End Source Code