KF2-Server-Extension/ServerExt/Classes/KFGUI_Clickable.uc

94 lines
1.6 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
Class KFGUI_Clickable extends KFGUI_Base
abstract;
var() int IntIndex; // More user variables.
var() string ToolTip;
var KFGUI_Tooltip ToolTipItem;
var byte PressedDown[2];
var bool bPressedDown;
function InitMenu()
{
Super.InitMenu();
bClickable = !bDisabled;
}
2020-11-28 21:54:57 +00:00
2020-11-28 20:04:55 +00:00
function MouseClick(bool bRight)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (!bDisabled)
2017-10-20 02:00:49 +00:00
{
PressedDown[byte(bRight)] = 1;
bPressedDown = true;
}
}
2020-11-28 21:54:57 +00:00
2020-11-28 20:04:55 +00:00
function MouseRelease(bool bRight)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (!bDisabled && PressedDown[byte(bRight)]==1)
2017-10-20 02:00:49 +00:00
{
PressedDown[byte(bRight)] = 0;
bPressedDown = (PressedDown[0]!=0 || PressedDown[1]!=0);
HandleMouseClick(bRight);
}
}
2020-11-28 21:54:57 +00:00
2017-10-20 02:00:49 +00:00
function MouseLeave()
{
Super.MouseLeave();
2020-11-28 20:12:58 +00:00
if (!bDisabled)
2017-10-20 02:00:49 +00:00
PlayMenuSound(MN_LostFocus);
PressedDown[0] = 0;
PressedDown[1] = 0;
bPressedDown = false;
}
2020-11-28 21:54:57 +00:00
2017-10-20 02:00:49 +00:00
function MouseEnter()
{
Super.MouseEnter();
2020-11-28 20:12:58 +00:00
if (!bDisabled)
2017-10-20 02:00:49 +00:00
PlayMenuSound(MN_Focus);
}
2020-11-28 20:04:55 +00:00
function SetDisabled(bool bDisable)
2017-10-20 02:00:49 +00:00
{
Super.SetDisabled(bDisable);
bClickable = !bDisable;
PressedDown[0] = 0;
PressedDown[1] = 0;
bPressedDown = false;
}
function NotifyMousePaused()
{
2020-11-28 20:12:58 +00:00
if (Owner.InputFocus==None && ToolTip!="")
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (ToolTipItem==None)
2017-10-20 02:00:49 +00:00
{
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-11-28 21:54:57 +00:00
2020-11-28 20:04:55 +00:00
final function ChangeToolTip(string S)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (ToolTipItem!=None)
2017-10-20 02:00:49 +00:00
ToolTipItem.SetText(S);
else ToolTip = S;
}
2020-11-28 20:04:55 +00:00
function HandleMouseClick(bool bRight);
2017-10-20 02:00:49 +00:00
defaultproperties
{
2023-05-14 02:49:12 +00:00
2017-10-20 02:00:49 +00:00
}