2022-09-03 17:26:40 +00:00
|
|
|
class KFGUI_Clickable extends KFGUI_Base
|
2021-05-16 09:40:02 +00:00
|
|
|
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()
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
Super.InitMenu();
|
|
|
|
bClickable = !bDisabled;
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
2021-06-13 03:00:19 +00:00
|
|
|
function MouseClick(bool bRight)
|
2020-01-10 13:14:11 +00:00
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
if (!bDisabled)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
PressedDown[byte(bRight)] = 1;
|
|
|
|
bPressedDown = true;
|
|
|
|
}
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
2021-06-13 03:00:19 +00:00
|
|
|
function MouseRelease(bool bRight)
|
2020-01-10 13:14:11 +00:00
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
if (!bDisabled && PressedDown[byte(bRight)] == 1)
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
|
|
|
PlayMenuSound(MN_ClickButton);
|
|
|
|
PressedDown[byte(bRight)] = 0;
|
2021-06-13 02:53:33 +00:00
|
|
|
bPressedDown = (PressedDown[0] != 0 || PressedDown[1] != 0);
|
2021-05-16 09:40:02 +00:00
|
|
|
HandleMouseClick(bRight);
|
|
|
|
}
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
function MouseLeave()
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
Super.MouseLeave();
|
|
|
|
PressedDown[0] = 0;
|
|
|
|
PressedDown[1] = 0;
|
|
|
|
bPressedDown = false;
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
function MouseEnter()
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
Super.MouseEnter();
|
2021-06-13 02:53:33 +00:00
|
|
|
if (!bDisabled && bHoverSound)
|
2021-05-16 09:40:02 +00:00
|
|
|
PlayMenuSound(MN_FocusHover);
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
2021-06-13 03:00:19 +00:00
|
|
|
function SetDisabled(bool bDisable)
|
2020-01-10 13:14:11 +00:00
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
Super.SetDisabled(bDisable);
|
|
|
|
bClickable = !bDisable;
|
|
|
|
PressedDown[0] = 0;
|
|
|
|
PressedDown[1] = 0;
|
|
|
|
bPressedDown = false;
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function NotifyMousePaused()
|
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
if (Owner.InputFocus == None && ToolTip != "")
|
2021-05-16 09:40:02 +00:00
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
if (ToolTipItem == None)
|
2021-05-16 09:40:02 +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-01-10 13:14:11 +00:00
|
|
|
}
|
2021-06-13 03:00:19 +00:00
|
|
|
final function ChangeToolTip(string S)
|
2020-01-10 13:14:11 +00:00
|
|
|
{
|
2021-06-13 02:53:33 +00:00
|
|
|
if (ToolTipItem != None)
|
2021-05-16 09:40:02 +00:00
|
|
|
ToolTipItem.SetText(S);
|
|
|
|
else ToolTip = S;
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
function SetVisibility(bool Visible)
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
Super.SetVisibility(Visible);
|
|
|
|
SetDisabled(!Visible);
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|
|
|
|
|
2021-06-13 03:00:19 +00:00
|
|
|
function HandleMouseClick(bool bRight);
|
2020-01-10 13:14:11 +00:00
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
2021-05-16 09:40:02 +00:00
|
|
|
bHoverSound=true
|
2020-01-10 13:14:11 +00:00
|
|
|
}
|