BOSON Help

Window Events

The window will automatically emit the following events (and intentions) during its lifecycle.

To subscribe to events, you can use direct access to the event listener, using Window::$events property.

$app->events->addEventListener(Event::class, function (Event $e) { var_dump($e); });

The window instance also supports a more convenient and simple way of registering events using the on() method.

$app->window->on(function (Event $event): void { var_dump($event); });

Closing Intention

An Boson\Window\Event\WindowClosing intention to close the window.

class WindowClosing<Window>

Closed Event

An Boson\Window\Event\WindowClosed event fired after the window has been closed and the Boson\Window\Event\WindowClosing intention has not been cancelled.

class WindowClosed<Window>

Created Event

An Boson\Window\Event\WindowCreated event fired after window has been created.

class WindowCreated<Window>

Decorated Event

An Boson\Window\Event\WindowDecorated event fired after window controls visibility changed.

class WindowDecorated<Window> { public readonly bool $isDecorated; }
  • $isDecorated - Visibility status of the OS window controls.

Decoration Changed Event

An Boson\Window\Event\WindowDecorationChanged event fired after window decoration has been changed.

class WindowDecorationChanged<Window> { public readonly Boson\Window\WindowDecoration $decoration; public readonly Boson\Window\WindowDecoration $previous; }
  • $decoration - Decorations type of the window.

  • $previous - Previous decorations type of the window.

Focused Event

An Boson\Window\Event\WindowFocused event fired after window focus has been changed.

class WindowFocused<Window> { public readonly bool $isFocused; }

Maximized Event

An Boson\Window\Event\WindowMaximized event fired after window maximized state has been changed.

class WindowMaximized<Window> { public readonly bool $isMaximized; }

Minimized Event

An Boson\Window\Event\WindowMinimized event fired after window minimized state has been changed.

class WindowMinimized<Window> { public readonly bool $isMinimized; }

Resized Event

An Boson\Window\Event\WindowResized event fired after window size has been changed.

class WindowResized<Window> { public readonly int $width; public readonly int $height; }
  • $width - Window width dimension in pixels.

  • $height - Window height dimension in pixels.

State Changed Event

An Boson\Window\Event\WindowStateChanged event fired after window state has been changed.

class WindowStateChanged<Window> { public readonly Boson\Window\WindowState $state; public readonly Boson\Window\WindowState $previous; }
  • $state - State type of the window.

  • $previous - Previous state type of the window.

08 May 2025