Xui.Core.Actual
Assembly: Xui.Core · C# declarations · Assembly overview
Types
enum HapticEffectinterface IDispatcherinterface IHapticFeedbackinterface IImagePipelineinterface IRunLoopinterface IRuntimeinterface IStatusBarinterface ITextInputSessioninterface ITextMagnifierinterface IVibrationinterface IWindowenum StatusBarAppearanceclass VibrationPatternreadonly record struct VibrationPoint
enum HapticEffect
Tactile presets. The platform chooses the closest available native effect; strength and texture are not guaranteed to be identical across devices.
public enum HapticEffect
{
Tick,
LightImpact,
MediumImpact,
HeavyImpact,
SoftImpact,
RigidImpact,
Success,
Warning,
Error,
}
HapticEffect.Error
Error
Failure or rejection feedback.
On iOS, uses UINotificationFeedbackGenerator.notificationOccurred(.error).
On Android, uses View.performHapticFeedback(REJECT) on API 30+. Approximated with VibrationEffect.EFFECT_DOUBLE_CLICK on API 29, or View.performHapticFeedback(LONG_PRESS) on earlier versions.
HapticEffect.HeavyImpact
HeavyImpact
A heavy physical impact.
On iOS, uses UIImpactFeedbackGenerator.impactOccurred() with the heavy style.
On Android, approximated with VibrationEffect.EFFECT_HEAVY_CLICK on API 29+, falling back to View.performHapticFeedback(LONG_PRESS) on earlier versions.
HapticEffect.LightImpact
LightImpact
A light physical impact.
On iOS, uses UIImpactFeedbackGenerator.impactOccurred() with the light style.
On Android, approximated with VibrationEffect.EFFECT_TICK on API 29+, falling back to View.performHapticFeedback(CLOCK_TICK) on earlier versions.
HapticEffect.MediumImpact
MediumImpact
A medium physical impact.
On iOS, uses UIImpactFeedbackGenerator.impactOccurred() with the medium style.
On Android, approximated with VibrationEffect.EFFECT_CLICK on API 29+, falling back to View.performHapticFeedback(LONG_PRESS) on earlier versions.
HapticEffect.RigidImpact
RigidImpact
A firm, sharp impact.
On iOS, uses UIImpactFeedbackGenerator.impactOccurred() with the rigid style.
On Android API 31+, approximated with a composed PRIMITIVE_CLICK at scale 1.0 when the device supports it. Otherwise uses VibrationEffect.EFFECT_CLICK on API 29+, or View.performHapticFeedback(LONG_PRESS) on earlier versions.
HapticEffect.SoftImpact
SoftImpact
A soft, rounded impact.
On iOS, uses UIImpactFeedbackGenerator.impactOccurred() with the soft style.
On Android API 31+, approximated with a composed PRIMITIVE_THUD at scale 0.5 when the device supports it. Otherwise uses VibrationEffect.EFFECT_CLICK on API 29+, or View.performHapticFeedback(CLOCK_TICK) on earlier versions.
HapticEffect.Success
Success
Positive completion feedback.
On iOS, uses UINotificationFeedbackGenerator.notificationOccurred(.success).
On Android, uses View.performHapticFeedback(CONFIRM) on API 30+. Approximated with VibrationEffect.EFFECT_DOUBLE_CLICK on API 29, or View.performHapticFeedback(LONG_PRESS) on earlier versions.
HapticEffect.Tick
Tick
A small, crisp ruler or picker tick.
On iOS, uses UISelectionFeedbackGenerator.selectionChanged().
On Android, uses View.performHapticFeedback(SEGMENT_TICK) on API 34+, falling back to CLOCK_TICK on earlier versions.
HapticEffect.Warning
Warning
A cautionary notification.
On iOS, uses UINotificationFeedbackGenerator.notificationOccurred(.warning).
Android has no dedicated warning preset. Approximated with VibrationEffect.EFFECT_DOUBLE_CLICK on API 29+, falling back to View.performHapticFeedback(LONG_PRESS) on earlier versions.
interface IDispatcher
Represents a platform-specific dispatcher for marshaling callbacks onto the main UI thread. Used by the Xui runtime to ensure thread-safe execution of UI logic. Each platform must provide an implementation that posts callbacks to the appropriate runloop or UI thread.
public interface IDispatcher
{
void Post(Action callback);
}
void IDispatcher.Post(Action callback)
void Post(Action callback);
Posts the specified callback to be executed on the dispatcher's thread (typically the UI thread). Use this method when calling from a background thread and needing to safely transition to the main thread for UI updates or layout work.
callback— The action to execute on the dispatcher's thread.
interface IHapticFeedback
Optional, window-scoped tactile feedback. Resolve through the view's service provider and call on the UI thread. Desktop runtimes may leave this unregistered. Requests respect native settings and hardware capabilities; playback is not guaranteed.
public interface IHapticFeedback
{
void Prepare(HapticEffect effect);
void Play(HapticEffect effect);
}
void IHapticFeedback.Play(HapticEffect effect)
void Play(HapticEffect effect);
Plays a preset using the platform's closest available effect. Native platforms may coalesce rapid requests; this does not queue delayed pulses.
void IHapticFeedback.Prepare(HapticEffect effect)
void Prepare(HapticEffect effect);
Prepares an effect without vibrating. This is an optional latency hint; Xui.Core.Actual.IHapticFeedback.Play(Xui.Core.Actual.HapticEffect) must work without it. Platforms may ignore the hint.
interface IImagePipeline
Platform image pipeline. Caches decoded GPU-resident images by URI and vends Xui.Core.Canvas.IImage handles to views via the service-resolution chain. Implement this on each platform window to participate in image loading.
public interface IImagePipeline
{
IImage CreateImage();
}
IImage IImagePipeline.CreateImage()
IImage CreateImage();
Creates a new Xui.Core.Canvas.IImage handle backed by this pipeline's catalog. The handle is initially empty; populate it with Xui.Core.Canvas.IImage.Load(System.String) or Xui.Core.Canvas.IImage.LoadAsync(System.String).
interface IRunLoop
Represents a platform-specific run loop responsible for driving the application's lifecycle. Each platform must provide an implementation that enters the appropriate system event loop and continues running until the application exits. The Xui runtime uses this interface to abstract over platform differences in event dispatch and app execution.
public interface IRunLoop
{
int Run();
void Quit();
}
void IRunLoop.Quit()
void Quit();
Requests that the run loop exit gracefully. On platforms with a definite exit (Win32, macOS) this posts a quit message to the main thread. On platforms without a run loop (iOS, Browser) this is a no-op.
int IRunLoop.Run()
int Run();
Starts the main run loop for the application. This method may block until the application terminates or exits naturally. On platforms with built-in UI event loops (e.g., iOS, Android), this method may return immediately after bootstrapping the application delegate.
Returns: The application’s exit code.
interface IRuntime
Provides a platform-specific implementation of the Xui runtime, responsible for creating and connecting abstract application components to their actual counterparts. This interface acts as a bridge between the platform-independent core and the underlying OS-specific APIs (e.g., Win32, Cocoa, UIKit), enabling rendering, windowing, and event dispatch.
public interface IRuntime
{
IDispatcher MainDispatcher { get; }
Actual.IWindow CreateWindow(Abstract.IWindow windowAbstract, IServiceProvider applicationServices);
IRunLoop CreateRunloop(Abstract.Application applicationAbstract);
}
IRunLoop IRuntime.CreateRunloop(Application applicationAbstract)
IRunLoop CreateRunloop(Abstract.Application applicationAbstract);
Creates a platform-specific run loop associated with the given abstract application. The returned run loop is responsible for managing the application's execution lifecycle.
applicationAbstract— The abstract application instance defined by user code.
Returns: A platform-specific run loop instance.
IWindow IRuntime.CreateWindow(IWindow windowAbstract, IServiceProvider applicationServices)
Actual.IWindow CreateWindow(Abstract.IWindow windowAbstract, IServiceProvider applicationServices);
Creates a platform-specific window that is bound to the given abstract window definition.
windowAbstract— The abstract window definition provided by user code.applicationServices— The window/application service chain reached after platform services.
Returns: A concrete window implementation for the current platform.
IDispatcher IRuntime.MainDispatcher
IDispatcher MainDispatcher { get; }
Gets the main thread dispatcher for scheduling UI work. Used to marshal execution onto the main thread for layout, input, and rendering.
interface IStatusBar
Optional window-scoped control of status-bar text and icons. Resolve through the window or view service provider and use on the UI thread. Desktop runtimes may leave this unregistered. This does not change the bar background or safe area.
public interface IStatusBar
{
StatusBarAppearance Appearance { get; set; }
}
StatusBarAppearance IStatusBar.Appearance
StatusBarAppearance Appearance { get; set; }
Gets or sets the requested foreground appearance.
interface ITextInputSession
Optional native range editing and selection service, resolved through the window.
public interface ITextInputSession
{
void SetClient(ITextEditingClient? client);
void CancelSelectionGesture();
}
void ITextInputSession.CancelSelectionGesture()
void CancelSelectionGesture();
Cancels native selection gestures when an ancestor takes pointer capture.
void ITextInputSession.SetClient(ITextEditingClient? client)
void SetClient(ITextEditingClient? client);
Connects the focused editor, or ends the session on blur. The service owns NativeSelection while connected.
interface ITextMagnifier
Optional, window-scoped native precision-selection UI. Resolve through the view's service provider; absence (or Xui.Core.Actual.ITextMagnifier.IsSupported false) means no native loupe. This presents rendered content only; the focused view owns text and selection.
public interface ITextMagnifier
{
bool IsSupported { get; }
void Show(Point position, Rect caret);
void Hide();
}
void ITextMagnifier.Hide()
void Hide();
Ends the gesture and releases native state. Safe to call repeatedly. Call on release, cancellation, loss of capture/focus, or removal of the owner.
bool ITextMagnifier.IsSupported
bool IsSupported { get; }
Whether the running OS supports the native magnifier.
void ITextMagnifier.Show(Point position, Rect caret)
void Show(Point position, Rect caret);
Begins or updates a precision-selection gesture. Both the touch position and caret bounds are in logical window coordinates, after all view transforms. Call on the UI thread, only from the focused selection owner.
interface IVibration
Optional, window-scoped vibration playback. Call on the UI thread. Each Play replaces this service's previous playback; stop when the owning interaction ends. Desktop runtimes need not register this service; emulators provide silent playback.
public interface IVibration
{
bool IsSupported { get; }
bool SupportsFrequency { get; }
void Play(nfloat strength, nfloat frequency);
void Play(scoped ReadOnlySpan<VibrationPoint> points, bool repeat = false);
void Stop();
}
bool IVibration.IsSupported
bool IsSupported { get; }
Whether the device can produce vibration.
void IVibration.Play(scoped ReadOnlySpan<VibrationPoint> points, bool repeat = false)
void Play(scoped ReadOnlySpan<VibrationPoint> points, bool repeat = false);
Plays linearly interpolated control points, optionally repeating until Stop. At least two points are required, beginning at zero with strictly increasing times, up to 30 seconds. Implementations copy or consume the span before returning. Native devices may resample points or soften the pattern boundaries.
void IVibration.Play(NFloat strength, NFloat frequency)
void Play(nfloat strength, nfloat frequency);
Starts or updates continuous vibration until Stop. Strength and frequency must be finite and in [0, 1]. Frequency describes texture, not physical Hz: iOS maps it to sharpness; Android uses envelope sharpness when supported. Android may replace the native effect when updating; otherwise frequency is ignored. Zero strength silences playback. Native settings and interruptions still apply.
void IVibration.Stop()
void Stop();
Stops playback and cancels pending starts. Safe to call repeatedly.
bool IVibration.SupportsFrequency
bool SupportsFrequency { get; }
Whether normalized frequency/texture control is available.
interface IWindow
Represents a platform-specific window implementation used by the Xui runtime. Each platform (e.g., Windows, macOS, iOS) must provide an implementation of this interface to manage window lifecycle, rendering, and input. This interface is typically paired with an abstract window in the Xui framework, and is not used directly by application developers.
public interface IWindow : IServiceProvider
{
Abstract.IWindow? Abstract { get; }
IServiceProvider NextServiceProvider { get; }
string Title { get; set; }
void Show();
void Close();
void Invalidate();
bool RequireKeyboard { get; set; }
ITextMeasureContext? TextMeasureContext { get; }
}
IWindow? IWindow.Abstract
Abstract.IWindow? Abstract { get; }
Gets the abstract window immediately upstream of this actual window. Together with Xui.Core.Abstract.IWindow.Actual, this forms the bidirectional composed-window chain.
void IWindow.Close()
void Close();
Closes and destroys the platform window. Called when the abstract window is disposed programmatically rather than through a user-initiated close gesture. The default implementation is a no-op for platforms that do not support imperative close.
void IWindow.Invalidate()
void Invalidate();
Requests a redraw of the window surface. The platform should trigger a paint or render callback as soon as possible.
IServiceProvider IWindow.NextServiceProvider
IServiceProvider NextServiceProvider { get; }
The service provider reached after this actual window. Middleware uses this exclusively for its forward service chain; it must never use its abstract event receiver as a service fallback.
bool IWindow.RequireKeyboard
bool RequireKeyboard { get; set; }
Gets or sets whether the window currently requires keyboard input focus. Platforms may use this to show or hide on-screen keyboards.
void IWindow.Show()
void Show();
Displays the window to the user. This may include making it visible, entering the main loop, or attaching it to the application's view hierarchy, depending on the platform.
ITextMeasureContext? IWindow.TextMeasureContext
ITextMeasureContext? TextMeasureContext { get; }
Gets a lightweight text measure context for hit-testing text positions during pointer events. Returns null on platforms that do not support it.
string IWindow.Title
string Title { get; set; }
Gets or sets the window title, where supported by the platform (e.g., desktop).
enum StatusBarAppearance
Foreground appearance of the system status-bar text and icons.
public enum StatusBarAppearance
{
Auto = 0,
Light = 1,
Dark = 2,
}
StatusBarAppearance.Auto
Auto = 0
Follow platform appearance policy (normally the system light/dark theme), not canvas pixel sampling.
StatusBarAppearance.Dark
Dark = 2
Dark text and icons, suitable for a light background.
StatusBarAppearance.Light
Light = 1
Light text and icons, suitable for a dark background.
class VibrationPattern
Shared validation and interpolation for native vibration backends.
public static class VibrationPattern
{
public static readonly TimeSpan MaximumDuration;
public static void Validate(nfloat strength, nfloat frequency);
public static void Validate(scoped ReadOnlySpan<VibrationPoint> points);
public static VibrationPoint Sample(scoped ReadOnlySpan<VibrationPoint> points, TimeSpan time);
}
TimeSpan VibrationPattern.MaximumDuration
public static readonly TimeSpan MaximumDuration;
The portable pattern duration limit, matching one iOS continuous event.
VibrationPoint VibrationPattern.Sample(scoped ReadOnlySpan<VibrationPoint> points, TimeSpan time)
public static VibrationPoint Sample(scoped ReadOnlySpan<VibrationPoint> points, TimeSpan time);
Samples a validated pattern, clamping outside its time range.
void VibrationPattern.Validate(scoped ReadOnlySpan<VibrationPoint> points)
public static void Validate(scoped ReadOnlySpan<VibrationPoint> points);
Validates the point count, times, duration and normalized values.
void VibrationPattern.Validate(NFloat strength, NFloat frequency)
public static void Validate(nfloat strength, nfloat frequency);
Validates a normalized strength/frequency pair.
readonly record struct VibrationPoint
A vibration's normalized strength and frequency/texture at an absolute pattern time.
Time— Time from the beginning of the pattern.Strength— Strength in [0, 1].Frequency— Texture in [0, 1], from soft/low to crisp/high; not Hertz.
public readonly record struct VibrationPoint(TimeSpan Time, nfloat Strength, nfloat Frequency);
VibrationPoint.VibrationPoint(TimeSpan Time, NFloat Strength, NFloat Frequency)
public VibrationPoint(TimeSpan Time, nfloat Strength, nfloat Frequency);
A vibration's normalized strength and frequency/texture at an absolute pattern time.
Time— Time from the beginning of the pattern.Strength— Strength in [0, 1].Frequency— Texture in [0, 1], from soft/low to crisp/high; not Hertz.
NFloat VibrationPoint.Frequency
public nfloat Frequency { get; init; }
Texture in [0, 1], from soft/low to crisp/high; not Hertz.
NFloat VibrationPoint.Strength
public nfloat Strength { get; init; }
Strength in [0, 1].
TimeSpan VibrationPoint.Time
public TimeSpan Time { get; init; }
Time from the beginning of the pattern.