Table of Contents

Class WindowBase

Namespace
RichHudFramework.UI
Assembly
RichHudClient.dll

Base class for a standard window element featuring a header, body, and border. Includes built-in support for mouse dragging, edge resizing, and focus management.

public abstract class WindowBase : HudElementBase, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, IClickableElement, IFocusableElement
Inheritance
WindowBase
Implements
Inherited Members

Constructors

WindowBase(HudParentBase)

Initializes a new instance of the WindowBase class.

public WindowBase(HudParentBase parent)

Parameters

parent HudParentBase

The parent HUD element.

Fields

body

The container element for the window's main content area.

public readonly HudElementBase body

Field Value

HudElementBase

border

The element responsible for rendering the window's border outline.

public readonly BorderBox border

Field Value

BorderBox

canMoveWindow

protected bool canMoveWindow

Field Value

bool

cornerSize

The distance from the corner within which a mouse drag triggers diagonal resizing.

protected float cornerSize

Field Value

float

cursorOffset

protected Vector2 cursorOffset

Field Value

Vector2

header

The UI element representing the window's header bar.

public readonly LabelBoxButton header

Field Value

LabelBoxButton

inputInner

protected readonly MouseInputElement inputInner

Field Value

MouseInputElement

resizeDir

protected Vector2 resizeDir

Field Value

Vector2

resizeInput

protected readonly MouseInputElement resizeInput

Field Value

MouseInputElement

windowBg

protected readonly TexturedBox windowBg

Field Value

TexturedBox

Properties

AllowResizing

Determines if the user can resize the window by dragging its edges.

public bool AllowResizing { get; set; }

Property Value

bool

BodyColor

Gets or sets the background color of the window's body area.

public virtual Color BodyColor { get; set; }

Property Value

Color

BorderColor

Gets or sets the color of both the window border and the header background.

public virtual Color BorderColor { get; set; }

Property Value

Color

CanDrag

Determines if the user can reposition the window by clicking and dragging the header.

public bool CanDrag { get; set; }

Property Value

bool

FocusHandler

Handles the element's input focus state and registration.

public IFocusHandler FocusHandler { get; }

Property Value

IFocusHandler

HeaderBuilder

Exposes the ITextBuilder used to format and manipulate the header text.

public ITextBuilder HeaderBuilder { get; }

Property Value

ITextBuilder

HeaderText

Gets or sets the text displayed in the window's header.

public RichText HeaderText { get; set; }

Property Value

RichText

IsMousedOver

Indicates whether the mouse cursor is currently hovering over the window or its resize padding.

public override bool IsMousedOver { get; }

Property Value

bool

MinimumSize

Gets or sets the minimum allowable dimensions for the window during resizing.

public Vector2 MinimumSize { get; set; }

Property Value

Vector2

MouseInput

The generic mouse input handler for the window

public IMouseInput MouseInput { get; }

Property Value

IMouseInput

WindowActive

Indicates whether the window is currently active.

public bool WindowActive { get; protected set; }

Property Value

bool

Methods

GetWindowFocus()

Brings the window to the foreground (top Z-layer) and captures input focus. Overriding methods must call the base implementation.

public virtual void GetWindowFocus()

HandleInput(Vector2)

Handles mouse input for resizing, dragging, and focus acquisition.

protected override void HandleInput(Vector2 cursorPos)

Parameters

cursorPos Vector2

The current cursor position.

Layout()

Updates the layout of the window's body relative to the header size.

protected override void Layout()

LoseWindowFocus(byte)

Callback triggered when the window loses focus to another element. Overriding methods must call the base implementation.

protected virtual void LoseWindowFocus(byte newLayer)

Parameters

newLayer byte

The new Z-offset layer assigned to this window.

Resize(Vector2)

Calculates and applies the new window size and position based on the drag delta and resize direction.

protected void Resize(Vector2 cursorPos)

Parameters

cursorPos Vector2

The current position of the cursor.