Class SliderBar
- Namespace
- RichHudFramework.UI
- Assembly
- RichHudClient.dll
A clickable slider bar consisting of a track (Bar) and a movable thumb (Slider), based on MouseInputElement. It can be oriented vertically or horizontally, and the current value is automatically clamped between min and max.
Size is determined by the slider and bar, not Size or UnpaddedSize.
public class SliderBar : MouseInputElement, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, IMouseInput, IClickableElement, IFocusableElement, IValueControl<float>, IValueControl
- Inheritance
-
SliderBar
- Implements
- Inherited Members
Examples
new SliderBar(parent)
{
Min = 100, Max = 1000, Value = 450,
BarSize = new Vector2(200f, 20f),
SliderSize = new Vector2(50f, 30f),
UpdateValueCallback = (obj, args) =>
{
var slider = (SliderBar)obj;
MyAPIGateway.Utilities.ShowMessage(
$"[{slider.GetType().Name}]",
$"Value: {slider.Value:F1} ({slider.Percent:P1})"
);
},
ToolTip = "Slider input base type. No labels or styling."
};
Constructors
SliderBar()
public SliderBar()
SliderBar(HudParentBase)
public SliderBar(HudParentBase parent)
Parameters
parentHudParentBase
Properties
BarColor
The color of the track bar (background).
public Color BarColor { get; set; }
Property Value
BarHeight
The height of the track bar.
public float BarHeight { get; set; }
Property Value
BarHighlight
The color of the track bar when moused over.
public Color BarHighlight { get; set; }
Property Value
BarSize
The size of the track bar (background).
public Vector2 BarSize { get; set; }
Property Value
BarWidth
The width of the track bar.
public float BarWidth { get; set; }
Property Value
EnableHighlight
If true, the slider thumb (and optionally the track bar) will change to their highlight colors when moused over.
public bool EnableHighlight { get; set; }
Property Value
Max
The upper limit of the value range.
public float Max { get; set; }
Property Value
Min
The lower limit of the value range.
public float Min { get; set; }
Property Value
MouseInput
Handles mouse input for the slider bar.
public IMouseInput MouseInput { get; }
Property Value
Percent
The position of the slider thumb expressed as a percentage (0 to 1). At 0, the slider is at the minimum value; at 1, it is at the maximum.
public float Percent { get; set; }
Property Value
Reverse
Reverses the direction of the slider value.
Normal: Left/Top is Min, Right/Bottom is Max. Reverse: Left/Top is Max, Right/Bottom is Min.
public bool Reverse { get; set; }
Property Value
SliderColor
The color of the slider thumb (button) when not moused over.
public Color SliderColor { get; set; }
Property Value
SliderHeight
The height of the slider thumb (movable button).
public float SliderHeight { get; set; }
Property Value
SliderHighlight
The color of the slider thumb (button) when moused over.
public Color SliderHighlight { get; set; }
Property Value
SliderSize
The size of the slider thumb (movable button).
public Vector2 SliderSize { get; set; }
Property Value
SliderVisible
Determines whether the slider thumb (button) is currently visible.
public bool SliderVisible { get; set; }
Property Value
SliderWidth
The width of the slider thumb (movable button).
public float SliderWidth { get; set; }
Property Value
UpdateValueCallback
Helper property for registering a Value value update callback during initialization.
public EventHandler UpdateValueCallback { set; }
Property Value
Value
The currently selected value, bounded by the Min and Max values.
public float Value { get; set; }
Property Value
Vertical
If true, the slider will be oriented vertically (moves up/down). If false, it is horizontal.
public bool Vertical { get; set; }
Property Value
Events
ValueChanged
Invoked when the Value value changes.
public event EventHandler ValueChanged