Xui.Core.Abstract.Events

Assembly: Xui.Core · C# declarations · Assembly overview

Types

ref struct DeleteBackwardsEventRef

Represents a platform-level input event requesting deletion of content positioned logically before the caret or selection range. Typically triggered by a "Backspace" key press or an equivalent gesture.

This event originates from the Actual window layer and is forwarded to the Abstract window for dispatching through the view hierarchy. It is intended to be routed to the appropriate focused or editable view.

public ref struct DeleteBackwardsEventRef
{
    public DeleteBackwardsEventRef();
}

DeleteBackwardsEventRef.DeleteBackwardsEventRef()

public DeleteBackwardsEventRef();

Initializes a new instance of the Xui.Core.Abstract.Events.DeleteBackwardsEventRef struct.

ref struct FrameEventRef

Represents a platform-level event dispatched once per frame, providing timing information used for driving animations and visual updates.

This event is emitted from the Actual window and forwarded to the Abstract window, typically during the animation phase of the UI lifecycle. It provides both the previous and next frame times, along with the time delta between them. Consumers can use this data to advance animations or perform time-based layout updates.

public ref struct FrameEventRef
{
    public TimeSpan Previous;
    public TimeSpan Next;
    public TimeSpan Delta;
    public FrameEventRef(TimeSpan previous, TimeSpan next);
}

FrameEventRef.FrameEventRef(TimeSpan previous, TimeSpan next)

public FrameEventRef(TimeSpan previous, TimeSpan next);

Initializes a new instance of the Xui.Core.Abstract.Events.FrameEventRef struct with the given previous and next frame timestamps.

  • previous — The timestamp of the previous frame.

  • next — The timestamp of the upcoming frame.

TimeSpan FrameEventRef.Delta

public TimeSpan Delta;

The time elapsed between the previous and next frames.

TimeSpan FrameEventRef.Next

public TimeSpan Next;

The timestamp of the upcoming frame.

TimeSpan FrameEventRef.Previous

public TimeSpan Previous;

The timestamp of the previous frame.

ref struct InsertTextEventRef

Represents a platform-level input event requesting insertion of text at the current caret or selection position.

This event originates from the Actual window and is forwarded to the Abstract layer for dispatch through the view hierarchy. It is typically triggered by user input such as typing characters, pasting from the clipboard, or text input from IMEs.

public ref struct InsertTextEventRef
{
    public readonly string Text;
    public InsertTextEventRef(string text);
}

InsertTextEventRef.InsertTextEventRef(string text)

public InsertTextEventRef(string text);

Initializes a new instance of the Xui.Core.Abstract.Events.InsertTextEventRef struct with the specified text to insert.

  • text — The string of text to be inserted.

string InsertTextEventRef.Text

public readonly string Text;

The text to be inserted into the current input context.

ref struct KeyEventRef

Represents a keyboard input event. Used for both key down (Key is set) and character input (Character is set) events.

public ref struct KeyEventRef
{
    public VirtualKey Key;
    public char Character;
    public bool Shift;
    public bool IsRepeat;
    public bool Handled;
}

char KeyEventRef.Character

public char Character;

The Unicode character for character input events (e.g. WM_CHAR). Zero when this is a key down/up event without character translation.

bool KeyEventRef.Handled

public bool Handled;

Set to true by the handler to indicate the event was consumed.

bool KeyEventRef.IsRepeat

public bool IsRepeat;

True if this is an auto-repeat event (key held down).

VirtualKey KeyEventRef.Key

public VirtualKey Key;

The virtual key code for key down/up events.

bool KeyEventRef.Shift

public bool Shift;

True if the Shift key is held during this event.

enum MouseButton

Identifies a specific mouse button involved in a pointer event.

public enum MouseButton
{
    Left,
    Right,
    Other
}

MouseButton.Left

Left

The left mouse button, typically used for primary actions like selection or dragging.

