UWindow
Class UWindowWindow

source: c:\runehov\UWindow\Classes\UWindowWindow.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
Direct Known Subclasses:RuneMenuStatusBar, UBrowserBannerAd, UBrowserBannerBar, UWindowBitmap, UWindowClientWindow, UWindowControlFrame, UWindowDialogControl, UWindowFramedWindow, UWindowGrid, UWindowGridClient, UWindowGridColumn, UWindowHScrollBar, UWindowHSplitter, UWindowMessageBoxArea, UWindowProgressBar, UWindowRootWindow, UWindowTabControlTabArea, UWindowVScrollBar, UWindowVSplitter

class UWindowWindow
extends UWindow.UWindowBase

//============================================================================= // UWindowWindow - the parent class for all Window objects //=============================================================================
Variables
 UWindowWindow ActiveWindow
           The child of ours which is currently active
 float ClickTime
           Does this window accept hotkeys?
 float ClickX
           Does this window accept hotkeys?
 float ClickY
           Does this window accept hotkeys?
 Region ClippingRegion
           RUNE: Alpha Channel
 MouseCursor Cursor
           RUNE: Alpha Channel
 UWindowWindow FirstChildWindow
           First child window - bottom window first
 UWindowWindow LastChildWindow
           Last child window - WinTop window first
 UWindowLookAndFeel LookAndFeel
           RUNE: Alpha Channel
 float MClickTime
           Does this window accept hotkeys?
 float MClickX
           Does this window accept hotkeys?
 float MClickY
           Does this window accept hotkeys?
 UWindowWindow ModalWindow
           Some window we've opened modally.
 UWindowWindow NextSiblingWindow
           sibling window - next window above us
 UWindowWindow OwnerWindow
           Some arbitary owner window
 UWindowWindow ParentWindow
           Parent window
 UWindowWindow PrevSiblingWindow
           previous sibling window - next window below us
 float RClickTime
           Does this window accept hotkeys?
 float RClickX
           Does this window accept hotkeys?
 float RClickY
           Does this window accept hotkeys?
 UWindowRootWindow Root
           The root window
 float WinHeight
 float WinLeft
 float WinTop
 float WinWidth
 float WindowAlpha
           RUNE: Alpha Channel
 bool bAcceptsFocus
           Accepts key messages
 bool bAcceptsHotKeys
           Does this window accept hotkeys?
 bool bAlwaysBehind
           Window doesn't bring to front on click.
 bool bAlwaysOnTop
           Always on top
 bool bIgnoreLDoubleClick
           Does this window accept hotkeys?
 bool bIgnoreMDoubleClick
           Does this window accept hotkeys?
 bool bIgnoreRDoubleClick
           Does this window accept hotkeys?
 bool bLeaveOnscreen
           Window is left onscreen when UWindow isn't active.
 bool bMMouseDown
           Pressed down in this window?
 bool bMouseDown
           Pressed down in this window?
 bool bNoClip
           Clipping disabled for this window?
 bool bRMouseDown
           Pressed down in this window?
 bool bTransient
           Never the active window. Used for combo dropdowns7
 bool bUWindowActive
           Is UWindow active?
 bool bWindowVisible
           Some window we've opened modally.


Function Summary
 void ActivateWindow(int Depth, bool bTransientNoDeactivate)
 void Activated()
 void AfterCreate()
 void AfterPaint(Canvas C, float X, float Y)
 void BeforeCreate()
 void BeforePaint(Canvas C, float X, float Y)
 void BeginPlay()
 void BringToFront()
 void CancelAcceptsFocus()
 UWindowWindow CheckKeyFocusWindow()
 bool CheckMousePassThrough(float X, float Y)
     
// Should mouse events at these co-ordinates be passed through to underlying windows?
 void Click(float X, float Y)
 void ClipText(Canvas C, float X, float Y, string S, optional bool)
 void ClipTextWidth(Canvas C, float X, float Y, string S, float W)
 void Close(optional bool)
 void Created()
 void Deactivated()
 void DoTick(float Delta)
 void DoubleClick(float X, float Y)
 void DrawClippedActor(Canvas C, float X, float Y, Actor A, bool WireFrame, rotator RotOffset, vector LocOffset)
 void DrawClippedTexture(Canvas C, float X, float Y, Texture Tex)
 void DrawHorizTiledPieces(Canvas C, float DestX, float DestY, float DestW, float DestH, TexRegion T1, TexRegion T2, TexRegion T3, TexRegion T4, TexRegion T5, float Scale)
 void DrawMiscBevel(Canvas C, float X, float Y, float W, float H, Texture T, int BevelType)
 void DrawStretchedTexture(Canvas C, float X, float Y, float W, float H, Texture Tex)
 void DrawStretchedTextureSegment(Canvas C, float X, float Y, float W, float H, float tX, float tY, float tW, float tH, Texture Tex)
 void DrawUpBevel(Canvas C, float X, float Y, float W, float H, Texture T)
 void DrawVertTiledPieces(Canvas C, float DestX, float DestY, float DestW, float DestH, TexRegion T1, TexRegion T2, TexRegion T3, TexRegion T4, TexRegion T5, float Scale)
 void EscClose()
 UWindowWindow FindWindowUnder(float X, float Y)
 void FocusOtherWindow(UWindowWindow W)
 void FocusWindow()
 void GetDesiredDimensions(out float, out float)
 LevelInfo GetEntryLevel()
 LevelInfo GetLevel()
 Texture GetLookAndFeelTexture()
 void GetMouseXY(out float, out float)
 PlayerPawn GetPlayerOwner()
 void GlobalToWindow(float GlobalX, float GlobalY, out float, out float)
 void HideChildWindow(UWindowWindow Child)
 void HideWindow()
 bool HotKeyDown(int Key, float X, float Y)
 bool HotKeyUp(int Key, float X, float Y)
 bool IsActive()
 void KeyDown(int Key, float X, float Y)
 void KeyFocusEnter()
 void KeyFocusExit()
 void KeyType(int Key, float X, float Y)
 void KeyUp(int Key, float X, float Y)
 void LMouseDown(float X, float Y)
 void LMouseUp(float X, float Y)
 void MClick(float X, float Y)
 void MDoubleClick(float X, float Y)
 void MMouseDown(float X, float Y)
 void MMouseUp(float X, float Y)
 UWindowMessageBox MessageBox(string Title, string Message, MessageBoxButtons Buttons, MessageBoxResult ESCResult, optional MessageBoxResult, optional int)
 void MessageBoxDone(UWindowMessageBox W, MessageBoxResult Result)
 bool MessageClients(WinMessage Msg, Canvas C, float X, float Y, int Key)
 void MouseEnter()
 bool MouseIsOver()
 void MouseLeave()
 void MouseMove(float X, float Y)
 void NotifyAfterLevelChange()
 void NotifyBeforeLevelChange()
 void NotifyQuitUnreal()
 void Paint(Canvas C, float X, float Y)
 void PaintClients(Canvas C, float X, float Y)
 byte ParseAmpersand(string S, out string, out string, bool bCalcUnderline)
 void ProcessMenuKey(int Key, string KeyName)
 bool PropagateKey(WinMessage Msg, Canvas C, float X, float Y, int Key)
 void RClick(float X, float Y)
 void RDoubleClick(float X, float Y)
 void RMouseDown(float X, float Y)
 void RMouseUp(float X, float Y)
 string RemoveAmpersand(string S)
 void ReplaceText(out string, string Replace, string With)
 void Resized()
 void ResolutionChanged(float W, float H)
 void SaveConfigs()
 void SendToBack()
 void SetAcceptsFocus()
 void SetAcceptsHotKeys(bool bNewAccpetsHotKeys)
 void SetCursor(MouseCursor C)
 void SetMouseWindow()
     
// Sets mouse window for mouse capture.
 void SetParent(UWindowWindow NewParent)
 void SetSize(float W, float H)
 void ShowChildWindow(UWindowWindow Child, optional bool)
 void ShowModal(UWindowWindow W)
 void ShowWindow()
 void StripCRLF(out string)
 void TextSize(Canvas C, string Text, out float, out float)
 void Tick(float Delta)
 void Tile(Canvas C, Texture T)
 void ToolTip(string strTip)
 bool WaitModal()
 void WindowEvent(WinMessage Msg, Canvas C, float X, float Y, int Key)
     
// Ideally Key would be a EInputKey but I can't see that class here.
 void WindowHidden()
 bool WindowIsVisible()
 void WindowShown()
 void WindowToGlobal(float WinX, float WinY, out float, out float)
 int WrapClipText(Canvas C, float X, float Y, string S, optional bool, optional int, optional int, optional bool)



