GUI
Class GUIImageList

source: C:\XIII\GUI\Classes\GUIImageList.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUIImage
            |
            +--GUI.GUIImageList
Direct Known Subclasses:None

class GUIImageList
extends GUI.GUIImage

// ==================================================================== // (c) 2002, Epic Games, Inc. All Rights Reserved // ====================================================================
Variables
 int CurIndex
 array MatNames
 array Materials
 bool bWrap


Function Summary
 void AddMaterial(string MatName, out Material)
 void FirstImage()
 string GetCurMatName()
 void InitComponent(GUIController MyController, GUIComponent MyOwner)
 void LastImage()
 void NextImage()
 void PrevImage()
 void SetIndex(int index)
 bool internalKeyEvent(out byte, out byte, float delta)



Source Code


00001	// ====================================================================
00002	//  (c) 2002, Epic Games, Inc.  All Rights Reserved
00003	// ====================================================================
00004	
00005	class GUIImageList extends GUIImage;
00006	//	Native;
00007	
00008	var array<string> MatNames;
00009	var array<Material> Materials;
00010	var int CurIndex;
00011	var bool bWrap;
00012	
00013	function InitComponent(GUIController MyController, GUIComponent MyOwner)
00014	{
00015		Super.Initcomponent(MyController, MyOwner);
00016		OnKeyEvent=internalKeyEvent;
00017	}
00018	
00019	function AddMaterial(string MatName, out Material Mat)
00020	{
00021	local int i;
00022	
00023		if (Mat != None)
00024		{
00025			i = Materials.Length;
00026			Materials[i]=Mat;
00027			MatNames[i]=MatName;
00028		}
00029	}
00030	
00031	function string GetCurMatName()
00032	{
00033		if (CurIndex >= 0 && CurIndex < Materials.Length)
00034			return MatNames[CurIndex];
00035	
00036		return "";
00037	}
00038	
00039	function SetIndex(int index)
00040	{
00041		if (index >= 0 && index < Materials.Length)
00042		{
00043			CurIndex = index;
00044			Image = Materials[index];
00045		}
00046		else
00047		{
00048			Image = None;
00049			CurIndex = -1;
00050		}
00051	}
00052	
00053	function bool internalKeyEvent(out byte Key, out byte State, float delta)
00054	{
00055		if ( ((Key==0x26 || Key==0x68 || Key==0x25 || Key==0x64) && (State==1)) || (key==0xEC && State==3) )	// Up/Left/MouseWheelUp
00056		{
00057			PrevImage();
00058			return true;
00059		}
00060		
00061		if ( ((Key==0x28 || Key==0x62 || Key==0x27 || Key==0x66) && (State==1)) || (key==0xED && State==3) )  // Down/Right/MouseWheelDn
00062		{
00063			NextImage();
00064			return true;
00065		}
00066		
00067		if ( (Key==0x24 || Key==0x67) && (State==1) ) // Home
00068		{
00069			FirstImage();
00070			return true;
00071		}
00072		
00073		if ( (Key==0x23 || Key==0x61) && (State==1) ) // End
00074		{
00075			LastImage();
00076			return true;
00077		}
00078	
00079		return false;
00080	}
00081	
00082	function PrevImage()
00083	{
00084		if (CurIndex < 1)
00085		{
00086			if (bWrap)
00087				SetIndex(Materials.Length - 1);
00088		}
00089		else
00090			SetIndex(CurIndex - 1);
00091	}
00092	
00093	function NextImage()
00094	{
00095		if (CurIndex < 0)
00096			SetIndex(0);
00097		else if ((CurIndex + 1) >= Materials.Length)
00098		{
00099			if (bWrap)
00100				SetIndex(0);
00101		}
00102		else
00103			SetIndex(CurIndex + 1);
00104	}
00105	
00106	function FirstImage()
00107	{
00108		if (Materials.Length > 0)
00109			SetIndex(0);
00110	}
00111	
00112	function LastImage()
00113	{
00114		if (Materials.Length > 0)
00115			SetIndex(Materials.Length - 1);
00116	}
00117	
00118	
00119	
00120	defaultproperties
00121	{
00122	     bAcceptsInput=True
00123	     bCaptureMouse=True
00124	     bTabStop=True
00125	}

End Source Code