MouseButton.Other

Other

Any other mouse button, such as middle-click or additional buttons on advanced mice.

MouseButton.Right

Right

The right mouse button, typically used for context menus or alternate actions.

ref struct MouseDownEventRef

Represents a platform-level input event indicating that a mouse button was pressed at a given position.

This event is dispatched by the Actual window and forwarded to the Abstract layer for routing through the view hierarchy. It may be used to initiate focus, dragging, selection, or other pointer interactions.

public ref struct MouseDownEventRef
{
    public Point Position;
    public System.Runtime.InteropServices.NFloat Pressure;
    public bool HasPressure;
    public MouseButton Button;
    public ITextMeasureContext? TextMeasure;
}

MouseButton MouseDownEventRef.Button

public MouseButton Button;

The mouse button that was pressed.

bool MouseDownEventRef.HasPressure

public bool HasPressure;

Whether the source supplied a real pressure measurement.

Point MouseDownEventRef.Position

public Point Position;

The position of the mouse pointer at the time of the event, in logical window coordinates.

NFloat MouseDownEventRef.Pressure

public System.Runtime.InteropServices.NFloat Pressure;

Normalized device pressure, from 0 to 1, when HasPressure is true.

ITextMeasureContext? MouseDownEventRef.TextMeasure

public ITextMeasureContext? TextMeasure;

Optional text measure context for hit-testing text positions. May be null on platforms that do not provide one.

ref struct MouseMoveEventRef

Represents a platform-level input event indicating that the mouse pointer has moved to a new position.

This event is dispatched by the Actual window and forwarded to the Abstract layer for routing through the view hierarchy. It is typically used to trigger hover effects, cursor updates, or to track dragging or gesture movement.

public ref struct MouseMoveEventRef
{
    public Point Position;
    public System.Runtime.InteropServices.NFloat Pressure;
    public bool HasPressure;
    public ITextMeasureContext? TextMeasure;
}

bool MouseMoveEventRef.HasPressure

public bool HasPressure;

Whether the source supplied a real pressure measurement.

Point MouseMoveEventRef.Position

public Point Position;

The current position of the mouse pointer in logical window coordinates.

NFloat MouseMoveEventRef.Pressure

public System.Runtime.InteropServices.NFloat Pressure;

Normalized device pressure, from 0 to 1, when HasPressure is true.

ITextMeasureContext? MouseMoveEventRef.TextMeasure

public ITextMeasureContext? TextMeasure;

Optional text measure context for hit-testing text positions. May be null on platforms that do not provide one.

ref struct MouseUpEventRef

Represents a platform-level input event indicating that a mouse button was released at a given position.

This event is dispatched by the Actual window and forwarded to the Abstract layer for routing through the view hierarchy. It is typically used to complete interactions such as clicks, drags, or other pointer-driven gestures.

public ref struct MouseUpEventRef
{
    public Point Position;
    public System.Runtime.InteropServices.NFloat Pressure;
    public bool HasPressure;
    public MouseButton Button;
    public ITextMeasureContext? TextMeasure;
}

MouseButton MouseUpEventRef.Button

public MouseButton Button;

The mouse button that was released.

bool MouseUpEventRef.HasPressure

public bool HasPressure;

Whether the source supplied a real pressure measurement.

Point MouseUpEventRef.Position

public Point Position;

The position of the mouse pointer at the time of the event, in logical window coordinates.

NFloat MouseUpEventRef.Pressure

public System.Runtime.InteropServices.NFloat Pressure;

Normalized device pressure, from 0 to 1, when HasPressure is true.

ITextMeasureContext? MouseUpEventRef.TextMeasure

public ITextMeasureContext? TextMeasure;

Optional text measure context for hit-testing text positions. May be null on platforms that do not provide one.

ref struct RenderEventRef

Represents a platform-level render event dispatched after a timing frame, indicating that views should perform layout and rendering operations within a given region.

