GUI
Class GUIListBase

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

class GUIListBase
extends GUI.GUIComponent

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

Function Summary
 void Clear()
 void MakeVisible(float Perc)
 int SetIndex(int NewIndex)
     
// Add in a bit
 void SetTopItem(int Item)
 void Sort()
     
// Owner-draw.



Source Code


00001	// ====================================================================
00002	//  (c) 2002, Epic Games, Inc.  All Rights Reserved
00003	// ====================================================================
00004	
00005	class GUIListBase extends GUIComponent
00006			Native
00007			Abstract;
00008	
00009	//#exec OBJ LOAD FILE=GUIContent.utx
00010		
00011			
00012	var		bool				bSorted;			// Should we sort this list
00013	var		color				SelectedBKColor;	// Color for a selection background
00014	var		Material			SelectedImage;		// Image to use when displaying
00015	var		int 				Top,Index;			// Pointers in to the list
00016	var		int					ItemsPerPage;		// # of items per Page.  Is set natively
00017	var		int					ItemHeight;			// Size of each row.  Subclass should set in PreDraw.
00018	var		int					UserDefinedItemHeight;	// SOUTHEND height of each row. if not zero this will be used instead of the automatic calculation of how many will fit...  Subclass should set in PreDraw.
00019	var		int					ItemWidth;			// Width of each row.. Subclass should set in PreDraw.
00020	var		int					ItemCount;			// # of items in this list
00021	var		bool				bHotTrack;			// Use the Mouse X/Y to always hightlight something
00022	var		bool				bVisibleWhenEmpty;	// List is still drawn when there are no items in it.
00023	
00024	var		GUIScrollBarBase	MyScrollBar;
00025	
00026	
00027	// Owner-draw.
00028	delegate OnDrawItem(Canvas Canvas, int Item, float X, float Y, float W, float H, bool bSelected);
00029	delegate OnAdjustTop(GUIComponent Sender);
00030	
00031	function Sort();	// Add in a bit
00032	
00033	function int SetIndex(int NewIndex)
00034	{
00035		if (NewIndex < 0 || NewIndex >= ItemCount)
00036			Index = -1;
00037		else
00038			Index = NewIndex;
00039	
00040		if ( (index>=0) && (ItemsPerPage>0) )
00041		{
00042			if (Index<top)
00043				Top = Index;
00044				
00045			if (ItemsPerPage != 0 && Index==Top+ItemsPerPage)
00046				Top = Index-ItemsPerPage+1;
00047		}		
00048			
00049		OnChange(self);
00050		return Index;
00051	}
00052	
00053	function Clear()
00054	{
00055		Top = 0;
00056		ItemCount=0;
00057		SetIndex(-1);
00058		MyScrollBar.AlignThumb();
00059	}
00060	
00061	function MakeVisible(float Perc)
00062	{
00063		SetTopItem(int((ItemCount-ItemsPerPage) * Perc));
00064	}
00065	
00066	function SetTopItem(int Item)
00067	{
00068		Top = Item;
00069		if (Top+ItemsPerPage>=ItemCount)
00070			Top = ItemCount - ItemsPerPage; 	
00071	
00072		if (Top<0)
00073			Top=0;
00074			
00075		OnAdjustTop(Self);		
00076	}
00077	
00078	
00079	
00080	defaultproperties
00081	{
00082	     SelectedBKColor=(B=255,G=255,R=255,A=255)
00083	     bAcceptsInput=True
00084	     bTabStop=True
00085	}

End Source Code