Vixen
02b45cc4
csharp
public interface IWindow

One window, or one thing shaped like a window.

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

Remarks

"Shaped like a window" is not a hedge. A headless platform creates these too: they have a size, an id, a lifecycle and an event stream, and their Surface reports None. That is what lets the dedicated server run the same frame loop as the desktop build rather than a second one written for it, and it is why the headless path is exercised on every test run instead of being discovered to have rotted in Phase 9.

Properties report the platform's answer, not the last thing that was asked for. Setting ClientSize is a request: a tiling window manager may ignore it, a mobile platform certainly will, and reading it back afterwards may return something else. Code that needs to know what happened listens for WindowResized.

Disposing destroys the window. Closing it from the title bar does not — that arrives as WindowCloseRequested and the window stays open until the application agrees, which is what makes "save before quitting?" possible.

Fields and properties (16)

  • uint Id

    This window's id, as it appears in WindowId.

  • string Title

    The title bar text.

  • Int2 ClientSize

    The client area's size in logical points.

  • Int2 FramebufferSize

    The framebuffer's size in physical pixels — ClientSize times DpiScale, subject to the platform's rounding.

  • Int2 Position

    The top-left corner in desktop coordinates.

  • float DpiScale

    How many physical pixels there are per logical point.

  • WindowMode Mode

    How the window relates to its display.

  • bool IsResizable

    Whether the user may resize it.

  • bool IsVisible

    Whether it is currently on screen.

  • bool IsFocused

    Whether it has keyboard focus.

  • bool IsMinimised

    Whether it is minimised, and therefore not worth rendering to.

  • bool IsClosed

    Whether it has been disposed. Every other member throws once this is true.

  • int DisplayIndex

    Which display it is mostly on.

  • CursorMode CursorMode

    What the cursor does over it.

  • CursorShape CursorShape

    Which stock cursor to draw over it.

  • ISurface Surface

    The thing a graphics backend presents to.

Methods (6)

  • void Show()

    Shows the window.

  • void Hide()

    Hides the window without destroying it.

  • void Focus()

    Asks for keyboard focus.

  • void Centre()

    Centres the window on its display.

  • void RequestAttention()

    Asks the OS to draw attention to the window — a bouncing dock icon, a flashing taskbar button.

  • void SetIcon(ReadOnlySpan<byte> pixels, Int2 size)

    Sets the window and taskbar icon from straight (non-premultiplied) RGBA8 pixels.

Used by (48, showing 40)

  • MouseCaptureSystemThirdPersonShooter
  • PbrShowcaseGamePbrShowcase
  • ProgramHelloUi
  • TriangleGameHelloTriangle
  • UiHostHelloUi
  • VideoGameVideoPlayback
  • VirtualGeometryGameVirtualGeometry
  • AppBuilderVixen.App.Hosting
  • AppGraphicsVixen.App.Hosting
  • AppServicesVixen.App.Hosting
  • DesktopDialogsVixen.Platform.Desktop
  • DesktopDisplaysVixen.Platform.Desktop
  • DesktopGlContextTestsVixen.Platform.Desktop.Tests
  • DesktopPlatformVixen.Platform.Desktop
  • DesktopPlatformTestsVixen.Platform.Desktop.Tests
  • DesktopTextInputVixen.Platform.Desktop
  • DesktopWindowVixen.Platform.Desktop
  • HeadlessDialogsVixen.Platform.Headless
  • HeadlessDisplaysVixen.Platform.Headless
  • HeadlessLifecycleTestsVixen.Platform.Headless.Tests
  • HeadlessPlatformVixen.Platform.Headless
  • HeadlessPlatformTestsVixen.Platform.Headless.Tests
  • HeadlessTextInputVixen.Platform.Headless
  • HeadlessWindowVixen.Platform.Headless
  • IDisplayInfoVixen.Platform
  • IGraphicsBackendVixen.App.Hosting
  • INativeDialogsVixen.Platform
  • IPlatformVixen.Platform
  • ITextInputVixen.Platform
  • LinuxDialogsVixen.Platform.Linux
  • MacOSDialogsVixen.Platform.MacOS
  • NothingDialogsVixen.Platform.Desktop.Tests
  • NothingDialogsVixen.Platform.MacOS.Tests
  • PlatformExtensionsVixen.Platform
  • PlatformExtensionsTestsVixen.Platform.Headless.Tests
  • PlatformUiWindowVixen.Platform.Ui
  • PlatformWindowHostVixen.Platform.Ui
  • PlatformWindowHostTestsVixen.Platform.Ui.Tests
  • VixenApplicationVixen.App.Hosting
  • WindowsDialogsVixen.Platform.Windows