UWindow
Class UWindowBase

source: e:\games\UnrealTournament\UWindow\Classes\UWindowBase.uc
Core.Object
   |
   +--UWindow.UWindowBase
Direct Known Subclasses:UWindowList, UWindowLookAndFeel, UWindowWindow

class UWindowBase
extends Core.Object



Function Summary
 Object BuildObjectWithProperties(string Text)
 Region GetRegion(TexRegion T)
 int InStrAfter(string Text, string Match, int Pos)
 Region NewRegion(float X, float Y, float W, float H)
 TexRegion NewTexRegion(float X, float Y, float W, float H, Texture T)



Source Code


00001	class UWindowBase extends Object;
00002	
00003	// Fonts array constants
00004	const F_Normal = 0;			// Normal font
00005	const F_Bold = 1;			// Bold font
00006	const F_Large = 2;			// Large font
00007	const F_LargeBold = 3;		// Large, Bold font
00008	
00009	struct Region
00010	{
00011		var() int X;
00012		var() int Y;
00013		var() int W;
00014		var() int H;
00015	};
00016	
00017	struct TexRegion
00018	{
00019		var() int X;
00020		var() int Y;
00021		var() int W;
00022		var() int H;
00023		var() Texture T;
00024	};
00025	
00026	enum TextAlign
00027	{
00028		TA_Left,
00029		TA_Right,
00030		TA_Center
00031	};
00032	
00033	enum FrameHitTest
00034	{
00035		HT_NW,
00036		HT_N,
00037		HT_NE,
00038		HT_W,
00039		HT_E,
00040		HT_SW,
00041		HT_S,
00042		HT_SE,
00043		HT_TitleBar,
00044		HT_DragHandle,
00045		HT_None
00046	};
00047	
00048	enum MenuSound
00049	{
00050		MS_MenuPullDown,
00051		MS_MenuCloseUp,
00052		MS_MenuItem,
00053		MS_WindowOpen,
00054		MS_WindowClose,
00055		MS_ChangeTab
00056	};
00057	
00058	enum MessageBoxButtons
00059	{
00060		MB_YesNo,
00061		MB_OKCancel,
00062		MB_OK,
00063		MB_YesNoCancel
00064	};
00065	
00066	enum MessageBoxResult
00067	{
00068		MR_None,
00069		MR_Yes,
00070		MR_No,
00071		MR_OK,
00072		MR_Cancel	// also if you press the Close box.
00073	};
00074	
00075	enum PropertyCondition
00076	{
00077		PC_None,
00078		PC_LessThan,
00079		PC_Equal,
00080		PC_GreaterThan,
00081		PC_NotEqual,
00082		PC_Contains,
00083		PC_NotContains
00084	};
00085	
00086	struct HTMLStyle
00087	{
00088		var int BulletLevel;			// 0 = no bullet depth
00089		var string LinkDestination;
00090		var Color TextColor;
00091		var Color BGColor;
00092		var bool bCenter;
00093		var bool bLink;
00094		var bool bUnderline;
00095		var bool bNoBR;
00096		var bool bHeading;
00097		var bool bBold;
00098		var bool bBlink;
00099	};
00100	
00101	function Region NewRegion(float X, float Y, float W, float H)
00102	{
00103		local Region R;
00104		R.X = X;
00105		R.Y = Y;
00106		R.W = W;
00107		R.H = H;
00108		return R;
00109	}
00110	
00111	function TexRegion NewTexRegion(float X, float Y, float W, float H, Texture T)
00112	{
00113		local TexRegion R;
00114		R.X = X;
00115		R.Y = Y;
00116		R.W = W;
00117		R.H = H;
00118		R.T = T;
00119		return R;
00120	}
00121	
00122	function Region GetRegion(TexRegion T)
00123	{
00124		local Region R;
00125	
00126		R.X = T.X;
00127		R.Y = T.Y;
00128		R.W = T.W;
00129		R.H = T.H;
00130	
00131		return R;
00132	}
00133	
00134	static function int InStrAfter(string Text, string Match, int Pos)
00135	{
00136		local int i;
00137		
00138		i = InStr(Mid(Text, Pos), Match);
00139		if(i != -1)
00140			return i + Pos;
00141		return -1;
00142	}
00143	
00144	static function Object BuildObjectWithProperties(string Text)
00145	{
00146		local int i;
00147		local string ObjectClass, PropertyName, PropertyValue, Temp;
00148		local class<Object> C;
00149		local Object O;
00150		
00151		i = InStr(Text, ",");
00152		if(i == -1)
00153		{
00154			ObjectClass=Text;
00155			Text="";
00156		}
00157		else
00158		{
00159			ObjectClass=Left(Text, i);
00160			Text=Mid(Text, i+1);
00161		}
00162		
00163		//Log("Class: "$ObjectClass);
00164	
00165		C = class<Object>(DynamicLoadObject(ObjectClass, class'Class'));
00166		O = new C;
00167	
00168		while(Text != "")
00169		{
00170			i = InStr(Text, "=");
00171			if(i == -1)
00172			{
00173				Log("Missing value for property "$ObjectClass$"."$Text);
00174				PropertyName=Text;
00175				PropertyValue="";
00176			}
00177			else
00178			{
00179				PropertyName=Left(Text, i);
00180				Text=Mid(Text, i+1);
00181			}
00182	
00183			if(Left(Text, 1) == "\"")
00184			{
00185				i = InStrAfter(Text, "\"", 1);
00186				if(i == -1)
00187				{
00188					Log("Missing quote for "$ObjectClass$"."$PropertyName);
00189					return O;
00190				}
00191				PropertyValue = Mid(Text, 1, i-1);
00192				
00193				Temp = Mid(Text, i+1, 1);
00194				if(Temp != "" && Temp != ",")
00195					Log("Missing comma after close quote for "$ObjectClass$"."$PropertyName);
00196				Text = Mid(Text, i+2);	
00197			}
00198			else
00199			{
00200				i = InStr(Text, ",");
00201				if(i == -1)
00202				{
00203					PropertyValue=Text;
00204					Text="";
00205				}
00206				else
00207				{
00208					PropertyValue=Left(Text, i);
00209					Text=Mid(Text, i+1);
00210				}
00211			}
00212					
00213			//Log("Property: "$PropertyName$" => "$PropertyValue);
00214			O.SetPropertyText(PropertyName, PropertyValue);
00215		}
00216	
00217		return O;
00218	}
00219	
00220	defaultproperties
00221	{
00222	}

End Source Code