Table of Contents

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

parent HudParentBase

Properties

BorderColor

Color of the border surrounding the on and off buttons

public Color BorderColor { get; set; }

Property Value

Color

ButtonPadding

Padding around on/off button block

public Vector2 ButtonPadding { get; set; }

Property Value

Vector2

ButtonSpacing

Distance between the on and off buttons

public float ButtonSpacing { get; set; }

Property Value

float

FocusHandler

Interface used to manage the element's input focus state.

public IFocusHandler FocusHandler { get; }

Property Value

IFocusHandler

Format

Default glyph format used by the on and off buttons

public GlyphFormat Format { get; set; }

Property Value

GlyphFormat

MouseInput

Mouse input element for the button

public IMouseInput MouseInput { get; }

Property Value

IMouseInput

Name

The name of the control as it appears in the terminal.

public RichText Name { get; set; }

Property Value

RichText

OffText

Off button text

public RichText OffText { get; set; }

Property Value

RichText

OnText

On button text

public RichText OnText { get; set; }

Property Value

RichText

UpdateValueCallback

Registers a Value update callback. Useful in initializers.

public EventHandler UpdateValueCallback { set; }

Property Value

EventHandler

Value

Current value of the on/off button

public bool Value { get; set; }

Property Value

bool

Events

ValueChanged

Invoked when Value changes

public event EventHandler ValueChanged

Event Type

EventHandler