UWindow
Class UWindowHSplitter

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

class UWindowHSplitter
extends UWindow.UWindowWindow

//============================================================================= // UWindowHSplitter - a horizontal splitter component //=============================================================================
Variables
 UWindowWindow LeftClientWindow
 float MaxSplitPos
 float MinWinWidth
 float OldWinWidth
 UWindowWindow RightClientWindow
 float SplitPos
 bool bRightGrow
 bool bSizable
 bool bSizing


Function Summary
 void BeforePaint(Canvas C, float X, float Y)
 void Created()
 void LMouseDown(float X, float Y)
 void MouseMove(float X, float Y)
 void Paint(Canvas C, float X, float Y)



Source Code


00001	//=============================================================================
00002	// UWindowHSplitter - a horizontal splitter component
00003	//=============================================================================
00004	class UWindowHSplitter extends UWindowWindow;
00005	
00006	var UWindowWindow			LeftClientWindow;
00007	var UWindowWindow			RightClientWindow;
00008	var bool					bSizing;
00009	var float					SplitPos;
00010	var float					MinWinWidth;
00011	var float					OldWinWidth;
00012	var float					MaxSplitPos;
00013	var bool					bRightGrow;
00014	var bool					bSizable;
00015	
00016	function Created() 
00017	{
00018		Super.Created();
00019		bAlwaysBehind = True;
00020		SplitPos = WinWidth / 2;
00021		MinWinWidth = 24;
00022	
00023		OldWinWidth = WinWidth;
00024	}
00025	
00026	function Paint(Canvas C, float X, float Y) 
00027	{
00028		local Texture T;
00029	
00030		T = GetLookAndFeelTexture();
00031		DrawUpBevel(C, SplitPos, 0, 7, WinHeight, T);
00032	}
00033	
00034	function BeforePaint(Canvas C, float X, float Y) 
00035	{
00036		local float NewW, NewH;
00037	
00038		// Make Left panel resize
00039		if(OldWinWidth != WinWidth && !bRightGrow)
00040		{
00041			SplitPos = SplitPos + WinWidth - OldWinWidth;
00042		}
00043	
00044		SplitPos = FClamp(SplitPos, MinWinWidth, WinWidth - 7 - MinWinWidth);
00045		if(MaxSplitPos != 0)
00046			SplitPos = FClamp(SplitPos, 0, MaxSplitPos);
00047	
00048		NewW = SplitPos;
00049		NewH = WinHeight;
00050		
00051		if(NewH != LeftClientWindow.WinHeight || NewW != LeftClientWindow.WinWidth)
00052		{
00053			LeftClientWindow.SetSize(NewW, NewH);
00054		}
00055	
00056		LeftClientWindow.WinTop = 0;
00057		LeftClientWindow.WinLeft = 0;
00058	
00059		NewW = WinWidth - SplitPos - 7;
00060	
00061		if(NewH != RightClientWindow.WinHeight || NewW != RightClientWindow.WinWidth)
00062		{
00063			RightClientWindow.SetSize(NewW, NewH);
00064		}
00065		RightClientWindow.WinTop = 0;
00066		RightClientWindow.WinLeft = SplitPos + 7;
00067		
00068	
00069		OldWinWidth = WinWidth;
00070	}
00071	
00072	function LMouseDown(float X, float Y)
00073	{
00074		Super.LMouseDown(X, Y);
00075	
00076		if(bSizable && (X >= SplitPos) && (X <= SplitPos + 7)) 
00077		{
00078			bSizing = True;
00079			Root.CaptureMouse();
00080		}
00081	}
00082	
00083	function MouseMove(float X, float Y)
00084	{
00085	
00086		if(bSizable && (X >= SplitPos) && (X <= SplitPos + 7)) 
00087			Cursor = Root.HSplitCursor;
00088		else
00089			Cursor = Root.NormalCursor;
00090	
00091		if(bSizing && bMouseDown)
00092		{
00093			SplitPos = X;
00094		} else bSizing = False;
00095	}
00096	
00097	defaultproperties
00098	{
00099	     bSizable=True
00100	}

End Source Code