Vixen
02b45cc4
csharp
public sealed class PlatformWindowHost

Gives a document's surfaces real operating-system windows.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The implementation of IUiWindowHost, which is the seam a Core/ assembly could declare and could not fill. A control asks the document for a window; the document asks this; this asks the platform. Nothing above Vixen.Platform is named anywhere in the chain, so a docking host that tears a panel out onto the desktop is the same docking host that floats it inside the page in a browser.

⚠ The main window is registered rather than created. The application head made it, gave it a swapchain and is presenting to it; this only needs to know which surface it is showing, because that is what makes TryLocate able to answer for it — and a drag out of the main window is measured from exactly there.

Threading. The platform is owned by the thread that created it and so is this. Every window operation here is a platform call, and AppKit refuses to touch a window from anywhere but the main thread.

Fields and properties (3)

  • public IWindow Main

    The window the primary surface is shown in.

  • public IReadOnlyList<PlatformUiWindow> Windows

    The windows this host opened, in the order it opened them.

  • public bool CanOpen

Methods (9)

  • public PlatformWindowHost(IPlatform platform, UiDocument document, IWindow main)

    Registers a document's primary surface as living in an existing window.

  • public IUiWindow? Open(UiDocument document, in UiWindowRequest request)

    Opens one, with a surface of the document in it.

  • public static bool IsReachable(IPlatform platform, float x, float y, float width, float height)

    Whether a window put there would have a title bar somebody can grab.

  • public static bool IsReachable(IReadOnlyList<DisplayInfo> displays, float x, float y, float width, float height)
  • public bool TryLocate(UiSurface surface, out float x, out float y)

    Where a surface's top-left corner is on the desktop.

  • public bool TryResolve(uint windowId, out UiSurface? surface)

    Which surface a window's events belong to.

  • public bool TryWindow(UiSurface surface, out IWindow? window)

    Which window a surface is shown in.

  • public bool Handle(in PlatformEvent platformEvent)

    Deals with the events that are about a window rather than about input.

  • public void Dispose()

Used by (5)

  • PlatformUiWindowVixen.Platform.Ui
  • PlatformWindowHostTestsVixen.Platform.Ui.Tests
  • WindowReachabilityTestsVixen.Platform.Ui.Tests
  • EditorHostVixen.Editor.Host
  • WindowPlacementVixen.Editor.Host