Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# GUI.GUIListBase

00001 00002 00003 00004 00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126

    // ====================================================================
    //  Class:  GUI.GUIListBase
    //
    //  Abstract GUIList list box component.
    //
    //  Written by Joe Wilcox
    //  Made abstract by Jack Porter
    //  (c) 2002, Epic Games, Inc.  All Rights Reserved
    // ====================================================================
    /*=============================================================================
    	In Game GUI Editor System V1.0
    	2003 - Irrational Games, LLC.
    	* Dan Kaplan
    =============================================================================*/
    #if !IG_GUI_LAYOUT
    #error This code requires IG_GUI_LAYOUT to be defined due to extensive revisions of the origional code. [DKaplan]
    #endif
    /*===========================================================================*/

    class GUIListBase extends GUIComponent
            HideCategories(Menu,Object)
    		Native
    		Abstract;

    cpptext
    {
    	virtual void DrawItem(UCanvas* Canvas, INT Item, FLOAT X, FLOAT Y, FLOAT W, FLOAT H) {}
    }

    var(GUIListBase) config color				SelectedBKColor "Color for a selection background";
    var(GUIListBase) config Material			SelectedImage "Image to use when displaying";
    var(GUIListBase) EditConst int 	    		Top,Index "Pointers in to the list";
    var(GUIListBase) EditConst int				ItemsPerPage "# of items per Page.  Is set natively";
    var(GUIListBase) EditConst int				ItemHeight "Size of each row.  Subclass should set in PreDraw.";
    var(GUIListBase) EditConst int				ItemWidth "Width of each row.. Subclass should set in PreDraw.";
    var(GUIListBase) EditConst int				ItemCount "# of items in this list";
    var(GUIListBase) config bool				bHotTrack "Use the Mouse X/Y to always hightlight something";
    var(GUIListBase) config bool				bVisibleWhenEmpty "List is still drawn when there are no items in it.";
    var(GUIListBase) config bool				bReadOnly "If true, list is unselectable";

    var		GUIScrollBarBase	MyScrollBar;

    // Owner-draw.
    delegate OnDrawItem(Canvas Canvas, int Item, float X, float Y, float W, float H, bool bSelected);
    delegate OnAdjustTop(GUIComponent Sender);

    function InitComponent(GUIComponent Owner)
    {
        Super.InitComponent(Owner);
    }

    function Sort(); // should be implemented in subclass

    function int SetIndex(int NewIndex, optional bool bDontPropChange, optional bool bDontReAlign )
    {
    	if (NewIndex < 0 || NewIndex >= ItemCount)
    		Index = -1;
    	else
    		Index = NewIndex;

    	if( !bDontReAlign && (index>=0) && (ItemsPerPage>0) )
    	{
    		if (Index<top)
    			Top = Index;

    		if (ItemsPerPage != 0 && Index>=Top+ItemsPerPage)
    			Top = Index-ItemsPerPage+1;

    	    if( ItemsPerPage >= ItemCount )
                Top = 0;
        }

    	if( MyScrollBar != None )
        	MyScrollBar.AlignThumb();

    	if( !bDontPropChange )
        	OnChange(self);

        SetDirty();
    	return Index;
    }

    function Clear()
    {
    	Top = 0;
    	ItemCount=0;
    	SetIndex(-1);
    	if( MyScrollBar != None )
        	MyScrollBar.AlignThumb();
    }

    function MakeVisible(float Perc)
    {
    	SetTopItem(int((ItemCount-ItemsPerPage) * Perc));
    }

    function SetTopItem(int Item)
    {
    	Top = Item;
    	if (Top+ItemsPerPage>=ItemCount)
    		Top = ItemCount - ItemsPerPage;

    	if ( Top<0 || ItemsPerPage>=ItemCount )
    		Top=0;

    	SetDirty();
    	OnAdjustTop(Self);
    }

    defaultproperties
    {
    	bAcceptsInput=true
    	StyleName="STY_ListBox"
        TextAlign=TXTA_Left
    	SelectedBKColor=(R=170,G=194,B=232,A=255)
    	//SelectedImage=material'GUITribes.ButtonFillBright'
    	Top=0
    	Index=0
    	ItemsPerPage=0
    	bTabStop=true
    	bVisibleWhenEmpty=false
    	bCaptureMouse=true
    	bDrawStyle=true
    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

Class file time: ne 5.9.2004 16:02:10.000 - Creation time: st 23.5.2018 00:10:43.818 - Created with UnCodeX