WindowState

@Stable
class WindowState @RememberInComposition constructor(position: WindowPosition = WindowPosition.PlatformDefault, size: Dimension? = null, extendedState: Int = Frame.NORMAL)

A state object that can be hoisted to control and observe a Window's geometry and extended state.

Every property is two-way: assigning to one repositions, resizes, maximizes, minimizes or restores the realized window, and a user driving the same change through the window system writes the new value back into the state.

Parameters

position

the initial value for position

size

the initial value for size; a null size sizes the window to its content, while a non-null size is applied verbatim

extendedState

the initial value for extendedState

See also

Constructors

Link copied to clipboard
@RememberInComposition
constructor(position: WindowPosition = WindowPosition.PlatformDefault, size: Dimension? = null, extendedState: Int = Frame.NORMAL)

Properties

Link copied to clipboard

The current extended state of the window, a WindowExtendedState bit mask: Frame.MAXIMIZED_BOTH maximizes the window, Frame.ICONIFIED minimizes it, and Frame.NORMAL restores it.

Link copied to clipboard
var height: Int

The current height of the window, in pixels.

Link copied to clipboard

The current top-left position of the window on screen.

Link copied to clipboard

The current size of the window, a width/height pair in pixels.

Link copied to clipboard
var width: Int

The current width of the window, in pixels.