GUI
Class GUIVertList

source: C:\XIII\GUI\Classes\GUIVertList.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUIListBase
            |
            +--GUI.GUIVertList
Direct Known Subclasses:GUIList

class GUIVertList
extends GUI.GUIListBase

// ==================================================================== // (c) 2002, Epic Games, Inc. All Rights Reserved // ====================================================================

Function Summary
 void Down()
 void End()
 void Home()
 void InitComponent(GUIController MyController, GUIComponent MyOwner)
 bool InternalOnClick(GUIComponent Sender)
 bool InternalOnKeyEvent(out byte, out byte, float delta)
 bool InternalOnKeyType(out byte)
 void PgDn()
 void PgUp()
 void Up()
 void WheelDown()
 void WheelUp()



Source Code


00001	// ====================================================================
00002	//  (c) 2002, Epic Games, Inc.  All Rights Reserved
00003	// ====================================================================
00004	
00005	class GUIVertList extends GUIListBase
00006			Native;
00007	
00008	
00009	
00010	function InitComponent(GUIController MyController, GUIComponent MyOwner)
00011	{
00012		Super.Initcomponent(MyController, MyOwner);
00013		OnKeyType=InternalOnKeyType;
00014		OnKeyEvent=InternalOnKeyEvent;
00015		OnClick=InternalOnClick;
00016	}
00017	
00018	function bool InternalOnClick(GUIComponent Sender)
00019	{
00020		local int NewIndex, row;
00021	
00022		if ( ( !IsInClientBounds() ) || (ItemsPerPage==0) )
00023			return false;
00024	
00025		// Get the Row..
00026	
00027		row = Controller.MouseY - ClientBounds[1];
00028		NewIndex = Top+ (row / ItemHeight);
00029	
00030		if (NewIndex >= ItemCount)
00031			return false;
00032	
00033		SetIndex(NewIndex);
00034		return true;
00035	}
00036	
00037	function bool InternalOnKeyType(out byte Key)
00038	{
00039		// Add code to jump to next line with Char
00040	
00041		return true;
00042	}
00043	
00044	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
00045	{
00046	
00047		if (ItemsPerPage==0) return false;
00048	
00049	
00050		if ( (Key==0x26 || Key==0x68) && (State==1 || State==2) )	// Up Arrow
00051		{
00052			Up();
00053			return true;
00054		}
00055	
00056		if ( (Key==0x28 || Key==0x62) && (State==1 || State==2) ) // Down Arrow
00057		{
00058			Down();
00059			return true;
00060		}
00061	
00062		if ( (Key==0x24 || Key==0x67) && (State==1) ) // Home
00063		{
00064			Home();
00065			return true;
00066		}
00067	
00068		if ( (Key==0x23 || Key==0x61) && (State==1) ) // End
00069		{
00070			End();
00071			return true;
00072		}
00073	
00074		if ( (Key==0x21 || Key==0x69) && (State==1) ) // PgUp
00075		{
00076			PgUp();
00077			return true;
00078		}
00079	
00080		if ( (Key==0x22 || Key==0x63) && (State==1) ) // PgDn
00081		{
00082			PgDn();
00083			return true;
00084		}
00085	
00086		if ( (key==0xEC) && (State==3) )
00087		{
00088	
00089			WheelUp();
00090			return true;
00091		}
00092	
00093		if ( (key==0xED) && (State==3) )
00094		{
00095	
00096			WheelDown();
00097			return true;
00098		}
00099	
00100	
00101		return false;
00102	}
00103	
00104	
00105	function WheelUp()
00106	{
00107		if (MyScrollBar!=None)
00108			GUIVertScrollBar(MyScrollBar).WheelUp();
00109		else
00110		{
00111			if (!Controller.CtrlPressed)
00112				Up();
00113			else
00114				PgUp();
00115		}
00116	}
00117	
00118	function WheelDown()
00119	{
00120		if (MyScrollBar!=None)
00121			GUIVertScrollBar(MyScrollBar).WheelDown();
00122		else
00123		{
00124			if (!Controller.CtrlPressed)
00125				Down();
00126			else
00127				PgDn();
00128		}
00129	}
00130	
00131	
00132	function Up()
00133	{
00134		if ( (ItemCount<2) || (Index==0) ) return;
00135	
00136		Index = max(0,Index-1);
00137	
00138		if ( (Index<Top) || (Index>Top+ItemsPerPage) )
00139		{
00140			Top = Index;
00141			MyScrollBar.AlignThumb();
00142		}
00143	
00144		OnChange(self);
00145	}
00146	
00147	function Down()
00148	{
00149		if ( (ItemCount<2) || (Index==ItemCount-1) )	return;
00150	
00151		Index = min(Index+1,ItemCount-1);
00152		if (Index<Top)
00153		{
00154			Top = Index;
00155			MyScrollBar.AlignThumb();
00156		}
00157		else if (Index>=Top+ItemsPerPage)
00158		{
00159			Top = Index-ItemsPerPage+1;
00160			MyScrollBar.AlignThumb();
00161		}
00162	
00163		OnChange(self);
00164	
00165	}
00166	
00167	function Home()
00168	{
00169		if (ItemCount<2)	return;
00170	
00171		SetIndex(0);
00172		Top = 0;
00173		MyScrollBar.AlignThumb();
00174	
00175	}
00176	
00177	function End()
00178	{
00179		if (ItemCount<2)	return;
00180	
00181		Top = ItemCount - ItemsPerPage;
00182		if (Top<0)
00183			Top = 0;
00184	
00185		SetIndex(ItemCount-1);
00186		MyScrollBar.AlignThumb();
00187	}
00188	
00189	function PgUp()
00190	{
00191	
00192		if (ItemCount<2)	return;
00193	
00194		Index -= ItemsPerPage;
00195	
00196		// Adjust to bounds
00197		if (Index < 0)
00198			Index = 0;
00199	
00200		// If new index
00201		if (Top + ItemsPerPage <= Index)		// If index is forward but not visible, jump to it
00202			Top = Index;
00203		else if (Index + ItemsPerPage < Top)	// Item is way too far
00204			Top = Index;
00205		else if (Index < Top)	// Item is 1 page or less away
00206			SetTopItem(Top - ItemsPerPage);
00207	
00208		SetIndex(Index);
00209		MyScrollBar.AlignThumb();
00210	}
00211	
00212	function PgDn()
00213	{
00214	
00215		if (ItemCount<2)	return;
00216	
00217		// Select item 1 page away from current selection
00218		Index += ItemsPerPage;
00219	
00220		// Adjust to bounds
00221		if (Index >= ItemCount)
00222			Index = ItemCount-1;
00223	
00224	
00225		if (Index < Top)  // If item is still before Top Item, go to it
00226			Top = Index;
00227		else if (Index - Top - ItemsPerPage >= ItemsPerPage)	// Too far away
00228			SetTopItem(Index);
00229		else if (Index - Top >= ItemsPerPage) // Just 1 page away
00230			SetTopItem(Top + ItemsPerPage);
00231	
00232		SetIndex(Index);
00233		MyScrollBar.AlignThumb();
00234	}
00235	
00236	
00237	
00238	
00239	
00240	defaultproperties
00241	{
00242	}

End Source Code