// Generated API outline. Implementation bodies omitted.
#nullable enable
namespace Xui.Middleware.Emulator
{
using System;
using Xui.Core.Abstract;
using Xui.Core.Actual;
///
/// Creates the desktop emulator host while the application continues to create
/// its ordinary mobile-facing window.
///
public sealed class EmulatorAppPlatform(IRuntime basePlatform, bool compact = false) : IRuntime
{
///
/// Gets the main thread dispatcher for scheduling UI work.
/// Used to marshal execution onto the main thread for layout, input, and rendering.
///
public IDispatcher MainDispatcher { get; }
///
/// 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.
///
/// The abstract application instance defined by user code.
/// A platform-specific run loop instance.
public IRunLoop CreateRunloop(Application applicationAbstract);
///
/// Creates a platform-specific window that is bound to the given abstract window definition.
///
/// The abstract window definition provided by user code.
/// The window/application service chain reached after platform services.
/// A concrete window implementation for the current platform.
public Xui.Core.Actual.IWindow CreateWindow(Xui.Core.Abstract.IWindow windowAbstract, IServiceProvider applicationServices);
}
}
namespace Xui.Middleware.Emulator
{
using System;
using Xui.Core.Abstract.Events;
using Xui.Core.Abstract;
using Xui.Middleware.Emulator.Devices;
using Xui.Middleware.Emulator.UI;
///
/// The ordinary desktop window that will host the emulator application UI.
///
public sealed class EmulatorAppWindow : Window, IMacOSWindowStyle
{
/// Initializes the desktop host window.
public EmulatorAppWindow(IServiceProvider context, bool compact = false);
///
/// The desktop runtime owns the frame clock. Forward it to the virtual mobile
/// window as well, so animation requests made by the emulated app keep running.
///
public override void OnAnimationFrame(ref FrameEventRef e);
///
/// Invoked when a key is pressed.
///
/// The keyboard event data.
public override void OnKeyDown(ref KeyEventRef e);
///
/// Invoked when a character is input (after keyboard translation).
///
/// The keyboard event data with the translated character.
public override void OnChar(ref KeyEventRef e);
}
}
namespace Xui.Middleware.Emulator
{
using AppWindow = Xui.Core.Abstract.Window;
using System;
using Xui.Core.Abstract.Events;
using Xui.Core.Actual;
using Xui.Core.Canvas;
using Xui.Core.Math2D;
using Xui.Core.UI.Input;
using Xui.Core.UI;
using Xui.Middleware.Emulator.Devices;
using Xui.Middleware.Emulator.UI.Phone;
///
/// Embeds a mobile window inside an existing view tree, with phone chrome and
/// translated touch input. The host supplies rendering resources and the frame clock.
///
public sealed class EmulatorView : View, IDisposable
{
/// Creates an embedded iPhone emulator for the supplied application window factory.
public EmulatorView(Func createWindow);
/// The isolated mobile window, created when this view first becomes active.
public AppWindow? AppWindow { get; }
/// The phone display rectangle in the host view's coordinate space.
public Rect ScreenFrame { get; }
///
/// Returns the number of child views. Used by layout containers and traversal logic.
/// Leaf views should return 0.
///
public override int Count { get; }
///
/// Indexer to access child views by index.
/// Layout containers should implement this to expose their children.
///
public override View this[int index] { get; }
///
/// Gets whether this view can receive keyboard focus via Tab navigation.
///
public override bool Focusable { get; }
///
/// Called when this view becomes active — it will receive events, render, and animate.
/// Override this to start animations, subscribe to data sources, or acquire resources.
///
protected override void OnActivate();
///
/// Called when this view becomes dormant — it should stop animations, timers, and event subscriptions.
/// The view may remain in the tree (e.g., in a virtualizing panel's recycle pool).
///
protected override void OnDeactivate();
/// Override to compute the desired border-edge size.
protected override Size MeasureCore(Size available, IMeasureContext context);
/// Override to arrange children within this view's final frame.
protected override void ArrangeCore(Rect rect, IMeasureContext context);
/// Override to animate this view and its children.
protected override void AnimateCore(TimeSpan previous, TimeSpan current);
/// Override to render this view and its children.
protected override void RenderCore(IContext context);
///
/// Called during event dispatch to handle a pointer event in a specific event phase.
///
public override void OnPointerEvent(ref PointerEventRef e, EventPhase phase);
///
/// Called when a key is pressed while this view has focus.
///
public override void OnKeyDown(ref KeyEventRef e);
///
/// Called when a character is input while this view has focus.
///
public override void OnChar(ref KeyEventRef e);
/// Releases the mobile window without closing the desktop host.
public void Dispose();
}
}
namespace Xui.Middleware.Emulator
{
using NFloat = System.Runtime.InteropServices.NFloat;
using System;
using Xui.Core.Abstract;
using Xui.Core.Actual;
using Xui.Core.Canvas;
using Xui.Core.DI;
///
/// Runs an application's desktop window on another runtime's client surface.
/// The host owns the window frame and size; mouse, keyboard, drawing and GPU
/// services remain those of the host. No native operating system is simulated.
///
public sealed class WindowEmulatorPlatform(IRuntime host, DevicePlatform platform = DevicePlatform.Browser) : IRuntime
{
///
/// Gets the main thread dispatcher for scheduling UI work.
/// Used to marshal execution onto the main thread for layout, input, and rendering.
///
public IDispatcher MainDispatcher { get; }
///
/// 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.
///
/// The abstract application instance defined by user code.
/// A platform-specific run loop instance.
public IRunLoop CreateRunloop(Application application);
///
/// Creates a platform-specific window that is bound to the given abstract window definition.
///
/// The abstract window definition provided by user code.
/// The window/application service chain reached after platform services.
/// A concrete window implementation for the current platform.
public Xui.Core.Actual.IWindow CreateWindow(Xui.Core.Abstract.IWindow window, IServiceProvider services);
}
}