Skip to content

Widgets

Isthimius edited this page Jul 31, 2026 · 1 revision

Widgets are Gondwana’s system for interactive, reusable interface elements built on top of DirectDrawing.

This includes things like:

  • buttons
  • labels and text boxes
  • menus
  • dialogue boxes
  • health bars
  • draggable panels
  • splash screens and other interactive overlays

Built on DirectDrawing

A widget uses DirectDrawing for its visual representation, but adds the behavior expected from a user-interface element.

Depending on how it is associated, a widget can appear as:

  • a SceneLayer-bound world-space element
  • a View-bound screen-space interface element

That means the same widget system can support both in-world interaction and traditional HUD or overlay interfaces.


WidgetBase

All widgets derive from WidgetBase, which provides the common widget lifecycle and interaction model.

This includes:

  • showing and hiding
  • activation and cancellation
  • pointer hit testing
  • pointer enter, leave, down, up, and click events
  • optional drag events

Specialized widget base classes add behavior where it is useful. For example, draggable widgets build on the shared pointer pipeline rather than implementing platform-specific mouse or touch handling.


WidgetInputRouter

Widget input is coordinated by WidgetInputRouter, which:

  • tracks the widgets associated with a render surface
  • determines which widget is under the pointer
  • routes mouse or touch input to that widget
  • manages pointer capture during clicks and drags
  • provides a platform-agnostic input path

The platform hosts translate native input into Gondwana input events. Widgets themselves do not need to know whether they are running under WinForms, Avalonia, or Blazor.


Why it exists

DirectDrawing can render almost any custom visual, but rendering alone does not provide the lifecycle and input behavior of a user-interface control.

Widgets provide that higher-level structure while remaining engine-native and platform-agnostic.


Mental model

If direct drawings are “engine-managed custom visuals,” widgets are “interactive direct drawings with a shared lifecycle and input model.”


Where to read next

  • Gondwana.Widgets/WidgetBase.cs
  • Gondwana.Widgets/WidgetInputRouter.cs
  • Gondwana.Widgets/*

Clone this wiki locally