## GUI
Class GUIMultiComponent

source: C:\XIII\GUI\Classes\GUIMultiComponent.uc

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUIMultiComponent

Direct Known Subclasses:GUIListBoxBase, GUIPage, GUIScrollBarBase

class GUIMultiComponent
extends GUI.GUIComponent

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

States
Newstate

Function Summary
`void` | `InitComponent(GUIController MyController, GUIComponent MyOwner)`
`string` | `LoadINI()`
`void` | `SaveINI(string Value)`

State Newstate Function Summary

Source Code

    00001	// ====================================================================
    00002	//  (c) 2002, Epic Games, Inc.  All Rights Reserved
    00003	// ====================================================================
    00004
    00005	class GUIMultiComponent extends GUIComponent
    00006			Native;
    00007
    00008
    00009	var		array<GUIComponent>		Controls;				// An Array of Components that make up this Control
    00010	var		GUIComponent			FocusedControl;			// Which component inside this one has focus
    00011
    00012	event int FindComponentIndex(GUIComponent Who)
    00013	{
    00014		local int i;
    00015
    00016		for (i=0;i<Controls.Length;i++)
    00017			if (Who==Controls[i])
    00018				return i;
    00019
    00020		return -1;
    00021	}
    00022
    00023	function InitComponent(GUIController MyController, GUIComponent MyOwner)
    00024	{
    00025		local int i;
    00026
    00027		Super.Initcomponent(MyController, MyOwner);
    00028
    00029		for (i=0;i<Controls.Length;i++)
    00030		{
    00031			Controls[i].InitComponent(MyController, Self);
    00032		}
    00033	}
    00034
    00035	event SetFocus(GUIComponent Who)
    00036	{
    00037		if (bNeverFocus)
    00038		{
    00039			if (FocusInstead != None)
    00040				FocusInstead.SetFocus(Who);
    00041
    00042			return;
    00043		}
    00044		if (Who==None)
    00045		{
    00046
    00047			if (Controller.FocusedControl!=None)
    00048				Controller.FocusedControl.LoseFocus(None);
    00049
    00050			FocusFirst(Self,true);
    00051			return;
    00052		}
    00053		else
    00054			FocusedControl = Who;
    00055
    00056		MenuStateChange(MSAT_Focused);
    00057
    00058		if (MenuOwner!=None)
    00059			MenuOwner.SetFocus(self);
    00060	}
    00061
    00062	event LoseFocus(GUIComponent Sender)
    00063	{
    00064	/*
    00065		Controller.FocusedControl = None;
    00066
    00067		if (FocusedControl!=None
    00068			FocusedControl.LoseFocus();
    00069
    00070		MenuStateChange(MSAT_Blurry);
    00071	*/
    00072		FocusedControl = None;
    00073		Super.LoseFocus(Sender);
    00074	}
    00075
    00076
    00077	event bool FocusFirst(GUIComponent Sender, bool bIgnoreMultiTabStops)
    00078	{
    00079
    00080		local int i;
    00081
    00082		if ( (!bVisible) || (MenuState==MSAT_Disabled) )
    00083			return false;
    00084
    00085		// Grab focus if not ignoring them
    00086
    00087		if  ( (bTabStop) && (!bIgnoreMultiTabStops) )
    00088		{
    00089			Super.FocusFirst(Sender, bIgnoreMultiTabStops);
    00090			return true;
    00091		}
    00092
    00093		for (i=0;i<Controls.Length;i++)
    00094		{
    00095			if ( Controls[i].FocusFirst(self, bIgnoreMultiTabStops) )
    00096				return true;
    00097		}
    00098
    00099		return false;
    00100	}
    00101
    00102
    00103	event bool FocusLast(GUIComponent Sender, bool bIgnoreMutliTabStops)
    00104	{
    00105		local int i;
    00106
    00107		if ( (!bVisible) || (MenuState==MSAT_Disabled) )
    00108			return false;
    00109
    00110		if  ( (bTabStop) && (!bIgnoreMutliTabStops) ) //&& (FocusedControl!=None) )
    00111		{
    00112			Super.FocusLast(Sender, bIgnoreMutliTabStops);
    00113			return true;
    00114		}
    00115
    00116		for (i=Controls.Length;i>0;i--)
    00117		{
    00118			if (Controls[i-1].FocusLast(self, bIgnoreMutliTabStops) )
    00119				return true;
    00120		}
    00121
    00122		return false;
    00123	}
    00124
    00125	event bool NextControl(GUIComponent Sender)
    00126	{
    00127		local int index,i;
    00128
    00129		index = FindComponentIndex(Sender);
    00130
    00131		index++;
    00132		while (index<Controls.Length)
    00133		{
    00134			if ( Controls[index].FocusFirst(Self,false) )
    00135			{
    00136				return true;
    00137			}
    00138
    00139			index++;
    00140		}
    00141
    00142		// Noone. Try to leave..
    00143
    00144		if (MenuOwner!=None)
    00145		{
    00146			return MenuOwner.NextControl(self);
    00147		}
    00148
    00149		// Otherwise.. loop
    00150
    00151		i = 0;
    00152		while ( i < Index)
    00153		{
    00154			if (Controls[i].FocusFirst(Self,False))
    00155				return true;
    00156
    00157			i++;
    00158		}
    00159
    00160		return false;
    00161
    00162	}
    00163
    00164	event bool PrevControl(GUIComponent Sender)
    00165	{
    00166
    00167		local int index, i;
    00168
    00169		index = FindComponentIndex(Sender);
    00170		index--;
    00171		while (index>=0)
    00172		{
    00173			if ( Controls[index].FocusLast(Self,false) )
    00174				return true;
    00175
    00176			index--;
    00177		}
    00178
    00179		// Noone. Try to leave..
    00180
    00181		if (MenuOwner!=None)
    00182		{
    00183			return MenuOwner.PrevControl(self);
    00184		}
    00185
    00186		// Otherwise.. loop
    00187
    00188		i = Controls.Length;
    00189		while (i>Index)
    00190		{
    00191			i--;
    00192			 if (Controls[i].FocusLast(Self,false))
    00193				return true;
    00194		}
    00195
    00196		return false;
    00197
    00198	}
    00199
    00200	function string LoadINI()
    00201	{
    00202		local int i;
    00203
    00204		for (i=0;i<Controls.Length;i++)
    00205			Controls[i].LoadINI();
    00206
    00207		Super.LoadINI();
    00208
    00209		return "";
    00210	}
    00211
    00212	function SaveINI(string Value)
    00213	{
    00214		local int i;
    00215
    00216		for (i=0;i<Controls.Length;i++)
    00217			Controls[i].SaveINI("");
    00218
    00219		Super.SaveINI(Value);
    00220
    00221		return;
    00222	}
    00223
    00224	event MenuStateChange(eMenuState Newstate)
    00225	{
    00226
    00227		local int i;
    00228
    00229		if (NewState==MSAT_Disabled)
    00230		{
    00231			for (i=0;i<Controls.Length;i++)
    00232				Controls[i].MenuStateChange(MSAT_Disabled);
    00233		}
    00234		else
    00235		{
    00236			for (i=0;i<Controls.Length;i++)
    00237				if (Controls[i].MenuState==MSAT_Disabled)
    00238					Controls[i].MenuStateChange(MSAT_Blurry);
    00239		}
    00240
    00241		Super.MenuStateChange(NewState);
    00242	}
    00243
00244 00245 00246 00247 00248 defaultproperties 00249 { 00250 }

End Source Code