UWindow
Class UWindowGridColumn

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

class UWindowGridColumn
extends UWindow.UWindowWindow

//============================================================================= // UWindowGridColumn - a grid column //=============================================================================
Variables
 string ColumnHeading
 int ColumnNum
 UWindowGridColumn NextColumn
 UWindowGridColumn PrevColumn
 bool bSizing


Function Summary
 void BeforePaint(Canvas C, float X, float Y)
 void Click(float X, float Y)
 void Created()
 void DoubleClick(float X, float Y)
 void LMouseDown(float X, float Y)
 void LMouseUp(float X, float Y)
 void MouseLeave()
 void MouseMove(float X, float Y)
 void Paint(Canvas C, float X, float Y)
 void RMouseDown(float X, float Y)
 void RMouseUp(float X, float Y)



Source Code


00001	//=============================================================================
00002	// UWindowGridColumn - a grid column
00003	//=============================================================================
00004	class UWindowGridColumn extends UWindowWindow;
00005	
00006	var UWindowGridColumn NextColumn;
00007	var UWindowGridColumn PrevColumn;
00008	var bool				bSizing;
00009	var string				ColumnHeading;
00010	var int					ColumnNum;
00011	
00012	function Created() {
00013		Super.Created();
00014	}
00015	
00016	function BeforePaint(Canvas C, float X, float Y)
00017	{
00018		Super.BeforePaint(C, X, Y);
00019		if(WinWidth < 1) WinWidth = 1;
00020	}
00021	
00022	function LMouseDown(float X, float Y)
00023	{
00024		Super.LMouseDown(X, Y);
00025	
00026		if(X > Min(WinWidth - 5, ParentWindow.WinWidth - WinLeft - 5) && Y < 12)
00027		{
00028			bSizing = True;
00029			UWindowGrid(ParentWindow.ParentWindow).bSizingColumn = True;
00030			Root.CaptureMouse();
00031		}
00032	
00033	}
00034	
00035	function LMouseUp(float X, float Y)
00036	{
00037		Super.LMouseUp(X, Y);
00038	
00039		UWindowGrid(ParentWindow.ParentWindow).bSizingColumn = False;
00040	}
00041	
00042	function MouseMove(float X, float Y)
00043	{
00044		if(X > Min(WinWidth - 5, ParentWindow.WinWidth - WinLeft - 5) && Y < 12)
00045		{
00046			Cursor = Root.HSplitCursor;
00047		}
00048		else
00049		{
00050			Cursor = Root.NormalCursor;
00051		}
00052	
00053		if(bSizing && bMouseDown)
00054		{
00055			WinWidth = X;
00056			if(WinWidth < 1) WinWidth = 1;
00057			if(WinWidth > ParentWindow.WinWidth - WinLeft - 1) WinWidth = ParentWindow.WinWidth - WinLeft - 1;
00058		}
00059		else
00060		{
00061			bSizing = False;
00062			UWindowGrid(ParentWindow.ParentWindow).bSizingColumn = False;
00063		}
00064	}
00065	
00066	function Paint(Canvas C, float X, float Y)
00067	{
00068		local Region R;
00069		local Texture T;
00070		local Color FC;
00071	
00072		UWindowGrid(ParentWindow.ParentWindow).PaintColumn(C, Self, X, Y);
00073	
00074		if(IsActive())
00075		{
00076			T = LookAndFeel.Active;
00077			FC = LookAndFeel.HeadingActiveTitleColor;
00078		}
00079		else
00080		{
00081			T = LookAndFeel.InActive;
00082			FC = LookAndFeel.HeadingInactiveTitleColor;
00083		}
00084	
00085		C.DrawColor.r = 255;
00086		C.DrawColor.g = 255;
00087		C.DrawColor.b = 255;
00088	
00089		DrawUpBevel( C, 0, 0, WinWidth, LookAndFeel.ColumnHeadingHeight, T);
00090	
00091		C.DrawColor = FC;
00092	
00093		ClipText( C, 2, 1, ColumnHeading);
00094	
00095		C.DrawColor.r = 255;
00096		C.DrawColor.g = 255;
00097		C.DrawColor.b = 255;
00098	}
00099	
00100	function Click(float X, float Y)
00101	{
00102		local int Row;
00103	
00104		if(Y < 12)
00105		{
00106			if(X <= Min(WinWidth - 5, ParentWindow.WinWidth - WinLeft - 5))
00107			{
00108				UWindowGrid(ParentWindow.ParentWindow).SortColumn(Self);
00109			}
00110		}
00111		else
00112		{
00113			Row = ((Y - 12) / UWindowGrid(ParentWindow.ParentWindow).RowHeight) + UWindowGrid(ParentWindow.ParentWindow).TopRow;
00114			UWindowGrid(ParentWindow.ParentWindow).SelectRow(Row);
00115		}
00116	}
00117	
00118	function RMouseDown(float X, float Y)
00119	{
00120		local int Row;
00121		Super.RMouseDown(X, Y);
00122	
00123		if(Y > 12)
00124		{
00125			Row = ((Y - 12) / UWindowGrid(ParentWindow.ParentWindow).RowHeight) + UWindowGrid(ParentWindow.ParentWindow).TopRow;
00126			UWindowGrid(ParentWindow.ParentWindow).SelectRow(Row);
00127			UWindowGrid(ParentWindow.ParentWindow).RightClickRowDown(Row, X+WinLeft, Y+WinTop);
00128		}
00129	}
00130	
00131	function RMouseUp(float X, float Y)
00132	{
00133		local int Row;
00134		Super.RMouseUp(X, Y);
00135	
00136		if(Y > 12)
00137		{
00138			Row = ((Y - 12) / UWindowGrid(ParentWindow.ParentWindow).RowHeight) + UWindowGrid(ParentWindow.ParentWindow).TopRow;
00139			UWindowGrid(ParentWindow.ParentWindow).SelectRow(Row);
00140			UWindowGrid(ParentWindow.ParentWindow).RightClickRow(Row, X+WinLeft, Y+WinTop);
00141		}
00142	}
00143	
00144	function DoubleClick(float X, float Y)
00145	{
00146		local int Row;
00147	
00148		if(Y < 12)
00149		{
00150			Click(X, Y);
00151		}
00152		else
00153		{
00154			Row = ((Y - 12) / UWindowGrid(ParentWindow.ParentWindow).RowHeight) + UWindowGrid(ParentWindow.ParentWindow).TopRow;
00155			UWindowGrid(ParentWindow.ParentWindow).DoubleClickRow(Row);
00156		}
00157	}
00158	
00159	function MouseLeave()
00160	{
00161		Super.MouseLeave();
00162		UWindowGrid(ParentWindow.ParentWindow).MouseLeaveColumn(Self);
00163	}
00164	
00165	defaultproperties
00166	{
00167	}

End Source Code