KF2-YetAnotherScoreboard/ScoreboardExt/Classes/KFGUI_Clickable.uc

95 lines
1.8 KiB
Ucode
Raw Normal View History

2020-01-10 13:14:11 +00:00
Class KFGUI_Clickable extends KFGUI_Base
abstract;
2020-01-10 13:14:11 +00:00
var() int IntIndex; // More user variables.
var() string ToolTip;
var KFGUI_Tooltip ToolTipItem;
var byte PressedDown[2];
var bool bPressedDown;
var bool bHoverSound;
function InitMenu()
{
Super.InitMenu();
bClickable = !bDisabled;
2020-01-10 13:14:11 +00:00
}
function MouseClick( bool bRight )
{
if( !bDisabled )
{
PressedDown[byte(bRight)] = 1;
bPressedDown = true;
}
2020-01-10 13:14:11 +00:00
}
function MouseRelease( bool bRight )
{
if( !bDisabled && PressedDown[byte(bRight)]==1 )
{
PlayMenuSound(MN_ClickButton);
PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0);
HandleMouseClick(bRight);
}
2020-01-10 13:14:11 +00:00
}
function MouseLeave()
{
Super.MouseLeave();
PressedDown[0] = 0;
PressedDown[1] = 0;
bPressedDown = false;
2020-01-10 13:14:11 +00:00
}
function MouseEnter()
{
Super.MouseEnter();
if( !bDisabled && bHoverSound )
PlayMenuSound(MN_FocusHover);
2020-01-10 13:14:11 +00:00
}
function SetDisabled( bool bDisable )
{
Super.SetDisabled(bDisable);
bClickable = !bDisable;
PressedDown[0] = 0;
PressedDown[1] = 0;
bPressedDown = false;
2020-01-10 13:14:11 +00:00
}
function NotifyMousePaused()
{
if( Owner.InputFocus==None && ToolTip!="" )
{
if( ToolTipItem==None )
{
ToolTipItem = New(None)Class'KFGUI_Tooltip';
ToolTipItem.Owner = Owner;
ToolTipItem.ParentComponent = Self;
ToolTipItem.InitMenu();
ToolTipItem.SetText(ToolTip);
}
ToolTipItem.ShowMenu();
ToolTipItem.CompPos[0] = Owner.MousePosition.X;
ToolTipItem.CompPos[1] = Owner.MousePosition.Y;
ToolTipItem.GetInputFocus();
}
2020-01-10 13:14:11 +00:00
}
final function ChangeToolTip( string S )
{
if( ToolTipItem!=None )
ToolTipItem.SetText(S);
else ToolTip = S;
2020-01-10 13:14:11 +00:00
}
function SetVisibility(bool Visible)
{
Super.SetVisibility(Visible);
SetDisabled(!Visible);
2020-01-10 13:14:11 +00:00
}
function HandleMouseClick( bool bRight );
defaultproperties
{
bHoverSound=true
2020-01-10 13:14:11 +00:00
}