Class NamedOnOffButton
- Namespace
- RichHudFramework.UI
- Assembly
- RichHudClient.dll
A labeled pair of horizontally aligned on and off bordered buttons used to indicate a boolean value. Made to resemble on/off toggle used in the SE terminal.
Adds a label to OnOffButton.
Formatting temporarily changes when it gains input focus.
public class NamedOnOffButton : HudElementBase, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, IClickableElement, IFocusableElement, IValueControl<bool>, IValueControl
- Inheritance
-
NamedOnOffButton
- Implements
- Inherited Members
Examples
This example creates a labeled on/off toggle with a ColorPickerHSV below it, whose input is enabled or disabled according to the toggle.
new HudChain(parent)
{
AlignVertical = true, // Create a vertical toggle + HSV picker stack
Spacing = 10f,
CollectionContainer =
{
new NamedOnOffButton
{
Name = "Color picker input toggle",
UpdateValueCallback = (obj, args) =>
{
var toggle = (NamedOnOffButton)obj;
var chain = (HudChain)toggle.Parent;
// Get the color picker below and set its input state
chain[1].Element.InputEnabled = toggle.Value;
},
MouseInput =
{
ToolTip = "This toggle enables/disables the color picker's input."
}
},
new ColorPickerHSV()
}
};
Constructors
NamedOnOffButton()
public NamedOnOffButton()
NamedOnOffButton(HudParentBase)
public NamedOnOffButton(HudParentBase parent)
Parameters
parentHudParentBase
Properties
BorderColor
Color of the border surrounding the on and off buttons
public Color BorderColor { get; set; }
Property Value
ButtonPadding
Padding around on/off button block
public Vector2 ButtonPadding { get; set; }
Property Value
ButtonSpacing
Distance between the on and off buttons
public float ButtonSpacing { get; set; }
Property Value
FocusHandler
Interface used to manage the element's input focus state.
public IFocusHandler FocusHandler { get; }
Property Value
Format
Default glyph format used by the on and off buttons
public GlyphFormat Format { get; set; }
Property Value
MouseInput
Mouse input element for the button
public IMouseInput MouseInput { get; }
Property Value
Name
The name of the control as it appears in the terminal.
public RichText Name { get; set; }
Property Value
OffText
Off button text
public RichText OffText { get; set; }
Property Value
OnText
On button text
public RichText OnText { get; set; }
Property Value
UpdateValueCallback
Registers a Value update callback. Useful in initializers.
public EventHandler UpdateValueCallback { set; }
Property Value
Value
Current value of the on/off button
public bool Value { get; set; }
Property Value
Events
ValueChanged
Invoked when Value changes
public event EventHandler ValueChanged