Table of Contents

Class LabelBoxButton

Namespace
RichHudFramework.UI
Assembly
RichHudClient.dll

Clickable button with text on top of a textured background with highlighting.

public class LabelBoxButton : LabelBox, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, ILabelElement, IMinLabelElement, IClickableElement, IFocusableElement
Inheritance
LabelBoxButton
Implements
Derived
Inherited Members

Examples

var btn = new LabelBoxButton(parent)
{
    BuilderMode = TextBuilderModes.Lined, // Multi-line text
    Format = GlyphFormat.White.WithFont("Monospace"), // Chunky Monospace label
    Text = "Clickable label\nwith a background",
    Color = Color.Purple, // Purple background
    TextPadding = new Vector2(20f), // 20pt padding / 2 = 10pts on all four sides
    MouseInput = 
    {
        // Custom tooltip constructed from RichText using default background
        ToolTip = new RichText { { 
            "A tooltip with a custom font? Why not?", 
            GlyphFormat.White.WithFont("Monospace") 
        } },
        // Add callback invoked on click
        LeftClickedCallback = (obj, args) => MyAPIGateway.Utilities.ShowMessage(
            $"[{obj.GetType().Name}]", // Print button type name
            "You'll see this chat message when the button is clicked.")
    }
};

Constructors

LabelBoxButton()

public LabelBoxButton()

LabelBoxButton(HudParentBase)

public LabelBoxButton(HudParentBase parent)

Parameters

parent HudParentBase

Properties

FocusHandler

Interface used to manage the element's input focus state

public IFocusHandler FocusHandler { get; }

Property Value

IFocusHandler

HighlightColor

Color of the background when moused over.

public virtual Color HighlightColor { get; set; }

Property Value

Color

HighlightEnabled

Determines whether or not the button will highlight when moused over.

public virtual bool HighlightEnabled { get; set; }

Property Value

bool

IsMousedOver

Indicates whether or not the cursor is currently over the element.

public override bool IsMousedOver { get; }

Property Value

bool

MouseInput

Mouse input for the button.

public IMouseInput MouseInput { get; }

Property Value

IMouseInput