// List box with custom render code for the items. Class KFGUI_List extends KFGUI_MultiComponent; var() bool bDrawBackground; var() protected int ListCount; var() int ListItemsPerPage; var() color BackgroundColor; var KFGUI_ScrollBarV ScrollBar; var transient float OldXSize,ItemHeight,MouseYHit; var transient int FocusMouseItem,LastFocusItem; var byte PressedDown[2]; var bool bPressedDown; delegate OnDrawItem( Canvas C, int Index, float YOffset, float Height, float Width, bool bFocus ); // Requires bClickable=true to receive this event. delegate OnClickedItem( int Index, bool bRight, int MouseX, int MouseY ); delegate OnDblClickedItem( int Index, bool bRight, int MouseX, int MouseY ); function InitMenu() { Super.InitMenu(); ScrollBar = KFGUI_ScrollBarV(FindComponentID('Scrollbar')); UpdateListVis(); } function DrawMenu() { local int i,n; local float Y; local bool bCheckMouse; if( bDrawBackground ) { Canvas.DrawColor = BackgroundColor; Canvas.SetPos(0.f,0.f); Owner.CurrentStyle.DrawWhiteBox(CompPos[2],CompPos[3]); } // Mouse focused item check. bCheckMouse = bClickable && bFocused; FocusMouseItem = -1; if( bCheckMouse ) MouseYHit = Owner.MousePosition.Y - CompPos[1]; n = ScrollBar.CurrentScroll; ItemHeight = CompPos[3] / ListItemsPerPage; Y = 0; for( i=0; i=ListCount ) break; if( bCheckMouse && FocusMouseItem==-1 ) { if( MouseYHit=0 ) OnMouseRest(FocusMouseItem); } Delegate OnMouseRest( int Item ); defaultproperties { ListItemsPerPage=10 ListCount=1 BackgroundColor=(R=32,G=3,B=2,A=255) bDrawBackground=true Begin Object Class=KFGUI_ScrollBarV Name=ListScroller XPosition=0.96 YPosition=0 XSize=0.04 YSize=1 ID="Scrollbar" End Object Components.Add(ListScroller) }