# HeadlessWindowExtensions

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-headless/trait-headlesswindowextensions/

**trait** · [`ferroui-headless`](/docs/0.5.0/api/ferroui-headless/) · v0.5.0

```rust
trait HeadlessWindowExtensions
```

Set of extension methods to simplify usage of headless windows in the
headless scenarios.

The parameters that are optional in the original
(`RawInputModifiers.None`) are always given.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L27)

## Members

- [`capture_rendered_frame`](#function-capture_rendered_frame)
- [`get_last_rendered_frame`](#function-get_last_rendered_frame)
- [`key_press`](#function-key_press)
- [`key_press_qwerty`](#function-key_press_qwerty)
- [`key_release`](#function-key_release)
- [`key_release_qwerty`](#function-key_release_qwerty)
- [`key_text_input`](#function-key_text_input)
- [`mouse_down`](#function-mouse_down)
- [`mouse_move`](#function-mouse_move)
- [`mouse_up`](#function-mouse_up)
- [`mouse_wheel`](#function-mouse_wheel)
- [`touch_begin`](#function-touch_begin)
- [`touch_move`](#function-touch_move)
- [`touch_end`](#function-touch_end)
- [`drag_drop`](#function-drag_drop)
- [`set_render_scaling`](#function-set_render_scaling)

<a id="function-capture_rendered_frame"></a>

### capture_rendered_frame

```rust
fn capture_rendered_frame(self: &Self) -> Option<WriteableBitmap>
```

Triggers a renderer timer tick and captures last rendered frame.

Returns the bitmap with last rendered frame; `None` if nothing was
rendered.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L32)

<a id="function-get_last_rendered_frame"></a>

### get_last_rendered_frame

```rust
fn get_last_rendered_frame(self: &Self) -> Option<WriteableBitmap>
```

Reads last rendered frame.
Note, in order to trigger rendering timer,
`FerroHeadlessPlatform::force_render_timer_tick` method should be
called.

Returns the bitmap with last rendered frame; `None` if nothing was
rendered.
## Panics
Panics if the application uses the headless drawing
(`NotSupportedException`): it draws nothing.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L45)

<a id="function-key_press"></a>

### key_press

```rust
fn key_press(self: &Self, key: Key, modifiers: RawInputModifiers, physical_key: PhysicalKey, key_symbol: Option<&str>)
```

Simulates a keyboard press on the headless window/toplevel.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L48)

<a id="function-key_press_qwerty"></a>

### key_press_qwerty

```rust
fn key_press_qwerty(self: &Self, physical_key: PhysicalKey, modifiers: RawInputModifiers)
```

Simulates a keyboard press on the headless window/toplevel, as if
typed on a QWERTY keyboard.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L52)

<a id="function-key_release"></a>

### key_release

```rust
fn key_release(self: &Self, key: Key, modifiers: RawInputModifiers, physical_key: PhysicalKey, key_symbol: Option<&str>)
```

Simulates a keyboard release on the headless window/toplevel.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L55)

<a id="function-key_release_qwerty"></a>

### key_release_qwerty

```rust
fn key_release_qwerty(self: &Self, physical_key: PhysicalKey, modifiers: RawInputModifiers)
```

Simulates a keyboard release on the headless window/toplevel, as if
typed on a QWERTY keyboard.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L59)

<a id="function-key_text_input"></a>

### key_text_input

```rust
fn key_text_input(self: &Self, text: &str)
```

Simulates a text input event on the headless window/toplevel.

This event is independent of `key_press` and
`key_release`. If you need to simulate text
input to a TextBox or a similar control, please use this method.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L66)

<a id="function-mouse_down"></a>

### mouse_down

```rust
fn mouse_down(self: &Self, point: Point, button: MouseButton, modifiers: RawInputModifiers)
```

Simulates a mouse down on the headless window/toplevel.

In the headless platform, there is a single mouse pointer. There are
no helper methods for pen input; for touch, see
`touch_begin`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L73)

<a id="function-mouse_move"></a>

### mouse_move

```rust
fn mouse_move(self: &Self, point: Point, modifiers: RawInputModifiers)
```

Simulates a mouse move on the headless window/toplevel.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L76)

<a id="function-mouse_up"></a>

### mouse_up

```rust
fn mouse_up(self: &Self, point: Point, button: MouseButton, modifiers: RawInputModifiers)
```

Simulates a mouse up on the headless window/toplevel.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L79)

<a id="function-mouse_wheel"></a>

### mouse_wheel

```rust
fn mouse_wheel(self: &Self, point: Point, delta: Vector, modifiers: RawInputModifiers)
```

Simulates a mouse wheel on the headless window/toplevel.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L82)

<a id="function-touch_begin"></a>

### touch_begin

```rust
fn touch_begin(self: &Self, point: Point, modifiers: RawInputModifiers) -> Rc<dyn IHeadlessTouchPointer>
```

Begins a simulated touch contact on the headless window/toplevel.

Each call begins an independent contact with its own unique touch
id, so several contacts can be active at the same time to simulate
multi-touch gestures.

Returns a touch pointer representing the contact. Pass it to
`touch_move` and `touch_end`,
or dispose it to cancel the contact.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L93)

<a id="function-touch_move"></a>

### touch_move

```rust
fn touch_move(self: &Self, touch_pointer: &dyn IHeadlessTouchPointer, point: Point, modifiers: RawInputModifiers)
```

Moves a simulated touch contact started by
`touch_begin`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L97)

<a id="function-touch_end"></a>

### touch_end

```rust
fn touch_end(self: &Self, touch_pointer: &dyn IHeadlessTouchPointer, point: Point, modifiers: RawInputModifiers)
```

Ends a simulated touch contact started by
`touch_begin`, as if the finger was lifted.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L101)

<a id="function-drag_drop"></a>

### drag_drop

```rust
fn drag_drop(self: &Self, point: Point, type_: RawDragEventType, data: Rc<dyn IDataTransfer>, effects: DragDropEffects, modifiers: RawInputModifiers)
```

Simulates a drag and drop target event on the headless
window/toplevel. This event simulates a user moving files from
another app to the current app.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L106)

<a id="function-set_render_scaling"></a>

### set_render_scaling

```rust
fn set_render_scaling(self: &Self, scaling: f64)
```

Changes the render scaling (DPI scaling) of the headless
window/toplevel. This simulates a DPI change, triggering scaling
changed notifications and a layout pass.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/Headless/FerroUI.Headless/headless_window_extensions.rs#L118)

## Trait implementations

- [`HeadlessWindowExtensions`](/docs/0.5.0/api/ferroui-headless/trait-headlesswindowextensions/)

## Availability

Extracted for `x86_64-unknown-linux-gnu`, `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