Source Code


00001	//=============================================================================
00002	// UWindowWindow - the parent class for all Window objects
00003	//=============================================================================
00004	class UWindowWindow extends UWindowBase;
00005	
00006	#exec TEXTURE IMPORT NAME=BlackTexture FILE=TEXTURES\Black.PCX
00007	#exec TEXTURE IMPORT NAME=WhiteTexture FILE=TEXTURES\White.PCX
00008	
00009	// Dimensions, offset relative to parent.
00010	var float				WinLeft;
00011	var float				WinTop;
00012	var float				WinWidth;
00013	var float				WinHeight;
00014	
00015	// Relationships to other windows
00016	var UWindowWindow		ParentWindow;			// Parent window
00017	var UWindowWindow		FirstChildWindow;		// First child window - bottom window first
00018	var UWindowWindow		LastChildWindow;		// Last child window - WinTop window first
00019	var UWindowWindow		NextSiblingWindow;		// sibling window - next window above us
00020	var UWindowWindow		PrevSiblingWindow;		// previous sibling window - next window below us
00021	var UWindowWindow		ActiveWindow;			// The child of ours which is currently active
00022	var UWindowRootWindow	Root;					// The root window
00023	var UWindowWindow		OwnerWindow;			// Some arbitary owner window
00024	var UWindowWindow		ModalWindow;			// Some window we've opened modally.
00025	
00026	var bool				bWindowVisible;
00027	var bool				bNoClip;				// Clipping disabled for this window?
00028	var bool				bMouseDown;				// Pressed down in this window?
00029	var bool				bRMouseDown;			// Pressed down in this window?
00030	var bool				bMMouseDown;			// Pressed down in this window?
00031	var bool				bAlwaysBehind;			// Window doesn't bring to front on click.
00032	var bool				bAcceptsFocus;			// Accepts key messages
00033	var bool				bAlwaysOnTop;			// Always on top
00034	var bool				bLeaveOnscreen;			// Window is left onscreen when UWindow isn't active.
00035	var bool				bUWindowActive;			// Is UWindow active?
00036	var bool				bTransient;				// Never the active window. Used for combo dropdowns7
00037	var bool				bAcceptsHotKeys;		// Does this window accept hotkeys?
00038	var bool				bIgnoreLDoubleClick;
00039	var bool				bIgnoreMDoubleClick;
00040	var bool				bIgnoreRDoubleClick;
00041	
00042	var float				ClickTime;
00043	var float				MClickTime;
00044	var float				RClickTime;
00045	var float				ClickX;
00046	var float				ClickY;
00047	var float				MClickX;
00048	var float				MClickY;
00049	var float				RClickX;
00050	var float				RClickY;
00051	
00052	var float				WindowAlpha;			// RUNE: Alpha Channel
00053	
00054	var UWindowLookAndFeel	LookAndFeel;
00055	
00056	var Region	ClippingRegion;
00057	
00058	struct MouseCursor
00059	{
00060		var Texture tex;
00061		var int HotX;
00062		var int HotY;
00063		var byte WindowsCursor;
00064	};
00065	
00066	var MouseCursor Cursor;
00067	
00068	enum WinMessage
00069	{
00070		WM_LMouseDown,
00071		WM_LMouseUp,
00072		WM_MMouseDown,
00073		WM_MMouseUp,
00074		WM_RMouseDown,
00075		WM_RMouseUp,
00076		WM_KeyUp,
00077		WM_KeyDown,
00078		WM_KeyType,
00079		WM_Paint	// Window needs painting
00080	};
00081	
00082	// Dialog messages
00083	const DE_Created = 0;
00084	const DE_Change	 = 1;
00085	const DE_Click	 = 2;
00086	const DE_Enter	 = 3;
00087	const DE_Exit	 = 4;
00088	const DE_MClick	 = 5;
00089	const DE_RClick	 = 6;
00090	const DE_EnterPressed = 7;
00091	const DE_MouseMove = 8;
00092	const DE_MouseLeave = 9;
00093	const DE_LMouseDown = 10;
00094	const DE_DoubleClick = 11;
00095	const DE_MouseEnter = 12;
00096	const DE_HelpChanged = 13;
00097	const DE_WheelUpPressed = 14;
00098	const DE_WheelDownPressed = 15;
00099	
00100	// Ideally Key would be a EInputKey but I can't see that class here.
00101	function WindowEvent(WinMessage Msg, Canvas C, float X, float Y, int Key) 
00102	{
00103		switch(Msg)
00104		{
00105		case WM_Paint:
00106			Paint(C, X, Y);
00107			PaintClients(C, X, Y);
00108			break;
00109		case WM_LMouseDown:
00110			if(!Root.CheckCaptureMouseDown())
00111			{
00112				if(!MessageClients(Msg, C, X, Y, Key)) 
00113					LMouseDown(X, Y);
00114			}
00115			break;	
00116		case WM_LMouseUp:
00117			if(!Root.CheckCaptureMouseUp())
00118			{
00119				if(!MessageClients(Msg, C, X, Y, Key))
00120					LMouseUp(X, Y);
00121			}
00122			break;	
00123		case WM_RMouseDown:
00124			if(!MessageClients(Msg, C, X, Y, Key)) RMouseDown(X, Y);
00125			break;	
00126		case WM_RMouseUp:
00127			if(!MessageClients(Msg, C, X, Y, Key)) RMouseUp(X, Y);
00128			break;	
00129		case WM_MMouseDown:
00130			if(!MessageClients(Msg, C, X, Y, Key)) MMouseDown(X, Y);
00131			break;	
00132		case WM_MMouseUp:
00133			if(!MessageClients(Msg, C, X, Y, Key)) MMouseUp(X, Y);
00134			break;	
00135		case WM_KeyDown:
00136	//log(name@"WindowEvent propagating  :"$Name@"Msg="$Msg@"Key="$Key);
00137			if(!PropagateKey(Msg, C, X, Y, Key))
00138			{
00139	//log(name@"**WindowEvent propagated to:"$Name@Msg@"Key="$Key);
00140				KeyDown(Key, X, Y);
00141			}
00142			break;	
00143		case WM_KeyUp:
00144			if(!PropagateKey(Msg, C, X, Y, Key))
00145				KeyUp(Key, X, Y);
00146			break;	
00147		case WM_KeyType:
00148			if(!PropagateKey(Msg, C, X, Y, Key))
00149				KeyType(Key, X, Y);
00150			break;	
00151		default:
00152			break;
00153		}
00154	}
00155	
00156	function SaveConfigs()
00157	{
00158	
00159		// Implemented in a child class
00160	}
00161	
00162	final function PlayerPawn GetPlayerOwner()
00163	{
00164		return Root.Console.ViewPort.Actor;
00165	}
00166	
00167	final function LevelInfo GetLevel()
00168	{
00169		return Root.Console.ViewPort.Actor.Level;
00170	}
00171	
00172	final function LevelInfo GetEntryLevel()
00173	{
00174		return Root.Console.ViewPort.Actor.GetEntryLevel();
00175	}
00176	
00177	function Resized()
00178	{
00179		// Implemented in a child class
00180	}
00181	
00182	function BeforePaint(Canvas C, float X, float Y)
00183	{
00184		// Implemented in a child class
00185	}
00186	
00187	function AfterPaint(Canvas C, float X, float Y)
00188	{
00189		// Implemented in a child class
00190	}
00191	
00192	function Paint(Canvas C, float X, float Y)
00193	{
00194		// Implemented in a child class
00195	}
00196	
00197	function Click(float X, float Y)
00198	{
00199		// Implemented in a child class
00200	}
00201	
00202	
00203	function MClick(float X, float Y)
00204	{
00205		// Implemented in a child class
00206	}
00207	
00208	function RClick(float X, float Y)
00209	{
00210		// Implemented in a child class
00211	}
00212	
00213	function DoubleClick(float X, float Y)
00214	{
00215		// Implemented in a child class
00216	}
00217	
00218	function MDoubleClick(float X, float Y)
00219	{
00220		// Implemented in a child class
00221	}
00222	
00223	function RDoubleClick(float X, float Y)
00224	{
00225		// Implemented in a child class
00226	}
00227	
00228	function BeginPlay()
00229	{
00230		// Implemented in a child class
00231	}
00232	
00233	function BeforeCreate()
00234	{
00235		// Implemented in a child class
00236	}
00237	
00238	function Created()
00239	{
00240		// Implemented in a child class
00241	}
00242	
00243	function AfterCreate()
00244	{
00245		// Implemented in a child class
00246	}
00247	
00248	function MouseEnter()
00249	{
00250		// Implemented in a child class
00251	}
00252	
00253	function Activated()
00254	{
00255		// Implemented in a child class
00256	}
00257	
00258	function Deactivated()
00259	{
00260		// Implemented in a child class
00261	}
00262	
00263	function MouseLeave()
00264	{
00265		bMouseDown = False;
00266		bMMouseDown = False;
00267		bRMouseDown = False;
00268	}
00269	
00270	function MouseMove(float X, float Y)
00271	{
00272	}
00273	
00274	function KeyUp(int Key, float X, float Y)
00275	{
00276		// Implemented in child class
00277	}
00278	
00279	function KeyDown(int Key, float X, float Y)
00280	{
00281		// Implemented in child class
00282	}
00283	
00284	function bool HotKeyDown(int Key, float X, float Y)
00285	{
00286		// Implemented in child class
00287		//Log("UWindowWindow: Checking HotKeyDown for "$Self);
00288		return False;
00289	}
00290	
00291	function bool HotKeyUp(int Key, float X, float Y)
00292	{
00293		// Implemented in child class
00294		//Log("UWindowWindow: Checking HotKeyUp for "$Self);
00295		return False;
00296	}
00297	
00298	function KeyType(int Key, float X, float Y)
00299	{
00300		// Implemented in child class
00301	}
00302	
00303	function ProcessMenuKey(int Key, string KeyName)
00304	{
00305		// Implemented in child class
00306	}
00307	
00308	function KeyFocusEnter()
00309	{
00310		// Implemented in child class
00311	}
00312	
00313	function KeyFocusExit()
00314	{
00315		// Implemented in child class
00316	}
00317	
00318	
00319	function RMouseDown(float X, float Y) 
00320	{
00321		ActivateWindow(0, False);
00322		bRMouseDown = True;
00323	}
00324	
00325	function RMouseUp(float X, float Y) 
00326	{
00327		if(bRMouseDown)
00328		{
00329			if(!bIgnoreRDoubleClick && Abs(X-RClickX) <= 1 && Abs(Y-RClickY) <= 1 && GetLevel().TimeSeconds < RClickTime + 0.600)
00330			{
00331				RDoubleClick(X, Y);
00332				RClickTime = 0;
00333			}
00334			else
00335			{
00336				RClickTime = GetLevel().TimeSeconds;
00337				RClickX = X;
00338				RClickY = Y;
00339				RClick(X, Y);
00340			}
00341		}
00342		bRMouseDown = False;
00343	
00344	}
00345	
00346	function MMouseDown(float X, float Y) 
00347	{
00348		ActivateWindow(0, False);
00349		/* DEBUG
00350		HideWindow();
00351		*/
00352		bMMouseDown = True;
00353	}
00354	
00355	function MMouseUp(float X, float Y) 
00356	{
00357		if(bMMouseDown)
00358		{
00359			if(!bIgnoreMDoubleClick && Abs(X-MClickX) <= 1 && (Y-MClickY)<=1 && GetLevel().TimeSeconds < MClickTime + 0.600)
00360			{
00361				MDoubleClick(X, Y);
00362				MClickTime = 0;
00363			}
00364			else
00365			{
00366				MClickTime = GetLevel().TimeSeconds;
00367				MClickX = X;
00368				MClickY = Y;
00369				MClick(X, Y);
00370			}
00371		}
00372		bMMouseDown = False;
00373	}
00374	
00375	
00376	function LMouseDown(float X, float Y)
00377	{
00378		ActivateWindow(0, False);
00379		bMouseDown = True;
00380	}
00381	
00382	function LMouseUp(float X, float Y)
00383	{
00384		if(bMouseDown)
00385		{
00386			if(!bIgnoreLDoubleClick && Abs(X-ClickX) <= 1 && (Y-ClickY) <= 1 && GetLevel().TimeSeconds < ClickTime + 0.600)
00387			{
00388				DoubleClick(X, Y);
00389				ClickTime = 0;
00390			}
00391			else
00392			{
00393				ClickTime = GetLevel().TimeSeconds;
00394				ClickX = X;
00395				ClickY = Y;
00396				Click(X, Y);
00397			}
00398		}
00399		bMouseDown = False;
00400	}
00401	
00402	function FocusWindow()
00403	{
00404		if(Root.FocusedWindow != None && Root.FocusedWindow != Self)
00405			Root.FocusedWindow.FocusOtherWindow(Self);
00406	
00407		Root.FocusedWindow = Self;
00408	}
00409	
00410	function FocusOtherWindow(UWindowWindow W)
00411	{
00412	}
00413	
00414	function EscClose()
00415	{
00416		Close();
00417	}
00418	
00419	function Close(optional bool bByParent)
00420	{
00421		local UWindowWindow Prev, Child;
00422	
00423		for(Child = LastChildWindow;Child != None;Child = Prev)
00424		{
00425			Prev = Child.PrevSiblingWindow;
00426			Child.Close(True);
00427		}
00428		SaveConfigs();
00429		if(!bByParent)
00430			HideWindow();
00431	}
00432	
00433	final function SetSize(float W, float H)
00434	{
00435		if(WinWidth != W || WinHeight != H)
00436		{
00437			WinWidth = W;
00438			WinHeight = H;
00439			Resized();
00440		}
00441	}
00442	
00443	function Tick(float Delta)
00444	{
00445	}
00446	
00447	final function DoTick(float Delta)
00448	{
00449		local UWindowWindow Child;
00450	
00451		Tick(Delta);
00452	
00453		Child = FirstChildWindow;
00454	
00455		while(Child != None)
00456		{
00457			Child.bUWindowActive = bUWindowActive;
00458	
00459			if(bLeaveOnScreen)
00460				Child.bLeaveOnscreen = True;
00461	
00462			if(bUWindowActive || Child.bLeaveOnscreen)
00463			{
00464				Child.DoTick(Delta);
00465			}
00466	
00467			Child = Child.NextSiblingWindow;
00468		}
00469	}
00470	
00471	final function PaintClients(Canvas C, float X, float Y)
00472	{
00473		local float   OrgX, OrgY;   
00474		local float   ClipX, ClipY; 
00475		local UWindowWindow Child;
00476	
00477		OrgX = C.OrgX;
00478		OrgY = C.OrgY;
00479		ClipX = C.ClipX;
00480		ClipY = C.ClipY;
00481	
00482		Child = FirstChildWindow;
00483	
00484		while(Child != None)
00485		{
00486			Child.bUWindowActive = bUWindowActive;
00487	
00488			C.SetPos(0,0);
00489			C.SpaceX = 0;
00490			C.SpaceY = 0;
00491			C.DrawColor.R = 255;
00492			C.DrawColor.G = 255;
00493			C.DrawColor.B = 255;
00494			if (Child.WindowAlpha != 1.0 || Root.Console.MenuTranslucency != 1.0)
00495			{
00496				C.Style = GetPlayerOwner().ERenderStyle.STY_AlphaBlend;
00497				C.AlphaScale = Child.WindowAlpha*Root.Console.MenuTranslucency;
00498			}
00499			else
00500			{
00501				C.Style = GetPlayerOwner().ERenderStyle.STY_Normal;
00502				C.AlphaScale = 1.0;
00503			}
00504	
00505			Child.BeforePaint(C, X - Child.WinLeft, Y - Child.WinTop);
00506	
00507			if(bLeaveOnScreen)
00508				Child.bLeaveOnscreen = True;
00509	
00510			if(bUWindowActive || Child.bLeaveOnscreen)
00511			{
00512	
00513				C.OrgX = C.OrgX + Child.WinLeft*Root.GUIScale;
00514				C.OrgY = C.OrgY + Child.WinTop*Root.GUIScale;
00515	
00516				if(!Child.bNoClip)
00517				{
00518					C.ClipX = FMin(WinWidth - Child.WinLeft, Child.WinWidth)*Root.GUIScale;
00519					C.ClipY = FMin(WinHeight - Child.WinTop, Child.WinHeight)*Root.GUIScale;
00520	
00521	
00522					// Translate to child's co-ordinate system
00523					Child.ClippingRegion.X = ClippingRegion.X - Child.WinLeft;
00524					Child.ClippingRegion.Y = ClippingRegion.Y - Child.WinTop;
00525					Child.ClippingRegion.W = ClippingRegion.W;
00526					Child.ClippingRegion.H = ClippingRegion.H;
00527	
00528					if(Child.ClippingRegion.X < 0)
00529					{
00530						Child.ClippingRegion.W += Child.ClippingRegion.X;
00531						Child.ClippingRegion.X = 0;
00532					}
00533	
00534					if(Child.ClippingRegion.Y < 0)
00535					{
00536						Child.ClippingRegion.H += Child.ClippingRegion.Y;
00537						Child.ClippingRegion.Y = 0;
00538					}
00539	
00540					if(Child.ClippingRegion.W > Child.WinWidth - Child.ClippingRegion.X)
00541					{
00542						Child.ClippingRegion.W = Child.WinWidth - Child.ClippingRegion.X;
00543					}
00544	
00545					if(Child.ClippingRegion.H > Child.WinHeight - Child.ClippingRegion.Y)
00546					{
00547						Child.ClippingRegion.H = Child.WinHeight - Child.ClippingRegion.Y;
00548					}
00549				}
00550	
00551				if(Child.ClippingRegion.W > 0 && Child.ClippingRegion.H > 0) 
00552				{		
00553					Child.WindowEvent(WM_Paint, C, X - Child.WinLeft, Y - Child.WinTop, 0);
00554					Child.AfterPaint(C, X - Child.WinLeft, Y - Child.WinTop);
00555				}
00556		
00557				C.OrgX = OrgX;
00558				C.OrgY = OrgY;
00559			}
00560	
00561			Child = Child.NextSiblingWindow;
00562		}
00563	
00564		C.ClipX = ClipX;
00565		C.ClipY = ClipY;
00566	}
00567	
00568	final function UWindowWindow FindWindowUnder(float X, float Y)
00569	{
00570		local UWindowWindow Child;
00571	
00572		// go from Topmost downwards
00573		Child = LastChildWindow;
00574	
00575		while(Child != None)
00576		{
00577			Child.bUWindowActive = bUWindowActive;
00578	
00579			if(bLeaveOnScreen)
00580				Child.bLeaveOnscreen = True;
00581	
00582			if(bUWindowActive || Child.bLeaveOnscreen)
00583			{
00584				if((X >= Child.WinLeft) && (X <= Child.WinLeft+Child.WinWidth) &&
00585				   (Y >= Child.WinTop) && (Y <= Child.WinTop+Child.WinHeight) &&
00586				   (!Child.CheckMousePassThrough(X-Child.WinLeft, Y-Child.WinTop)))
00587				{
00588					return Child.FindWindowUnder(X - Child.WinLeft, Y - Child.WinTop);
00589				}
00590			}
00591		
00592			Child = Child.PrevSiblingWindow;
00593		}
00594	
00595		// Doesn't correspond to any children - it's us.
00596		return Self;
00597	}
00598	
00599	final function bool PropagateKey(WinMessage Msg, Canvas C, float X, float Y, int Key)
00600	{
00601		local UWindowWindow Child;
00602	
00603		// Check from WinTopmost for windows which accept focus
00604		Child = LastChildWindow;
00605	
00606		// HACK for always on top windows...need a better solution
00607		if(ActiveWindow != None && Child != ActiveWindow && !Child.bTransient)
00608			Child = ActiveWindow;
00609	
00610	//log(name@"propogatekey for msg:"$Msg);
00611	
00612		while(Child != None)
00613		{
00614			Child.bUWindowActive = bUWindowActive;
00615	
00616			if(bLeaveOnScreen)
00617				Child.bLeaveOnscreen = True;
00618	
00619	//log("   child="$Child@"Active="$bUWindowActive@"LeaveOnScreen="$Child.bLeaveOnscreen@"AcceptsFocus="$Child.bAcceptsFocus);
00620	
00621			if((bUWindowActive || Child.bLeaveOnscreen) && Child.bAcceptsFocus)
00622			{
00623				//Log("    Sending keystrokes to:  "$Child);
00624				Child.WindowEvent(Msg, C, X - Child.WinLeft, Y - Child.WinTop, Key);
00625				return True;		
00626			}
00627			else
00628			{
00629				//Log("    Ignoring child:  "$Child);
00630			}
00631			Child = Child.PrevSiblingWindow;
00632		}
00633	
00634		return False;
00635	}
00636	
00637	final function UWindowWindow CheckKeyFocusWindow()
00638	{
00639		local UWindowWindow Child;
00640	
00641		// Check from WinTopmost for windows which accept key focus
00642		Child = LastChildWindow;
00643	
00644		if(ActiveWindow != None && Child != ActiveWindow && !Child.bTransient)
00645			Child = ActiveWindow;
00646	
00647		while(Child != None)
00648		{
00649			Child.bUWindowActive = bUWindowActive;
00650	
00651			if(bLeaveOnScreen)
00652				Child.bLeaveOnscreen = True;
00653	
00654			if(bUWindowActive || Child.bLeaveOnscreen)
00655			{
00656				if(Child.bAcceptsFocus)
00657				{
00658					return Child.CheckKeyFocusWindow();
00659				}
00660			}
00661			Child = Child.PrevSiblingWindow;
00662		}
00663	
00664		return Self;
00665	}
00666	
00667	final function bool MessageClients(WinMessage Msg, Canvas C, float X, float Y, int Key)
00668	{
00669		local UWindowWindow Child;
00670	
00671		// go from topmost downwards
00672		Child = LastChildWindow;
00673	
00674		while(Child != None)
00675		{
00676			Child.bUWindowActive = bUWindowActive;
00677	
00678			if(bLeaveOnScreen)
00679				Child.bLeaveOnscreen = True;
00680	
00681			if(bUWindowActive || Child.bLeaveOnscreen)
00682			{
00683				if((X >= Child.WinLeft) && (X <= Child.WinLeft+Child.WinWidth) &&
00684				   (Y >= Child.WinTop) && (Y <= Child.WinTop+Child.WinHeight)  &&
00685				   (!Child.CheckMousePassThrough(X-Child.WinLeft, Y-Child.WinTop))) 
00686				{
00687					Child.WindowEvent(Msg, C, X - Child.WinLeft, Y - Child.WinTop, Key);
00688					return True;
00689				}
00690			}
00691		
00692			Child = Child.PrevSiblingWindow;
00693		}
00694	
00695		return False;
00696	}
00697	
00698	final function ActivateWindow(int Depth, bool bTransientNoDeactivate)
00699	{
00700		if(Self == Root)
00701		{
00702			if(Depth == 0)
00703				FocusWindow();
00704			return;
00705		}
00706	
00707		if(WaitModal()) return;
00708	
00709		if(!bAlwaysBehind)
00710		{
00711			ParentWindow.HideChildWindow(Self);
00712			ParentWindow.ShowChildWindow(Self);
00713		}
00714		
00715		//Log("Activating Window "$Self);
00716		
00717		if(!(bTransient || bTransientNoDeactivate))
00718		{
00719			if(ParentWindow.ActiveWindow != None && ParentWindow.ActiveWindow != Self)
00720			{
00721				ParentWindow.ActiveWindow.Deactivated();
00722			}
00723	
00724			ParentWindow.ActiveWindow = Self;
00725			ParentWindow.ActivateWindow(Depth + 1, False);
00726	
00727			Activated();
00728		}
00729		else
00730		{
00731			ParentWindow.ActivateWindow(Depth + 1, True);
00732		}
00733	
00734		if(Depth == 0)
00735			FocusWindow();
00736	}
00737	
00738	final function BringToFront()
00739	{
00740		if(Self == Root)
00741			return;
00742	
00743		if(!bAlwaysBehind && !WaitModal())
00744		{
00745			ParentWindow.HideChildWindow(Self);
00746			ParentWindow.ShowChildWindow(Self);
00747		}
00748		ParentWindow.BringToFront();
00749	}
00750	
00751	final function SendToBack()
00752	{
00753		ParentWindow.HideChildWindow(Self);
00754		ParentWindow.ShowChildWindow(Self, True);
00755	}
00756	
00757	final function HideChildWindow(UWindowWindow Child)
00758	{
00759		local UWindowWindow Window;
00760	
00761		if(!Child.bWindowVisible) return;
00762		Child.bWindowVisible = False;
00763	
00764		if(Child.bAcceptsHotKeys)
00765			Root.RemoveHotkeyWindow(Child);
00766	
00767		// Check WinTopmost
00768		if(LastChildWindow == Child) 
00769		{
00770			LastChildWindow = Child.PrevSiblingWindow;
00771			if(LastChildWindow != None)
00772			{
00773				LastChildWindow.NextSiblingWindow = None;
00774			}
00775			else
00776			{
00777				FirstChildWindow = None;
00778			}
00779		} 
00780		else if(FirstChildWindow == Child) // Check bottommost
00781		{ 
00782			FirstChildWindow = Child.NextSiblingWindow;
00783			if(FirstChildWindow != None)
00784			{
00785				FirstChildWindow.PrevSiblingWindow = None;
00786			}
00787			else
00788			{
00789				LastChildWindow = None;
00790			}
00791		} 
00792		else 
00793		{
00794			// you mean I have to go looking for it???
00795			Window = FirstChildWindow;
00796			while(Window != None)
00797			{
00798				if(Window.NextSiblingWindow == Child)
00799				{
00800					Window.NextSiblingWindow = Child.NextSiblingWindow;
00801					Window.NextSiblingWindow.PrevSiblingWindow = Window;
00802					break;
00803				}
00804				Window = Window.NextSiblingWindow;
00805			}
00806		}
00807	
00808		// Set the active window
00809		ActiveWindow = None;
00810		Window = LastChildWindow;
00811		while(Window != None)
00812		{
00813			if(!Window.bAlwaysOnTop)
00814			{
00815				ActiveWindow = Window;
00816				break;
00817			}
00818			Window = Window.PrevSiblingWindow;
00819		}
00820		if(ActiveWindow == None) ActiveWindow = LastChildWindow;
00821	}
00822	
00823	final function SetAcceptsFocus()
00824	{
00825		if(bAcceptsFocus) return;
00826		bAcceptsFocus = True;
00827	
00828		if(Self != Root)
00829			ParentWindow.SetAcceptsFocus();
00830	}
00831	
00832	final function CancelAcceptsFocus()
00833	{
00834		local UWindowWindow Child;
00835	
00836		for(Child = LastChildWindow; Child != None; Child = Child.PrevSiblingWindow)
00837			Child.CancelAcceptsFocus();
00838	
00839		bAcceptsFocus = False;
00840	}
00841	
00842	final function GetMouseXY(out float X, out float Y)
00843	{
00844		local UWindowWindow P;
00845	
00846		X = Int(Root.MouseX);
00847		Y = Int(Root.MouseY);
00848		
00849		P = Self;
00850		while(P != Root)
00851		{		
00852			X = X - P.WinLeft;
00853			Y = Y - P.WinTop;
00854			P = P.ParentWindow;
00855		}
00856	}
00857	
00858	final function GlobalToWindow(float GlobalX, float GlobalY, out float WinX, out float WinY)
00859	{
00860		local UWindowWindow P;
00861	
00862		WinX = GlobalX;
00863		WinY = GlobalY;
00864	
00865		P = Self;
00866		while(P != Root)
00867		{		
00868			WinX -= P.WinLeft;
00869			WinY -= P.WinTop;
00870			P = P.ParentWindow;
00871		}
00872	}
00873	
00874	final function WindowToGlobal(float WinX, float WinY, out float GlobalX, out float GlobalY)
00875	{
00876		local UWindowWindow P;
00877	
00878		GlobalX = WinX;
00879		GlobalY = WinY;
00880	
00881		P = Self;
00882		while(P != Root)
00883		{		
00884			GlobalX += P.WinLeft;
00885			GlobalY += P.WinTop;
00886			P = P.ParentWindow;
00887		}
00888	}
00889	
00890	final function ShowChildWindow(UWindowWindow Child, optional bool bAtBack)
00891	{
00892		local UWindowWindow W;
00893		
00894		if(!Child.bTransient) ActiveWindow = Child;
00895	
00896		if(Child.bWindowVisible) return;
00897		Child.bWindowVisible = True;
00898	
00899		if(Child.bAcceptsHotKeys)
00900			Root.AddHotkeyWindow(Child);
00901	
00902		if(bAtBack)
00903		{
00904			if(FirstChildWindow == None)
00905			{
00906				Child.NextSiblingWindow = None;
00907				Child.PrevSiblingWindow = None;
00908				LastChildWindow = Child;
00909				FirstChildWindow = Child;
00910			}
00911			else
00912			{
00913				FirstChildWindow.PrevSiblingWindow = Child;
00914				Child.NextSiblingWindow = FirstChildWindow;
00915				Child.PrevSiblingWindow = None;
00916				FirstChildWindow = Child;
00917			}
00918		}
00919		else
00920		{
00921			W = LastChildWindow;
00922			while(True) 
00923			{
00924				if((Child.bAlwaysOnTop) || (W == None) || (!W.bAlwaysOnTop))
00925				{
00926					if(W == None)
00927					{	
00928						if(LastChildWindow == None)
00929						{
00930							// We're the only window
00931							Child.NextSiblingWindow = None;
00932							Child.PrevSiblingWindow = None;
00933							LastChildWindow = Child;
00934							FirstChildWindow = Child;
00935						}
00936						else
00937						{
00938							// We feel off the end of the list, we're the bottom (first) child window.
00939							Child.NextSiblingWindow = FirstChildWindow;
00940							Child.PrevSiblingWindow = None;
00941							FirstChildWindow.PrevSiblingWindow = Child;
00942							FirstChildWindow = Child;
00943						}
00944					}
00945					else
00946					{
00947						// We're either the new topmost (last) or we need to be inserted in the list.
00948	
00949						Child.NextSiblingWindow = W.NextSiblingWindow;
00950						Child.PrevSiblingWindow = W;
00951						if(W.NextSiblingWindow != None)
00952						{
00953							W.NextSiblingWindow.PrevSiblingWindow = Child;
00954						}
00955						else
00956						{
00957							LastChildWindow = Child;
00958						}
00959						W.NextSiblingWindow = Child;
00960					}
00961					
00962					// We're done.
00963					break;
00964				}
00965				
00966				W = W.PrevSiblingWindow;
00967			}
00968		}
00969	}
00970	
00971	function ShowWindow()
00972	{
00973		ParentWindow.ShowChildWindow(Self);
00974		WindowShown();
00975	}
00976	
00977	function HideWindow()
00978	{
00979		WindowHidden();
00980		ParentWindow.HideChildWindow(Self);
00981	}
00982	
00983	final function UWindowWindow CreateWindow(class<UWindowWindow> WndClass, float X, float Y, float W, float H, optional UWindowWindow OwnerW, optional bool bUnique, optional name ObjectName)
00984	{
00985		local UWindowWindow Child;
00986	
00987		if(bUnique)
00988		{
00989			Child = Root.FindChildWindow(WndClass, True);
00990	
00991			if(Child != None)
00992			{
00993				Child.ShowWindow();
00994				Child.BringToFront();
00995				return Child;
00996			}
00997		}
00998	
00999		if(ObjectName != '')
01000			Child = New(None, ObjectName) WndClass;
01001		else
01002			Child = New(None) WndClass;
01003	
01004		Child.BeginPlay();
01005		Child.WinTop = Y;
01006		Child.WinLeft = X;
01007		Child.WinWidth = W;
01008		Child.WinHeight = H;
01009		Child.Root = Root;
01010		Child.ParentWindow = Self;
01011		Child.OwnerWindow = OwnerW;
01012		if(Child.OwnerWindow == None)
01013			Child.OwnerWindow = Self;
01014		Child.Cursor = Cursor;
01015		Child.bAlwaysBehind = False;
01016		Child.LookAndFeel = LookAndFeel;
01017		Child.BeforeCreate();
01018		Child.Created();
01019	
01020		// Now add it at the WinTop of the Z-Order and then adjust child list.
01021		ShowChildWindow(Child);
01022	
01023		Child.AfterCreate();
01024	
01025		return Child;
01026	}
01027	
01028	final function Tile(Canvas C, Texture T)
01029	{
01030		local int X, Y;
01031	
01032		X = 0;
01033		Y = 0;
01034	
01035		While(X < WinWidth)
01036		{
01037			While(Y < WinHeight)
01038			{
01039				DrawClippedTexture( C, X, Y, T );
01040				Y += T.VSize;
01041			}
01042			X += T.USize;
01043			Y = 0;
01044		}
01045	}
01046	
01047	final function DrawHorizTiledPieces( Canvas C, float DestX, float DestY, float DestW, float DestH, TexRegion T1, TexRegion T2, TexRegion T3, TexRegion T4, TexRegion T5, float Scale )
01048	{
01049		local TexRegion Pieces[5], R;
01050		local int PieceCount;
01051		local int j;
01052		local float X, L;
01053	
01054		Pieces[0] = T1; if(T1.T != None) PieceCount = 1;
01055		Pieces[1] = T2; if(T2.T != None) PieceCount = 2;
01056		Pieces[2] = T3; if(T3.T != None) PieceCount = 3;
01057		Pieces[3] = T4; if(T4.T != None) PieceCount = 4;
01058		Pieces[4] = T5; if(T5.T != None) PieceCount = 5;
01059	
01060		j = 0;
01061		X = DestX;
01062		while( X < DestX + DestW )
01063		{
01064			L = DestW - (X - DestX);
01065			R = Pieces[j];
01066			DrawStretchedTextureSegment( C, X, DestY, FMin(R.W*Scale, L), R.H*Scale, R.X, R.Y, FMin(R.W, L/Scale), R.H, R.T );
01067			X += FMin(R.W*Scale, L);
01068			j = (j+1)%PieceCount;
01069		}
01070	}
01071	
01072	final function DrawVertTiledPieces( Canvas C, float DestX, float DestY, float DestW, float DestH, TexRegion T1, TexRegion T2, TexRegion T3, TexRegion T4, TexRegion T5, float Scale )
01073	{
01074		local TexRegion Pieces[5], R;
01075		local int PieceCount;
01076		local int j;
01077		local float Y, L;
01078	
01079		Pieces[0] = T1; if(T1.T != None) PieceCount = 1;
01080		Pieces[1] = T2; if(T2.T != None) PieceCount = 2;
01081		Pieces[2] = T3; if(T3.T != None) PieceCount = 3;
01082		Pieces[3] = T4; if(T4.T != None) PieceCount = 4;
01083		Pieces[4] = T5; if(T5.T != None) PieceCount = 5;
01084	
01085		j = 0;
01086		Y = DestY;
01087		while( Y < DestY + DestH )
01088		{
01089			L = DestH - (Y - DestY);
01090			R = Pieces[j];
01091			DrawStretchedTextureSegment( C, DestX, Y, R.W*Scale, FMin(R.H*Scale, L), R.X, R.Y, R.W, FMin(R.H, L/Scale), R.T );
01092			Y += FMin(R.H*Scale, L);
01093			j = (j+1)%PieceCount;
01094		}
01095	}
01096	
01097	
01098	final function DrawClippedTexture( Canvas C, float X, float Y, texture Tex )
01099	{
01100		DrawStretchedTextureSegment( C, X, Y, Tex.USize, Tex.VSize, 0, 0, Tex.USize, Tex.VSize, Tex);
01101	}
01102	
01103	final function DrawStretchedTexture( Canvas C, float X, float Y, float W, float H, texture Tex )
01104	{
01105		DrawStretchedTextureSegment( C, X, Y, W, H, 0, 0, Tex.USize, Tex.VSize, Tex);
01106	}
01107	
01108	final function DrawStretchedTextureSegment( Canvas C, float X, float Y, float W, float H, 
01109										  float tX, float tY, float tW, float tH, texture Tex ) 
01110	{
01111		local float OrgX, OrgY, ClipX, ClipY;
01112	
01113		OrgX = C.OrgX;
01114		OrgY = C.OrgY;
01115		ClipX = C.ClipX;
01116		ClipY = C.ClipY;
01117	
01118		C.SetOrigin(OrgX + ClippingRegion.X*Root.GUIScale, OrgY + ClippingRegion.Y*Root.GUIScale);
01119		C.SetClip(ClippingRegion.W*Root.GUIScale, ClippingRegion.H*Root.GUIScale);
01120	
01121		C.SetPos((X - ClippingRegion.X)*Root.GUIScale, (Y - ClippingRegion.Y)*Root.GUIScale);
01122		C.DrawTileClipped( Tex, W*Root.GUIScale, H*Root.GUIScale, tX, tY, tW, tH);
01123		
01124		C.SetClip(ClipX, ClipY);
01125		C.SetOrigin(OrgX, OrgY);
01126	}
01127	
01128	final function ClipText(Canvas C, float X, float Y, coerce string S, optional bool bCheckHotkey)
01129	{
01130		local float OrgX, OrgY, ClipX, ClipY;
01131	
01132		OrgX = C.OrgX;
01133		OrgY = C.OrgY;
01134		ClipX = C.ClipX;
01135		ClipY = C.ClipY;
01136	
01137		C.SetOrigin(OrgX + ClippingRegion.X*Root.GUIScale, OrgY + ClippingRegion.Y*Root.GUIScale);
01138		C.SetClip(ClippingRegion.W*Root.GUIScale, ClippingRegion.H*Root.GUIScale);
01139	
01140		C.SetPos((X - ClippingRegion.X)*Root.GUIScale, (Y - ClippingRegion.Y)*Root.GUIScale);
01141		C.DrawTextClipped(S, bCheckHotKey);
01142	
01143		C.SetClip(ClipX, ClipY);
01144		C.SetOrigin(OrgX, OrgY);
01145	}
01146	
01147	final function int WrapClipText(Canvas C, float X, float Y, coerce string S, optional bool bCheckHotkey, optional int Length, optional int PaddingLength, optional bool bNoDraw)
01148	{
01149		local float W, H;
01150		local int SpacePos, CRPos, WordPos, TotalPos;
01151		local string Out, Temp, Padding;
01152		local bool bCR, bSentry;
01153		local int i;
01154		local int NumLines;
01155		local float pW, pH;
01156	
01157		// replace \\n's with Chr(13)'s
01158		i = InStr(S, "\\n");
01159		while(i != -1)
01160		{
01161			S = Left(S, i) $ Chr(13) $ Mid(S, i + 2);
01162			i = InStr(S, "\\n");
01163		}
01164	
01165		i = 0;
01166		bSentry = True;
01167		Out = "";
01168		NumLines = 1;
01169		while( bSentry && Y < WinHeight )
01170		{
01171			// Get the line to be drawn.
01172			if(Out == "")
01173			{
01174				i++;
01175				if (Length > 0)
01176					Out = Left(S, Length);
01177				else
01178					Out = S;
01179			}
01180	
01181			// Find the word boundary.
01182			SpacePos = InStr(Out, " ");
01183			CRPos = InStr(Out, Chr(13));
01184			
01185			bCR = False;
01186			if(CRPos != -1 && (CRPos < SpacePos || SpacePos == -1))
01187			{
01188				WordPos = CRPos;
01189				bCR = True;
01190			}
01191			else
01192			{
01193				WordPos = SpacePos;
01194			}
01195			
01196			// Get the current word.
01197			C.SetPos(0, 0);
01198			if(WordPos == -1)
01199				Temp = Out;
01200			else
01201				Temp = Left(Out, WordPos)$" ";
01202			TotalPos += WordPos;
01203	
01204			TextSize(C, Temp, W, H);
01205	
01206			// Calculate draw offset.
01207			if ( (Mid(Out, Len(Temp)) == "") && (PaddingLength > 0) )
01208			{
01209				Padding = Mid(S, Length, PaddingLength);
01210				TextSize(C, Padding, pW, pH);
01211				if(W + X + pW > WinWidth && X > 0)
01212				{
01213					X = 0;
01214					Y += H;
01215					NumLines++;
01216				}
01217			}
01218			else
01219			{
01220				if(W + X > WinWidth && X > 0)
01221				{
01222					X = 0;
01223					Y += H;
01224					NumLines++;
01225				}
01226			}
01227	
01228			// Draw the line.
01229			if(!bNoDraw)
01230				ClipText(C, X, Y, Temp, bCheckHotKey);
01231	
01232			// Increment the draw offset.
01233			X += W;
01234			if(bCR)
01235			{
01236				X =0;
01237				Y += H;
01238				NumLines++;
01239			}
01240			Out = Mid(Out, Len(Temp));
01241			if ((Out == "") && (i > 0))
01242				bSentry = False;
01243		}
01244		return NumLines;
01245	}
01246	
01247	final function ClipTextWidth(Canvas C, float X, float Y, coerce string S, float W)
01248	{
01249		ClipText(C, X, Y, S);
01250	}
01251	
01252	final function DrawClippedActor( Canvas C, float X, float Y, Actor A, bool WireFrame, rotator RotOffset, vector LocOffset )
01253	{
01254		local vector MeshLoc;
01255		local float FOV;
01256	
01257		FOV = GetPlayerOwner().FOVAngle * Pi / 180;
01258		
01259		MeshLoc.X = 4 / tan(FOV/2);
01260		MeshLoc.Y = 0;
01261		MeshLoc.Z = 0;
01262	
01263		A.SetRotation(RotOffset);
01264		A.SetLocation(MeshLoc + LocOffset);
01265	
01266		C.DrawClippedActor(A, WireFrame, ClippingRegion.W * Root.GUIScale, ClippingRegion.H * Root.GUIScale, C.OrgX + ClippingRegion.X * Root.GUIScale, C.OrgY + ClippingRegion.Y * Root.GUIScale, True);
01267	}
01268	
01269	final function DrawUpBevel( Canvas C, float X, float Y, float W, float H, Texture T)
01270	{
01271		local Region R;
01272	
01273		R = LookAndFeel.BevelUpTL;
01274		DrawStretchedTextureSegment( C, X, Y, R.W, R.H, R.X, R.Y, R.W, R.H, T );
01275	
01276		R = LookAndFeel.BevelUpT;
01277		DrawStretchedTextureSegment( C, X+LookAndFeel.BevelUpTL.W, Y, 
01278										W - LookAndFeel.BevelUpTL.W
01279										- LookAndFeel.BevelUpTR.W,
01280										R.H, R.X, R.Y, R.W, R.H, T );
01281	
01282		R = LookAndFeel.BevelUpTR;
01283		DrawStretchedTextureSegment( C, X + W - R.W, Y, R.W, R.H, R.X, R.Y, R.W, R.H, T );
01284		
01285		R = LookAndFeel.BevelUpL;
01286		DrawStretchedTextureSegment( C, X, Y + LookAndFeel.BevelUpTL.H,
01287										R.W,  
01288										H - LookAndFeel.BevelUpTL.H
01289										- LookAndFeel.BevelUpBL.H,
01290										R.X, R.Y, R.W, R.H, T );
01291	
01292		R = LookAndFeel.BevelUpR;
01293		DrawStretchedTextureSegment( C, X + W - R.W, Y + LookAndFeel.BevelUpTL.H,
01294										R.W,  
01295										H - LookAndFeel.BevelUpTL.H
01296										- LookAndFeel.BevelUpBL.H,
01297										R.X, R.Y, R.W, R.H, T );
01298	
01299		
01300		R = LookAndFeel.BevelUpBL;
01301		DrawStretchedTextureSegment( C, X, Y + H - R.H, R.W, R.H, R.X, R.Y, R.W, R.H, T );
01302	
01303		R = LookAndFeel.BevelUpB;
01304		DrawStretchedTextureSegment( C, X + LookAndFeel.BevelUpBL.W, Y + H - R.H, 
01305										W - LookAndFeel.BevelUpBL.W
01306										- LookAndFeel.BevelUpBR.W,
01307										R.H, R.X, R.Y, R.W, R.H, T );
01308	
01309		R = LookAndFeel.BevelUpBR;
01310		DrawStretchedTextureSegment( C, X + W - R.W, Y + H - R.H, R.W, R.H, R.X, R.Y, 
01311										R.W, R.H, T );
01312	
01313		R = LookAndFeel.BevelUpArea;
01314		DrawStretchedTextureSegment( C, X + LookAndFeel.BevelUpTL.W,
01315		                                Y + LookAndFeel.BevelUpTL.H,
01316										W - LookAndFeel.BevelUpBL.W
01317										- LookAndFeel.BevelUpBR.W,
01318										H - LookAndFeel.BevelUpTL.H
01319										- LookAndFeel.BevelUpBL.H,
01320										R.X, R.Y, R.W, R.H, T );
01321		
01322	}
01323	
01324	final function DrawMiscBevel( Canvas C, float X, float Y, float W, float H, Texture T, int BevelType)
01325	{
01326		local Region R;
01327	
01328		R = LookAndFeel.MiscBevelTL[BevelType];
01329		DrawStretchedTextureSegment( C, X, Y, R.W, R.H, R.X, R.Y, R.W, R.H, T );
01330	
01331		R = LookAndFeel.MiscBevelT[BevelType];
01332		DrawStretchedTextureSegment( C, X+LookAndFeel.MiscBevelTL[BevelType].W, Y, 
01333										W - LookAndFeel.MiscBevelTL[BevelType].W
01334										- LookAndFeel.MiscBevelTR[BevelType].W,
01335										R.H, R.X, R.Y, R.W, R.H, T );
01336	
01337		R = LookAndFeel.MiscBevelTR[BevelType];
01338		DrawStretchedTextureSegment( C, X + W - R.W, Y, R.W, R.H, R.X, R.Y, R.W, R.H, T );
01339		
01340		R = LookAndFeel.MiscBevelL[BevelType];
01341		DrawStretchedTextureSegment( C, X, Y + LookAndFeel.MiscBevelTL[BevelType].H,
01342										R.W,  
01343										H - LookAndFeel.MiscBevelTL[BevelType].H
01344										- LookAndFeel.MiscBevelBL[BevelType].H,
01345										R.X, R.Y, R.W, R.H, T );
01346	
01347		R = LookAndFeel.MiscBevelR[BevelType];
01348		DrawStretchedTextureSegment( C, X + W - R.W, Y + LookAndFeel.MiscBevelTL[BevelType].H,
01349										R.W,  
01350										H - LookAndFeel.MiscBevelTL[BevelType].H
01351										- LookAndFeel.MiscBevelBL[BevelType].H,
01352										R.X, R.Y, R.W, R.H, T );
01353	
01354		
01355		R = LookAndFeel.MiscBevelBL[BevelType];
01356		DrawStretchedTextureSegment( C, X, Y + H - R.H, R.W, R.H, R.X, R.Y, R.W, R.H, T );
01357	
01358		R = LookAndFeel.MiscBevelB[BevelType];
01359		DrawStretchedTextureSegment( C, X + LookAndFeel.MiscBevelBL[BevelType].W, Y + H - R.H, 
01360										W - LookAndFeel.MiscBevelBL[BevelType].W
01361										- LookAndFeel.MiscBevelBR[BevelType].W,
01362										R.H, R.X, R.Y, R.W, R.H, T );
01363	
01364		R = LookAndFeel.MiscBevelBR[BevelType];
01365		DrawStretchedTextureSegment( C, X + W - R.W, Y + H - R.H, R.W, R.H, R.X, R.Y, 
01366										R.W, R.H, T );
01367	
01368		R = LookAndFeel.MiscBevelArea[BevelType];
01369		DrawStretchedTextureSegment( C, X + LookAndFeel.MiscBevelTL[BevelType].W,
01370		                                Y + LookAndFeel.MiscBevelTL[BevelType].H,
01371										W - LookAndFeel.MiscBevelBL[BevelType].W
01372										- LookAndFeel.MiscBevelBR[BevelType].W,
01373										H - LookAndFeel.MiscBevelTL[BevelType].H
01374										- LookAndFeel.MiscBevelBL[BevelType].H,
01375										R.X, R.Y, R.W, R.H, T );
01376	}
01377	
01378	final function string RemoveAmpersand(string S)
01379	{
01380		local string Result;
01381		local string Underline;
01382	
01383		ParseAmpersand(S, Result, Underline, False);
01384	
01385		return Result;
01386	}
01387	
01388	final function byte ParseAmpersand(string S, out string Result, out string Underline, bool bCalcUnderline)
01389	{
01390		local string Temp;
01391		local int Pos, NewPos;
01392		local int i;
01393		local byte HotKey;
01394		
01395		HotKey = 0;
01396		Pos = 0;
01397		Result = "";
01398		Underline = "";
01399	
01400		while(True)
01401		{
01402			Temp = Mid(S, Pos);
01403	
01404			NewPos = InStr(Temp, "&");
01405			
01406			if(NewPos == -1) break;
01407			Pos += NewPos;
01408	
01409			if(Mid(Temp, NewPos + 1, 1) == "&")
01410			{
01411				// It's a double &, lets add one to the output.
01412				Result = Result $ Left(Temp, NewPos) $ "&";
01413				
01414				if(bCalcUnderline) 
01415					Underline = Underline $ " ";
01416	
01417				Pos++;
01418			}
01419			else
01420			{
01421				if(HotKey == 0)
01422					HotKey = Asc(Caps(Mid(Temp, NewPos + 1, 1)));
01423	
01424				Result = Result $ Left(Temp, NewPos);
01425				
01426				if(bCalcUnderline)
01427				{
01428					for(i=0;i<NewPos - 1;i++) 
01429						Underline = Underline $ " ";
01430					Underline = Underline $ "_";
01431				}
01432			}
01433	
01434			Pos++;
01435		}
01436		Result = Result $ Temp;
01437	
01438		return HotKey;
01439	}
01440	
01441	final function bool MouseIsOver()
01442	{
01443		return (Root.MouseWindow == Self);
01444	}
01445	
01446	function ToolTip(string strTip) 
01447	{
01448		if(ParentWindow != Root) ParentWindow.ToolTip(strTip);
01449	}
01450	
01451	// Sets mouse window for mouse capture.
01452	final function SetMouseWindow()
01453	{
01454		Root.MouseWindow = Self;
01455	}
01456	
01457	function Texture GetLookAndFeelTexture()
01458	{
01459		return ParentWindow.GetLookAndFeelTexture();
01460	}
01461	
01462	function bool IsActive()
01463	{
01464		return ParentWindow.IsActive();
01465	}
01466	
01467	function SetAcceptsHotKeys(bool bNewAccpetsHotKeys)
01468	{
01469		if(bNewAccpetsHotKeys && !bAcceptsHotKeys && bWindowVisible)
01470			Root.AddHotkeyWindow(Self);
01471		
01472		if(!bNewAccpetsHotKeys && bAcceptsHotKeys && bWindowVisible)
01473			Root.RemoveHotkeyWindow(Self);
01474	
01475		bAcceptsHotKeys = bNewAccpetsHotKeys;
01476	}
01477	
01478	final function UWindowWindow GetParent(class<UWindowWindow> ParentClass, optional bool bExactClass)
01479	{
01480		local UWindowWindow P;
01481	
01482		P = ParentWindow;
01483		while(P != Root)
01484		{
01485			if(bExactClass)
01486			{
01487				if(P.Class == ParentClass)
01488					return P;
01489			}
01490			else
01491			{
01492				if(ClassIsChildOf(P.Class, ParentClass))
01493					return P;
01494			}
01495			P = P.ParentWindow;
01496		}
01497	
01498		return None;
01499	}
01500	
01501	final function UWindowWindow FindChildWindow(class<UWindowWindow> ChildClass, optional bool bExactClass)
01502	{
01503		local UWindowWindow Child, Found;
01504	
01505		for(Child = LastChildWindow;Child != None;Child = Child.PrevSiblingWindow)
01506		{
01507			if(bExactClass)
01508			{
01509				if(Child.Class == ChildClass) return Child;
01510			}
01511			else
01512			{
01513				if(ClassIsChildOf(Child.Class, ChildClass)) return Child;
01514			}
01515	
01516			Found = Child.FindChildWindow(ChildClass, bExactClass);
01517			if(Found != None) return Found;
01518		}
01519	
01520		return None;
01521	}
01522	
01523	function GetDesiredDimensions(out float W, out float H)
01524	{
01525		local float MaxW, MaxH, TW, TH;
01526		local UWindowWindow Child, Found;
01527		
01528		MaxW = 0;
01529		MaxH = 0;
01530	
01531		for(Child = LastChildWindow;Child != None;Child = Child.PrevSiblingWindow)
01532		{
01533			Child.GetDesiredDimensions(TW, TH);
01534			//Log("Calling: "$GetPlayerOwner().GetItemName(string(Child)));
01535			
01536	
01537			if(TW > MaxW) MaxW = TW;
01538			if(TH > MaxH) MaxH = TH;
01539		}
01540		W = MaxW;
01541		H = MaxH;
01542		//Log(GetPlayerOwner().GetItemName(string(Self))$": DesiredHeight: "$H);
01543	}
01544	
01545	final function TextSize(Canvas C, string Text, out float W, out float H)
01546	{
01547		C.SetPos(0, 0);
01548		C.TextSize(Text, W, H);
01549		W = W / Root.GUIScale;
01550		H = H / Root.GUIScale;
01551	}
01552	
01553	function ResolutionChanged(float W, float H)
01554	{
01555		local UWindowWindow Child;
01556	
01557		for(Child = LastChildWindow;Child != None;Child = Child.PrevSiblingWindow)
01558		{
01559			Child.ResolutionChanged(W, H);
01560		}
01561	}
01562	
01563	function ShowModal(UWindowWindow W)
01564	{
01565		ModalWindow = W;
01566		W.ShowWindow();
01567		W.BringToFront();		
01568	}
01569	
01570	function bool WaitModal()
01571	{
01572		if(ModalWindow != None && ModalWindow.bWindowVisible)
01573			return True;
01574	
01575		ModalWindow = None;
01576	
01577		return False;
01578	}
01579	
01580	function WindowHidden()
01581	{
01582		local UWindowWindow Child;
01583	
01584		for(Child = LastChildWindow;Child != None;Child = Child.PrevSiblingWindow)
01585			Child.WindowHidden();
01586	}
01587	
01588	function WindowShown()
01589	{
01590		local UWindowWindow Child;
01591	
01592		for(Child = LastChildWindow;Child != None;Child = Child.PrevSiblingWindow)
01593			Child.WindowShown();
01594	}
01595	
01596	// Should mouse events at these co-ordinates be passed through to underlying windows?
01597	function bool CheckMousePassThrough(float X, float Y)
01598	{
01599		return False;
01600	}
01601	
01602	final function bool WindowIsVisible()
01603	{
01604		if(Self == Root)
01605			return True;
01606	
01607		if(!bWindowVisible)
01608			return False;
01609		return ParentWindow.WindowIsVisible();
01610	}
01611	
01612	function SetParent(UWindowWindow NewParent)
01613	{
01614		HideWindow();
01615		ParentWindow = NewParent;
01616		ShowWindow();
01617	}
01618	
01619	function UWindowMessageBox MessageBox(string Title, string Message, MessageBoxButtons Buttons, MessageBoxResult ESCResult, optional MessageBoxResult EnterResult, optional int TimeOut)
01620	{
01621		local UWindowMessageBox W;
01622		local UWindowFramedWindow F;
01623		
01624		W = UWindowMessageBox(Root.CreateWindow(class'UWindowMessageBox', 100, 100, 100, 100, Self));
01625		W.SetupMessageBox(Title, Message, Buttons, ESCResult, EnterResult, TimeOut);
01626		F = UWindowFramedWindow(GetParent(class'UWindowFramedWindow'));
01627	
01628		if(F!= None)
01629			F.ShowModal(W);
01630		else
01631			Root.ShowModal(W);
01632	
01633		return W;
01634	}
01635	
01636	function MessageBoxDone(UWindowMessageBox W, MessageBoxResult Result)
01637	{
01638	}
01639	
01640	function NotifyQuitUnreal()
01641	{
01642		local UWindowWindow Child;
01643	
01644		for(Child = LastChildWindow;Child != None;Child = Child.PrevSiblingWindow)
01645			Child.NotifyQuitUnreal();
01646	}
01647	
01648	function NotifyBeforeLevelChange()
01649	{
01650		local UWindowWindow Child;
01651	
01652		for(Child = LastChildWindow;Child != None;Child = Child.PrevSiblingWindow)
01653			Child.NotifyBeforeLevelChange();
01654	}
01655	
01656	function SetCursor(MouseCursor C)
01657	{
01658		local UWindowWindow Child;
01659	
01660		Cursor = C;
01661	
01662		for(Child = LastChildWindow;Child != None;Child = Child.PrevSiblingWindow)
01663			Child.SetCursor(C);
01664	}
01665	
01666	function NotifyAfterLevelChange()
01667	{
01668		local UWindowWindow Child;
01669	
01670		for(Child = LastChildWindow;Child != None;Child = Child.PrevSiblingWindow)
01671			Child.NotifyAfterLevelChange();
01672	}
01673	
01674	final function ReplaceText(out string Text, string Replace, string With)
01675	{
01676		local int i;
01677		local string Input;
01678			
01679		Input = Text;
01680		Text = "";
01681		i = InStr(Input, Replace);
01682		while(i != -1)
01683		{	
01684			Text = Text $ Left(Input, i) $ With;
01685			Input = Mid(Input, i + Len(Replace));	
01686			i = InStr(Input, Replace);
01687		}
01688		Text = Text $ Input;
01689	}
01690	
01691	function StripCRLF(out string Text)
01692	{
01693		ReplaceText(Text, Chr(13)$Chr(10), "");
01694		ReplaceText(Text, Chr(13), "");
01695		ReplaceText(Text, Chr(10), "");
01696	}
01697	
01698	defaultproperties
01699	{
01700	     WindowAlpha=1.000000
01701	}

End Source Code