KF2-YetAnotherScoreboard/YAS/Classes/KFGUI_Slider.uc

53 lines
964 B
Ucode
Raw Normal View History

2020-01-10 13:14:11 +00:00
class KFGUI_Slider extends KFGUI_MultiComponent;
var KFGUI_ScrollBarH ScrollBar;
2021-06-13 02:54:35 +00:00
var int MinValue, MaxValue;
2020-01-10 13:14:11 +00:00
var transient int CurrentValue;
delegate OnValueChanged(KFGUI_Slider Sender, int Value);
function InitMenu()
{
Super.InitMenu();
ScrollBar = KFGUI_ScrollBarH(FindComponentID('Scrollbar'));
ScrollBar.OnScrollChange = ValueChanged;
2020-01-10 13:14:11 +00:00
}
function int GetValue()
{
return CurrentValue;
2020-01-10 13:14:11 +00:00
}
function SetValue(int Value)
{
CurrentValue = Clamp(Value, MinValue, MaxValue);
OnValueChanged(self, CurrentValue);
2020-01-10 13:14:11 +00:00
}
function ValueChanged(KFGUI_ScrollBarBase Sender, int Value)
{
SetValue(Value);
2020-01-10 13:14:11 +00:00
}
function UpdateListVis()
{
2021-06-13 02:54:35 +00:00
ScrollBar.UpdateScrollSize(CurrentValue, MaxValue, 1,1, MinValue);
2020-01-10 13:14:11 +00:00
}
2021-06-13 03:00:19 +00:00
function ScrollMouseWheel(bool bUp)
2020-01-10 13:14:11 +00:00
{
2021-06-13 02:53:33 +00:00
if (!ScrollBar.bDisabled)
ScrollBar.ScrollMouseWheel(bUp);
2020-01-10 13:14:11 +00:00
}
defaultproperties
{
Begin Object Class=KFGUI_ScrollBarH Name=SliderScroll
XSize=1
YSize=0.5
ID="Scrollbar"
End Object
Components.Add(SliderScroll)
2020-01-10 13:14:11 +00:00
}