This event follows a Xui.Core.Abstract.Events.FrameEventRef and marks the phase during which views are expected to perform their Measure, Arrange, and Render passes. It is emitted by the Actual window and forwarded to the Abstract layer.

public ref struct RenderEventRef
{
    public Rect Rect;
    public FrameEventRef Frame;
    public IContext Context;
    public RenderEventRef(Rect rect, FrameEventRef frame, IContext context);
}

RenderEventRef.RenderEventRef(Rect rect, FrameEventRef frame, IContext context)

public RenderEventRef(Rect rect, FrameEventRef frame, IContext context);

Initializes a new instance of the Xui.Core.Abstract.Events.RenderEventRef struct with the given invalidation region and frame timing data.

  • rect — The region to be rendered.

  • frame — The timing information for this frame.

  • context — The drawing context for this render pass.

IContext RenderEventRef.Context

public IContext Context;

The frame-bound drawing context for this render pass. It must not be retained after the event returns to the render surface.

FrameEventRef RenderEventRef.Frame

public FrameEventRef Frame;

Timing information associated with this frame, typically used for animations.

Rect RenderEventRef.Rect

public Rect Rect;

The region of the screen or surface that should be re-rendered.

enum ScrollPhase

Lifecycle flags for direct scrolling or platform-generated scroll inertia.

[Flags]
public enum ScrollPhase
{
    None = 0,
    Began = 1,
    Stationary = 2,
    Changed = 4,
    Ended = 8,
    Cancelled = 16,
    MayBegin = 32
}

ScrollPhase.Began

Began = 1

The sequence began.

ScrollPhase.Cancelled

Cancelled = 16

The sequence was cancelled.

ScrollPhase.Changed

Changed = 4

The sequence moved.

ScrollPhase.Ended

Ended = 8

The sequence ended normally.

ScrollPhase.MayBegin

MayBegin = 32

Contact may begin a scroll gesture.

ScrollPhase.None

None = 0

No phase information is available.

ScrollPhase.Stationary

Stationary = 2

Contact continues without movement.

ref struct ScrollWheelEventRef

Represents a platform-level input event generated by a scroll wheel or trackpad gesture, indicating a change in scroll position.

This event is dispatched by the Actual window and forwarded to the Abstract layer for routing through the view hierarchy. It may be used to scroll content, zoom views, or trigger kinetic effects, depending on platform and modifier keys.

public ref struct ScrollWheelEventRef
{
    public Vector Delta;
    public bool IsPrecise;
    public ScrollPhase Phase;
    public ScrollPhase MomentumPhase;
    public Point Position;
    public bool HasPosition;
    public bool Handled;
}

Vector ScrollWheelEventRef.Delta

public Vector Delta;

The scroll delta, typically measured in logical units per axis. Positive Y values usually indicate upward scrolling.

bool ScrollWheelEventRef.Handled

public bool Handled;

Set to true by a handler to stop further propagation of this event.

bool ScrollWheelEventRef.HasPosition

public bool HasPosition;

Whether Xui.Core.Abstract.Events.ScrollWheelEventRef.Position is populated.

bool ScrollWheelEventRef.IsPrecise

public bool IsPrecise;

True for continuous, precise deltas in logical points (for example a macOS trackpad). False for ordinary wheel input or sources that do not report precision.

ScrollPhase ScrollWheelEventRef.MomentumPhase

public ScrollPhase MomentumPhase;

Platform-generated inertia phase. Its deltas already include deceleration; a handler must not treat them as continued finger contact or add another fling.

ScrollPhase ScrollWheelEventRef.Phase

public ScrollPhase Phase;

Direct gesture phase, or Xui.Core.Abstract.Events.ScrollPhase.None when unavailable.

Point ScrollWheelEventRef.Position

public Point Position;

The position at which this gesture should be routed, when the input source provides one. Sources without a position use the most recently observed pointer location instead.

