// Generated API outline. Implementation bodies omitted.
#nullable enable
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Threading;
using System;
using nfloat = System.Runtime.InteropServices.NFloat;
using static Xui.Core.Math2D.Constants;
namespace Xui.Core.Abstract.Events
{
///
/// 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
{
///
/// Initializes a new instance of the struct.
///
public DeleteBackwardsEventRef();
}
///
/// 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
{
///
/// The timestamp of the previous frame.
///
public TimeSpan Previous;
///
/// The timestamp of the upcoming frame.
///
public TimeSpan Next;
///
/// The time elapsed between the previous and next frames.
///
public TimeSpan Delta;
///
/// Initializes a new instance of the struct
/// with the given previous and next frame timestamps.
///
/// The timestamp of the previous frame.
/// The timestamp of the upcoming frame.
public FrameEventRef(TimeSpan previous, TimeSpan next);
}
///
/// 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
{
///
/// The text to be inserted into the current input context.
///
public readonly string Text;
///
/// Initializes a new instance of the struct
/// with the specified text to insert.
///
/// The string of text to be inserted.
public InsertTextEventRef(string text);
}
///
/// Represents a keyboard input event.
/// Used for both key down (Key is set) and character input (Character is set) events.
///
public ref struct KeyEventRef
{
///
/// The virtual key code for key down/up events.
///
public VirtualKey Key;
///
/// The Unicode character for character input events (e.g. WM_CHAR).
/// Zero when this is a key down/up event without character translation.
///
public char Character;
///
/// True if the Shift key is held during this event.
///
public bool Shift;
///
/// True if this is an auto-repeat event (key held down).
///
public bool IsRepeat;
///
/// Set to true by the handler to indicate the event was consumed.
///
public bool Handled;
}
///
/// Identifies a specific mouse button involved in a pointer event.
///
public enum MouseButton
{
///
/// The left mouse button, typically used for primary actions like selection or dragging.
///
Left,
///
/// The right mouse button, typically used for context menus or alternate actions.
///
Right,
///
/// Any other mouse button, such as middle-click or additional buttons on advanced mice.
///
Other
}
///
/// 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
{
///
/// A span of all current touch points involved in this event.
///
public readonly ReadOnlySpan Touches;
/// Text measurement supplied by the window for precision caret hit-testing.
public Xui.Core.Canvas.ITextMeasureContext? TextMeasure;
///
/// Initializes a new instance of the struct
/// with the provided set of touch points.
///
/// A span of active touch data.
public TouchEventRef(ReadOnlySpan touches);
}
///
/// Describes the phase of an individual touch point during a touch event.
///
public enum TouchPhase
{
///
/// The touch has just started (finger or stylus contacted the surface).
///
Start,
///
/// The touch is actively moving across the surface.
///
Move,
///
/// The touch has ended (finger or stylus lifted off the surface).
///
End,
/// The system interrupted the contact; it must not complete a tap.
Cancel
}
///
/// Platform-agnostic virtual key codes for keyboard input.
/// Values intentionally match Win32 VK_* codes for zero-cost mapping on Windows.
///
public enum VirtualKey : ushort
{
/// No key pressed.
None = 0x00,
/// Backspace key.
Back = 0x08,
/// Tab key.
Tab = 0x09,
/// Enter/Return key.
Return = 0x0D,
/// Shift modifier key.
Shift = 0x10,
/// Control modifier key.
Control = 0x11,
/// Alt modifier key.
Alt = 0x12,
/// Escape key.
Escape = 0x1B,
/// Space bar.
Space = 0x20,
/// Page Up key.
Prior = 0x21,
/// Page Down key.
Next = 0x22,
/// End key.
End = 0x23,
/// Home key.
Home = 0x24,
/// Left arrow key.
Left = 0x25,
/// Up arrow key.
Up = 0x26,
/// Right arrow key.
Right = 0x27,
/// Down arrow key.
Down = 0x28,
/// Insert key.
Insert = 0x2D,
/// Delete key.
Delete = 0x2E,
/// Digit key 0.
D0 = 0x30,
/// Digit key 1.
D1 = 0x31,
/// Digit key 2.
D2 = 0x32,
/// Digit key 3.
D3 = 0x33,
/// Digit key 4.
D4 = 0x34,
/// Digit key 5.
D5 = 0x35,
/// Digit key 6.
D6 = 0x36,
/// Digit key 7.
D7 = 0x37,
/// Digit key 8.
D8 = 0x38,
/// Digit key 9.
D9 = 0x39,
/// Letter key A.
A = 0x41,
/// Letter key B.
B = 0x42,
/// Letter key C.
C = 0x43,
/// Letter key D.
D = 0x44,
/// Letter key E.
E = 0x45,
/// Letter key F.
F = 0x46,
/// Letter key G.
G = 0x47,
/// Letter key H.
H = 0x48,
/// Letter key I.
I = 0x49,
/// Letter key J.
J = 0x4A,
/// Letter key K.
K = 0x4B,
/// Letter key L.
L = 0x4C,
/// Letter key M.
M = 0x4D,
/// Letter key N.
N = 0x4E,
/// Letter key O.
O = 0x4F,
/// Letter key P.
P = 0x50,
/// Letter key Q.
Q = 0x51,
/// Letter key R.
R = 0x52,
/// Letter key S.
S = 0x53,
/// Letter key T.
T = 0x54,
/// Letter key U.
U = 0x55,
/// Letter key V.
V = 0x56,
/// Letter key W.
W = 0x57,
/// Letter key X.
X = 0x58,
/// Letter key Y.
Y = 0x59,
/// Letter key Z.
Z = 0x5A,
}
}
namespace Xui.Core.Abstract.Events
{
using Xui.Core.Canvas;
using Xui.Core.Math2D;
///
/// 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
{
///
/// The position of the mouse pointer at the time of the event,
/// in logical window coordinates.
///
public Point Position;
/// Normalized device pressure, from 0 to 1, when HasPressure is true.
public System.Runtime.InteropServices.NFloat Pressure;
/// Whether the source supplied a real pressure measurement.
public bool HasPressure;
///
/// The mouse button that was pressed.
///
public MouseButton Button;
///
/// Optional text measure context for hit-testing text positions.
/// May be null on platforms that do not provide one.
///
public ITextMeasureContext? TextMeasure;
}
///
/// 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
{
///
/// The current position of the mouse pointer in logical window coordinates.
///
public Point Position;
/// Normalized device pressure, from 0 to 1, when HasPressure is true.
public System.Runtime.InteropServices.NFloat Pressure;
/// Whether the source supplied a real pressure measurement.
public bool HasPressure;
///
/// Optional text measure context for hit-testing text positions.
/// May be null on platforms that do not provide one.
///
public ITextMeasureContext? TextMeasure;
}
///
/// 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
{
///
/// The position of the mouse pointer at the time of the event,
/// in logical window coordinates.
///
public Point Position;
/// Normalized device pressure, from 0 to 1, when HasPressure is true.
public System.Runtime.InteropServices.NFloat Pressure;
/// Whether the source supplied a real pressure measurement.
public bool HasPressure;
///
/// The mouse button that was released.
///
public MouseButton Button;
///
/// Optional text measure context for hit-testing text positions.
/// May be null on platforms that do not provide one.
///
public ITextMeasureContext? TextMeasure;
}
///
/// 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 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
{
///
/// The region of the screen or surface that should be re-rendered.
///
public Rect Rect;
///
/// Timing information associated with this frame, typically used for animations.
///
public FrameEventRef Frame;
///
/// The frame-bound drawing context for this render pass. It must not be retained
/// after the event returns to the render surface.
///
public IContext Context;
///
/// Initializes a new instance of the struct
/// with the given invalidation region and frame timing data.
///
/// The region to be rendered.
/// The timing information for this frame.
/// The drawing context for this render pass.
public RenderEventRef(Rect rect, FrameEventRef frame, IContext context);
}
}
namespace Xui.Core.Abstract.Events
{
using Xui.Core.Math2D;
/// Lifecycle flags for direct scrolling or platform-generated scroll inertia.
[Flags]
public enum ScrollPhase
{
/// No phase information is available.
None = 0,
/// The sequence began.
Began = 1,
/// Contact continues without movement.
Stationary = 2,
/// The sequence moved.
Changed = 4,
/// The sequence ended normally.
Ended = 8,
/// The sequence was cancelled.
Cancelled = 16,
/// Contact may begin a scroll gesture.
MayBegin = 32
}
///
/// 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
{
///
/// The scroll delta, typically measured in logical units per axis.
/// Positive Y values usually indicate upward scrolling.
///
public Vector Delta;
///
/// 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.
///
public bool IsPrecise;
/// Direct gesture phase, or when unavailable.
public ScrollPhase Phase;
///
/// Platform-generated inertia phase. Its deltas already include deceleration;
/// a handler must not treat them as continued finger contact or add another fling.
///
public ScrollPhase MomentumPhase;
///
/// 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.
///
public Point Position;
/// Whether is populated.
public bool HasPosition;
///
/// Set to true by a handler to stop further propagation of this event.
///
public bool Handled;
}
///
/// 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 instances may be
/// reported in a single event when handling gestures or complex touch interactions.
///
public struct Touch
{
///
/// A unique index identifying this touch point during its lifetime.
/// Typically assigned by the platform and reused after release.
///
public int Index;
///
/// The current position of the touch in logical window coordinates.
///
public Point Position;
///
/// The estimated contact radius of the touch, in logical units.
/// Used for gesture recognition or pressure emulation.
///
public nfloat Radius;
///
/// The current phase of the touch (e.g., began, moved, ended).
///
public TouchPhase Phase;
}
///
/// 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
{
///
/// The location of the hit test, in logical window coordinates.
///
public Point Point;
///
/// The bounds of the entire window, in logical coordinates.
/// This may be used to determine edge proximity for resizing logic.
///
public Rect Window;
///
/// The result of the hit test, set by the application to control
/// how the system should interpret the hit location.
///
public WindowArea Area;
///
/// Initializes a new instance of the struct.
///
/// The location of the pointer input.
/// The bounds of the target window.
public WindowHitTestEventRef(Point point, Rect window);
///
/// Describes the purpose or function of a region within a window.
///
public enum WindowArea : uint
{
///
/// The area is unspecified; the platform should handle it normally.
///
Default = 0,
///
/// The area is transparent to hit testing and should not trigger drag or resize.
///
Transparent,
///
/// The area represents the client region of the window (normal content).
///
Client,
///
/// The area represents a draggable title bar region.
///
Title,
/// Top-left resize corner.
BorderTopLeft,
/// Top edge resize border.
BorderTop,
/// Top-right resize corner.
BorderTopRight,
/// Right edge resize border.
BorderRight,
/// Bottom-right resize corner.
BorderBottomRight,
/// Bottom edge resize border.
BorderBottom,
/// Bottom-left resize corner.
BorderBottomLeft,
/// Left edge resize border.
BorderLeft
}
}
}
namespace Xui.Core.Abstract.Events
{
using NFloat = System.Runtime.InteropServices.NFloat;
using Xui.Core.Math2D;
/// A platform magnification gesture, routed separately from scrolling and touch contacts.
public ref struct ZoomEventRef
{
/// Incremental scale multiplier: 1 is unchanged, values above 1 zoom in.
public NFloat ScaleFactor;
/// The gesture anchor in window coordinates.
public Point Position;
/// Whether is available; otherwise routing uses the last mouse position.
public bool HasPosition;
/// The native gesture lifecycle, using the same flags as scrolling.
public ScrollPhase Phase;
/// Set to true to stop propagation to ancestor views.
public bool Handled;
}
}