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
parentHudParentBaseThe parent HUD element.
Fields
body
The container element for the window's main content area.
public readonly HudElementBase body
Field Value
border
The element responsible for rendering the window's border outline.
public readonly BorderBox border
Field Value
canMoveWindow
protected bool canMoveWindow
Field Value
cornerSize
The distance from the corner within which a mouse drag triggers diagonal resizing.
protected float cornerSize
Field Value
cursorOffset
protected Vector2 cursorOffset
Field Value
header
The UI element representing the window's header bar.
public readonly LabelBoxButton header
Field Value
inputInner
protected readonly MouseInputElement inputInner
Field Value
resizeDir
protected Vector2 resizeDir
Field Value
resizeInput
protected readonly MouseInputElement resizeInput
Field Value
windowBg
protected readonly TexturedBox windowBg
Field Value
Properties
AllowResizing
Determines if the user can resize the window by dragging its edges.
public bool AllowResizing { get; set; }
Property Value
BodyColor
Gets or sets the background color of the window's body area.
public virtual Color BodyColor { get; set; }
Property Value
BorderColor
Gets or sets the color of both the window border and the header background.
public virtual Color BorderColor { get; set; }
Property Value
CanDrag
Determines if the user can reposition the window by clicking and dragging the header.
public bool CanDrag { get; set; }
Property Value
FocusHandler
Handles the element's input focus state and registration.
public IFocusHandler FocusHandler { get; }
Property Value
HeaderBuilder
Exposes the ITextBuilder used to format and manipulate the header text.
public ITextBuilder HeaderBuilder { get; }
Property Value
HeaderText
Gets or sets the text displayed in the window's header.
public RichText HeaderText { get; set; }
Property Value
IsMousedOver
Indicates whether the mouse cursor is currently hovering over the window or its resize padding.
public override bool IsMousedOver { get; }
Property Value
MinimumSize
Gets or sets the minimum allowable dimensions for the window during resizing.
public Vector2 MinimumSize { get; set; }
Property Value
MouseInput
The generic mouse input handler for the window
public IMouseInput MouseInput { get; }
Property Value
WindowActive
Indicates whether the window is currently active.
public bool WindowActive { get; protected set; }
Property Value
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
cursorPosVector2The 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
newLayerbyteThe 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
cursorPosVector2The current position of the cursor.