struct Touch

Represents a single touch point within a multi-touch input event.

This structure contains identifying and positional data for a specific finger or contact point on a touch surface. Multiple Xui.Core.Abstract.Events.Touch instances may be reported in a single event when handling gestures or complex touch interactions.

public struct Touch
{
    public int Index;
    public Point Position;
    public nfloat Radius;
    public TouchPhase Phase;
}

int Touch.Index

public int Index;

A unique index identifying this touch point during its lifetime. Typically assigned by the platform and reused after release.

TouchPhase Touch.Phase

public TouchPhase Phase;

The current phase of the touch (e.g., began, moved, ended).

Point Touch.Position

public Point Position;

The current position of the touch in logical window coordinates.

NFloat Touch.Radius

public nfloat Radius;

The estimated contact radius of the touch, in logical units. Used for gesture recognition or pressure emulation.

ref struct TouchEventRef

Represents a platform-level input event containing one or more touch points, typically originating from a touchscreen or trackpad gesture.

This event is dispatched by the Actual window and forwarded to the Abstract layer for routing through the view hierarchy. It includes all active touch points for the current frame, allowing gesture recognition, hit testing, and view interaction logic.

public ref struct TouchEventRef
{
    public readonly ReadOnlySpan<Touch> Touches;
    public Xui.Core.Canvas.ITextMeasureContext? TextMeasure;
    public TouchEventRef(ReadOnlySpan<Touch> touches);
}

TouchEventRef.TouchEventRef(ReadOnlySpan<Touch> touches)

public TouchEventRef(ReadOnlySpan<Touch> touches);

Initializes a new instance of the Xui.Core.Abstract.Events.TouchEventRef struct with the provided set of touch points.

  • touches — A span of active touch data.

ITextMeasureContext? TouchEventRef.TextMeasure

public Xui.Core.Canvas.ITextMeasureContext? TextMeasure;

Text measurement supplied by the window for precision caret hit-testing.

ReadOnlySpan<Touch> TouchEventRef.Touches

public readonly ReadOnlySpan<Touch> Touches;

A span of all current touch points involved in this event.

enum TouchPhase

Describes the phase of an individual touch point during a touch event.

public enum TouchPhase
{
    Start,
    Move,
    End,
    Cancel
}

TouchPhase.Cancel

Cancel

The system interrupted the contact; it must not complete a tap.

TouchPhase.End

End

The touch has ended (finger or stylus lifted off the surface).

TouchPhase.Move

Move

The touch is actively moving across the surface.

TouchPhase.Start

Start

The touch has just started (finger or stylus contacted the surface).

enum VirtualKey

Platform-agnostic virtual key codes for keyboard input. Values intentionally match Win32 VK_* codes for zero-cost mapping on Windows.

public enum VirtualKey : ushort
{
    None = 0x00,
    Back = 0x08,
    Tab = 0x09,
    Return = 0x0D,
    Shift = 0x10,
    Control = 0x11,
    Alt = 0x12,
    Escape = 0x1B,
    Space = 0x20,
    Prior = 0x21,
    Next = 0x22,
    End = 0x23,
    Home = 0x24,
    Left = 0x25,
    Up = 0x26,
    Right = 0x27,
    Down = 0x28,
    Insert = 0x2D,
    Delete = 0x2E,
    D0 = 0x30,
    D1 = 0x31,
    D2 = 0x32,
    D3 = 0x33,
    D4 = 0x34,
    D5 = 0x35,
    D6 = 0x36,
    D7 = 0x37,
    D8 = 0x38,
    D9 = 0x39,
    A = 0x41,
    B = 0x42,
    C = 0x43,
    D = 0x44,
    E = 0x45,
    F = 0x46,
    G = 0x47,
    H = 0x48,
    I = 0x49,
    J = 0x4A,
    K = 0x4B,
    L = 0x4C,
    M = 0x4D,
    N = 0x4E,
    O = 0x4F,
    P = 0x50,
    Q = 0x51,
    R = 0x52,
    S = 0x53,
    T = 0x54,
    U = 0x55,
    V = 0x56,
    W = 0x57,
    X = 0x58,
    Y = 0x59,
    Z = 0x5A,
}

