Class Button
- Namespace
- RichHudFramework.UI
- Assembly
- RichHudClient.dll
Clickable button with a textured background.
No styling by default; it's just a clickable TexturedBox with highlighting.
public class Button : TexturedBox, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, IClickableElement, IFocusableElement
- Inheritance
-
Button
- Implements
- Derived
- Inherited Members
Examples
var btn = new Button(parent)
{
// Set custom texture. Donut shape.
Material = Material.AnnulusMat,
Color = Color.HotPink,
// Maximize texture size without clipping or warping. Default stretches to fit.
MatAlignment = MaterialAlignment.FitAuto,
MouseInput =
{
// Custom tooltip constructed from a string using default formatting
ToolTip = "You'll see this message when you hover over the button.",
// 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
Button()
public Button()
Button(HudParentBase)
public Button(HudParentBase parent)
Parameters
parentHudParentBase
Properties
FocusHandler
Interface used to manage the element's input focus state.
public IFocusHandler FocusHandler { get; }
Property Value
HighlightColor
Color of the background when moused over.
public Color HighlightColor { get; set; }
Property Value
HighlightEnabled
Determines whether or not the button will highlight when moused over.
public bool HighlightEnabled { get; set; }
Property Value
IsMousedOver
Indicates whether or not the cursor is currently positioned over the button.
public override bool IsMousedOver { get; }
Property Value
MouseInput
Handles mouse input for the button.
public IMouseInput MouseInput { get; }