Table of Contents

Interface IGuiControl

Namespace
Gloam.Core.Ui.Interfaces.Controls
Assembly
Gloam.Core.Ui.dll

Represents a GUI control that can be rendered, updated, and interacted with

public interface IGuiControl

Properties

Background

Gets or sets the background color of the control

Color Background { get; set; }

Property Value

Color

Children

Gets the collection of child controls

IList<IGuiControl> Children { get; }

Property Value

IList<IGuiControl>

DrawOrder

Gets or sets the drawing order priority (higher values drawn later)

int DrawOrder { get; set; }

Property Value

int

Foreground

Gets or sets the foreground color of the control

Color Foreground { get; set; }

Property Value

Color

HoverBackground

Gets or sets the background color when the control is hovered

Color HoverBackground { get; set; }

Property Value

Color

HoverForeground

Gets or sets the foreground color when the control is hovered

Color HoverForeground { get; set; }

Property Value

Color

IsDirty

Gets or sets whether the control needs to be redrawn

bool IsDirty { get; set; }

Property Value

bool

IsFocused

Gets or sets whether the control currently has focus

bool IsFocused { get; set; }

Property Value

bool

IsHovered

Gets whether the control is currently being hovered by the mouse

bool IsHovered { get; }

Property Value

bool

IsVisible

Gets or sets whether the control is visible

bool IsVisible { get; set; }

Property Value

bool

Parent

Gets or sets the parent control

IGuiControl? Parent { get; set; }

Property Value

IGuiControl

Position

Gets or sets the position of the control

Position Position { get; set; }

Property Value

Position

Size

Gets or sets the size of the control

Size Size { get; set; }

Property Value

Size

Methods

AddChild(IGuiControl)

Adds a child control to this control

void AddChild(IGuiControl child)

Parameters

child IGuiControl

The child control to add

Contains(Position)

Determines if a point is within the bounds of this control

bool Contains(Position point)

Parameters

point Position

The point to test

Returns

bool

True if the point is within the control bounds

Invalidate()

Marks the control as dirty, requiring a redraw

void Invalidate()

RemoveChild(IGuiControl)

Removes a child control from this control

bool RemoveChild(IGuiControl child)

Parameters

child IGuiControl

The child control to remove

Returns

bool

True if the child was removed, false if it was not found

Render(IGuiRenderer)

Renders the control and its children

void Render(IGuiRenderer renderer)

Parameters

renderer IGuiRenderer

The renderer to use for drawing

Update(IInputDevice, TimeSpan)

Updates the control state based on input and game logic

void Update(IInputDevice inputDevice, TimeSpan deltaTime)

Parameters

inputDevice IInputDevice

The input device for handling user input

deltaTime TimeSpan

The time elapsed since the last update

Events

MouseClick

Event fired when the control is clicked

event EventHandler<MouseClickEventArgs>? MouseClick

Event Type

EventHandler<MouseClickEventArgs>

MouseDrag

Event fired when mouse drag occurs over the control

event EventHandler<MouseDragEventArgs>? MouseDrag

Event Type

EventHandler<MouseDragEventArgs>

MouseWheel

Event fired when mouse wheel is scrolled over the control

event EventHandler<MouseWheelEventArgs>? MouseWheel

Event Type

EventHandler<MouseWheelEventArgs>