Table of Contents

Interface ITopLevelImpl

Namespace
Avalonia.Platform
Assembly
Avalonia.Controls.dll

Defines a platform-specific top-level window implementation.

[Unstable]
public interface ITopLevelImpl : IOptionalFeatureProvider, IDisposable
Inherited Members

Remarks

This interface is the common interface to IWindowImpl and IPopupImpl.

Properties

AcrylicCompensationLevels

Gets the AcrylicPlatformCompensationLevels for the platform.

AcrylicPlatformCompensationLevels AcrylicCompensationLevels { get; }

Property Value

AcrylicPlatformCompensationLevels

ClientSize

Gets the client size of the toplevel.

Size ClientSize { get; }

Property Value

Size

Closed

Gets or sets a method called when the underlying implementation is destroyed.

Action? Closed { get; set; }

Property Value

Action

Compositor

Gets the compositor that's compatible with the toplevel

Compositor Compositor { get; }

Property Value

Compositor

DesktopScaling

Gets the scaling factor for Window positioning and sizing.

double DesktopScaling { get; }

Property Value

double

Handle

Get the platform handle.

IPlatformHandle? Handle { get; }

Property Value

IPlatformHandle

Input

Gets or sets a method called when the toplevel receives input.

Action<RawInputEventArgs>? Input { get; set; }

Property Value

Action<RawInputEventArgs>

LostFocus

Gets or sets a method called when the input focus is lost.

Action? LostFocus { get; set; }

Property Value

Action

Paint

Gets or sets a method called when the toplevel requires painting.

Action<Rect>? Paint { get; set; }

Property Value

Action<Rect>

RenderScaling

Gets the scaling factor for the toplevel. This is used for rendering.

double RenderScaling { get; }

Property Value

double

Resized

Gets or sets a method called when the toplevel is resized.

Action<Size, WindowResizeReason>? Resized { get; set; }

Property Value

Action<Size, WindowResizeReason>

ScalingChanged

Gets or sets a method called when the toplevel's scaling changes.

Action<double>? ScalingChanged { get; set; }

Property Value

Action<double>

Surfaces

The list of native platform's surfaces that can be consumed by rendering subsystems.

IEnumerable<object> Surfaces { get; }

Property Value

IEnumerable<object>

Remarks

Rendering platform will check that list and see if it can utilize one of them to output. It should be enough to expose a native window handle via IPlatformHandle and add support for framebuffer (even if it's emulated one) via IFramebufferPlatformSurface. If you have some rendering platform that's tied to your particular windowing platform, just expose some toolkit-specific object (e. g. Func<Gdk.Drawable> in case of GTK#+Cairo)

TransparencyLevel

Gets the current WindowTransparencyLevel of the TopLevel.

WindowTransparencyLevel TransparencyLevel { get; }

Property Value

WindowTransparencyLevel

TransparencyLevelChanged

Gets or sets a method called when the toplevel's TransparencyLevel changes.

Action<WindowTransparencyLevel>? TransparencyLevelChanged { get; set; }

Property Value

Action<WindowTransparencyLevel>

Methods

CreatePopup()

IPopupImpl? CreatePopup()

Returns

IPopupImpl

PointToClient(PixelPoint)

Converts a point from screen to client coordinates.

Point PointToClient(PixelPoint point)

Parameters

point PixelPoint

The point in screen coordinates.

Returns

Point

The point in client coordinates.

PointToScreen(Point)

Converts a point from client to screen coordinates.

PixelPoint PointToScreen(Point point)

Parameters

point Point

The point in client coordinates.

Returns

PixelPoint

The point in screen coordinates.

SetCursor(ICursorImpl?)

Sets the cursor associated with the toplevel.

void SetCursor(ICursorImpl? cursor)

Parameters

cursor ICursorImpl

The cursor. Use null for default cursor

SetFrameThemeVariant(PlatformThemeVariant)

Sets the PlatformThemeVariant on the frame if it should be dark or light. Also applies for the mobile status bar.

void SetFrameThemeVariant(PlatformThemeVariant themeVariant)

Parameters

themeVariant PlatformThemeVariant

SetInputRoot(IInputRoot)

Sets the IInputRoot for the toplevel.

void SetInputRoot(IInputRoot inputRoot)

Parameters

inputRoot IInputRoot

SetTransparencyLevelHint(IReadOnlyList<WindowTransparencyLevel>)

Sets the WindowTransparencyLevel hint of the TopLevel.

void SetTransparencyLevelHint(IReadOnlyList<WindowTransparencyLevel> transparencyLevels)

Parameters

transparencyLevels IReadOnlyList<WindowTransparencyLevel>