UWindow
Class UWindowBase

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

End Source Code