VirtualKey.A

A = 0x41

Letter key A.

VirtualKey.Alt

Alt = 0x12

Alt modifier key.

VirtualKey.B

B = 0x42

Letter key B.

VirtualKey.Back

Back = 0x08

Backspace key.

VirtualKey.C

C = 0x43

Letter key C.

VirtualKey.Control

Control = 0x11

Control modifier key.

VirtualKey.D

D = 0x44

Letter key D.

VirtualKey.D0

D0 = 0x30

Digit key 0.

VirtualKey.D1

D1 = 0x31

Digit key 1.

VirtualKey.D2

D2 = 0x32

Digit key 2.

VirtualKey.D3

D3 = 0x33

Digit key 3.

VirtualKey.D4

D4 = 0x34

Digit key 4.

VirtualKey.D5

D5 = 0x35

Digit key 5.

VirtualKey.D6

D6 = 0x36

Digit key 6.

VirtualKey.D7

D7 = 0x37

Digit key 7.

VirtualKey.D8

D8 = 0x38

Digit key 8.

VirtualKey.D9

D9 = 0x39

Digit key 9.

VirtualKey.Delete

Delete = 0x2E

Delete key.

VirtualKey.Down

Down = 0x28

Down arrow key.

VirtualKey.E

E = 0x45

Letter key E.

VirtualKey.End

End = 0x23

End key.

VirtualKey.Escape

Escape = 0x1B

Escape key.

VirtualKey.F

F = 0x46

Letter key F.

VirtualKey.G

G = 0x47

Letter key G.

VirtualKey.H

H = 0x48

Letter key H.

VirtualKey.Home

Home = 0x24

Home key.

VirtualKey.I

I = 0x49

Letter key I.

VirtualKey.Insert

Insert = 0x2D

Insert key.

VirtualKey.J

J = 0x4A

Letter key J.

VirtualKey.K

K = 0x4B

Letter key K.

VirtualKey.L

L = 0x4C

Letter key L.

VirtualKey.Left

Left = 0x25

Left arrow key.

VirtualKey.M

M = 0x4D

Letter key M.

VirtualKey.N

N = 0x4E

Letter key N.

VirtualKey.Next

Next = 0x22

Page Down key.

VirtualKey.None

None = 0x00

No key pressed.

VirtualKey.O

O = 0x4F

Letter key O.

VirtualKey.P

P = 0x50

Letter key P.

VirtualKey.Prior

Prior = 0x21

Page Up key.

VirtualKey.Q

Q = 0x51

Letter key Q.

VirtualKey.R

R = 0x52

Letter key R.

VirtualKey.Return

Return = 0x0D

Enter/Return key.

VirtualKey.Right

Right = 0x27

Right arrow key.

VirtualKey.S

S = 0x53

Letter key S.

VirtualKey.Shift

Shift = 0x10

Shift modifier key.

VirtualKey.Space

Space = 0x20

Space bar.

VirtualKey.T

T = 0x54

Letter key T.

VirtualKey.Tab

Tab = 0x09

Tab key.

VirtualKey.U

U = 0x55

Letter key U.

VirtualKey.Up

Up = 0x26

Up arrow key.

VirtualKey.V

V = 0x56

Letter key V.

VirtualKey.W

W = 0x57

Letter key W.

VirtualKey.X

X = 0x58

Letter key X.

VirtualKey.Y

Y = 0x59

Letter key Y.

VirtualKey.Z

Z = 0x5A

Letter key Z.

ref struct WindowHitTestEventRef

Represents a platform-level hit test event that allows the application to define how a point within a custom window frame should be interpreted (e.g., as a draggable title bar, resize border, or transparent region).

