UWindow
Class UWindowDialogControl

source: e:\games\UnrealTournament\UWindow\Classes\UWindowDialogControl.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UWindow.UWindowDialogControl
Direct Known Subclasses:UWindowButton, UWindowComboControl, UWindowDynamicTextArea, UWindowEditBox, UWindowEditControl, UWindowHSliderControl, UWindowLabelControl, UWindowListControl, UWindowTextAreaControl

class UWindowDialogControl
extends UWindow.UWindowWindow

//============================================================================= // UWindowDialogControl - a control which notifies a dialog control group //=============================================================================
Variables
 TextAlign Align
 int Font
 string HelpText
           changed by BeforePaint functions
 MinWidth, MinHeight
           minimum heights for layout control
 UWindowDialogClientWindow NotifyWindow
 UWindowDialogControl TabNext
           minimum heights for layout control
 UWindowDialogControl TabPrev
           minimum heights for layout control
 string Text
 color TextColor
 TextX, TextY
           changed by BeforePaint functions
 bool bAcceptExternalDragDrop
           changed by BeforePaint functions
 bool bHasKeyboardFocus
           changed by BeforePaint functions
 bool bNoKeyboard
           changed by BeforePaint functions


Function Summary
 void BeforePaint(Canvas C, float X, float Y)
 UWindowDialogControl CheckExternalDrag(float X, float Y)
 void Created()
 bool ExternalDragOver(UWindowDialogControl ExternalControl, float X, float Y)
 void KeyDown(int Key, float X, float Y)
 void KeyFocusEnter()
 void KeyFocusExit()
 void MouseEnter()
 void MouseLeave()
 void MouseMove(float X, float Y)
 void Notify(byte E)
 void Register(UWindowDialogClientWindow W)
 void SetFont(int NewFont)
 void SetHelpText(string NewHelpText)
 void SetText(string NewText)
 void SetTextColor(color NewColor)



Source Code


00001	//=============================================================================
00002	// UWindowDialogControl - a control which notifies a dialog control group
00003	//=============================================================================
00004	class UWindowDialogControl extends UWindowWindow;
00005	
00006	var UWindowDialogClientWindow	NotifyWindow;
00007	var string Text;
00008	var int Font;
00009	var color TextColor;
00010	var TextAlign Align;
00011	var float TextX, TextY;		// changed by BeforePaint functions
00012	var bool bHasKeyboardFocus;
00013	var bool bNoKeyboard;
00014	var bool bAcceptExternalDragDrop;
00015	var string HelpText;
00016	var float MinWidth, MinHeight;	// minimum heights for layout control
00017	
00018	var UWindowDialogControl	TabNext;
00019	var UWindowDialogControl	TabPrev;
00020	
00021	
00022	function Created()
00023	{
00024		if(!bNoKeyboard)
00025			SetAcceptsFocus();
00026	}
00027	
00028	function KeyFocusEnter()
00029	{
00030		Super.KeyFocusEnter();
00031		bHasKeyboardFocus = True;
00032	}
00033	
00034	function KeyFocusExit()
00035	{
00036		Super.KeyFocusExit();
00037		bHasKeyboardFocus = False;
00038	}
00039	
00040	function SetHelpText(string NewHelpText)
00041	{
00042		HelpText = NewHelpText;
00043	}
00044	
00045	function SetText(string NewText)
00046	{
00047		Text = NewText;
00048	}
00049	
00050	function BeforePaint(Canvas C, float X, float Y)
00051	{
00052		Super.BeforePaint(C, X, Y);
00053	
00054		C.Font = Root.Fonts[Font];
00055	}
00056	
00057	function SetFont(int NewFont)
00058	{
00059		Font = NewFont;
00060	}
00061	
00062	function SetTextColor(color NewColor)
00063	{
00064		TextColor = NewColor;
00065	}
00066	
00067	
00068	function Register(UWindowDialogClientWindow	W)
00069	{
00070		NotifyWindow = W;
00071		Notify(DE_Created);
00072	}
00073	
00074	function Notify(byte E)
00075	{
00076		if(NotifyWindow != None)
00077		{
00078			NotifyWindow.Notify(Self, E);
00079		}
00080	}
00081	
00082	function bool ExternalDragOver(UWindowDialogControl ExternalControl, float X, float Y)
00083	{
00084		return False;
00085	}
00086	
00087	function UWindowDialogControl CheckExternalDrag(float X, float Y)
00088	{
00089		local float RootX, RootY;
00090		local float ExtX, ExtY;
00091		local UWindowWindow W;
00092		local UWindowDialogControl C;
00093	
00094		WindowToGlobal(X, Y, RootX, RootY);
00095		W = Root.FindWindowUnder(RootX, RootY);
00096		C = UWindowDialogControl(W);
00097	
00098		if(W != Self && C != None && C.bAcceptExternalDragDrop)
00099		{
00100			W.GlobalToWindow(RootX, RootY, ExtX, ExtY);
00101			if(C.ExternalDragOver(Self, ExtX, ExtY))
00102				return C;
00103		}
00104	
00105		return None;
00106	}
00107	
00108	function KeyDown(int Key, float X, float Y)
00109	{
00110		local PlayerPawn P;
00111		local UWindowDialogControl N;
00112	
00113		P = Root.GetPlayerOwner();
00114	
00115		switch (Key)
00116		{
00117		case P.EInputKey.IK_Tab:
00118			
00119			if(TabNext != None)
00120			{
00121				N = TabNext;
00122				while(N != Self && !N.bWindowVisible)
00123					N = N.TabNext;
00124	
00125				N.ActivateWindow(0, False);
00126			}
00127			break;
00128		default:
00129			Super.KeyDown(Key, X, Y);
00130			break;
00131		}
00132	
00133	}
00134	
00135	function MouseMove(float X, float Y)
00136	{
00137		Super.MouseMove(X, Y);
00138		Notify(DE_MouseMove);
00139	}
00140	
00141	function MouseEnter()
00142	{
00143		Super.MouseEnter();
00144		Notify(DE_MouseEnter);
00145	}
00146	
00147	function MouseLeave()
00148	{
00149		Super.MouseLeave();
00150		Notify(DE_MouseLeave);
00151	}
00152	
00153	defaultproperties
00154	{
00155	}

End Source Code