Skip to main content

Widget Class

Package: GHIElectronics.Endpoint.UI
Namespace: GHIElectronics.Endpoint.UI

Abstract base class for every UI widget. Holds the opaque libendpoint handle and exposes geometry, visibility, and background styling shared by all widget types. All setters and events run on the UI thread; do not touch widgets from background threads (LVGL is built with LV_USE_OS=LV_OS_NONE).

public abstract class Widget : IDisposable

Properties​

BackgroundColor​

public uint BackgroundColor { get; set; }

Solid background color as 0x00RRGGBB. Getter returns the last value set (LVGL has no read-back); returns 0 if never set.

Returns uint

Height​

public int Height { get; set; }

Height in pixels.

Returns int

Visible​

public bool Visible { get; set; }

Whether the widget (and its subtree) is drawn. Setting false hides but does not destroy it.

Returns bool

Width​

public int Width { get; set; }

Width in pixels.

Returns int

X​

public int X { get; set; }

X coordinate in pixels relative to the parent's top-left corner.

Returns int

Y​

public int Y { get; set; }

Y coordinate in pixels relative to the parent's top-left corner.

Returns int

Methods​

Dispose()​

public virtual void Dispose()

Destroy the native widget and release pinned event handles. Idempotent.

SetBackgroundGradient(uint rgbStart, uint rgbEnd, GradientDirection direction)​

public void SetBackgroundGradient(uint rgbStart, uint rgbEnd, GradientDirection direction)

Linear gradient background. direction: Vertical = top->bottom, Horizontal = left->right.

SetBackgroundImage(byte[] rgb565Pixels, int width, int height)​

public void SetBackgroundImage(byte[] rgb565Pixels, int width, int height)

Tiled background from raw RGB565 pixel bytes (little-endian).

SetMargin(int left, int top, int right, int bottom)​

public void SetMargin(int left, int top, int right, int bottom)

WPF-style per-widget Margin. Works in any parent (flex, dock, or absolute).