This event is dispatched when the user interacts with the non-client area of a custom-framed window (such as the emulator window or a styled installer). It is primarily used on platforms like Windows that support fine-grained window frame interaction via hit testing. On macOS and other platforms where native support is unavailable, this event may be ignored or implemented through custom code.

public ref struct WindowHitTestEventRef
{
    public Point Point;
    public Rect Window;
    public WindowArea Area;
    public WindowHitTestEventRef(Point point, Rect window);
    public enum WindowArea : uint
    {
        Default = 0,
        Transparent,
        Client,
        Title,
        BorderTopLeft,
        BorderTop,
        BorderTopRight,
        BorderRight,
        BorderBottomRight,
        BorderBottom,
        BorderBottomLeft,
        BorderLeft
    }
}

WindowHitTestEventRef.WindowHitTestEventRef(Point point, Rect window)

public WindowHitTestEventRef(Point point, Rect window);

Initializes a new instance of the Xui.Core.Abstract.Events.WindowHitTestEventRef struct.

  • point — The location of the pointer input.

  • window — The bounds of the target window.

WindowArea WindowHitTestEventRef.Area

public WindowArea Area;

The result of the hit test, set by the application to control how the system should interpret the hit location.

Point WindowHitTestEventRef.Point

public Point Point;

The location of the hit test, in logical window coordinates.

Rect WindowHitTestEventRef.Window

public Rect Window;

The bounds of the entire window, in logical coordinates. This may be used to determine edge proximity for resizing logic.

enum WindowHitTestEventRef.WindowArea

Describes the purpose or function of a region within a window.

public enum WindowArea : uint
{
    Default = 0,
    Transparent,
    Client,
    Title,
    BorderTopLeft,
    BorderTop,
    BorderTopRight,
    BorderRight,
    BorderBottomRight,
    BorderBottom,
    BorderBottomLeft,
    BorderLeft
}

WindowArea.BorderBottom

BorderBottom

Bottom edge resize border.

WindowArea.BorderBottomLeft

BorderBottomLeft

Bottom-left resize corner.

WindowArea.BorderBottomRight

BorderBottomRight

Bottom-right resize corner.

WindowArea.BorderLeft

BorderLeft

Left edge resize border.

WindowArea.BorderRight

BorderRight

Right edge resize border.

WindowArea.BorderTop

BorderTop

Top edge resize border.

WindowArea.BorderTopLeft

BorderTopLeft

Top-left resize corner.

WindowArea.BorderTopRight

BorderTopRight

Top-right resize corner.

WindowArea.Client

Client

The area represents the client region of the window (normal content).

WindowArea.Default

Default = 0

The area is unspecified; the platform should handle it normally.

WindowArea.Title

Title

The area represents a draggable title bar region.

WindowArea.Transparent

Transparent

The area is transparent to hit testing and should not trigger drag or resize.

ref struct ZoomEventRef

A platform magnification gesture, routed separately from scrolling and touch contacts.

public ref struct ZoomEventRef
{
    public NFloat ScaleFactor;
    public Point Position;
    public bool HasPosition;
    public ScrollPhase Phase;
    public bool Handled;
}

bool ZoomEventRef.Handled

public bool Handled;

Set to true to stop propagation to ancestor views.

bool ZoomEventRef.HasPosition

public bool HasPosition;

Whether Xui.Core.Abstract.Events.ZoomEventRef.Position is available; otherwise routing uses the last mouse position.

ScrollPhase ZoomEventRef.Phase

public ScrollPhase Phase;

The native gesture lifecycle, using the same flags as scrolling.

Point ZoomEventRef.Position

public Point Position;

The gesture anchor in window coordinates.

NFloat ZoomEventRef.ScaleFactor

public NFloat ScaleFactor;

Incremental scale multiplier: 1 is unchanged, values above 1 zoom in.