Skip to main content

HeadlessWindowExtensions

Trait HeadlessWindowExtensions 

Source
pub trait HeadlessWindowExtensions {
Show 16 methods // Required methods fn capture_rendered_frame(&self) -> Option<WriteableBitmap>; fn get_last_rendered_frame(&self) -> Option<WriteableBitmap>; fn key_press( &self, key: Key, modifiers: RawInputModifiers, physical_key: PhysicalKey, key_symbol: Option<&str>, ); fn key_press_qwerty( &self, physical_key: PhysicalKey, modifiers: RawInputModifiers, ); fn key_release( &self, key: Key, modifiers: RawInputModifiers, physical_key: PhysicalKey, key_symbol: Option<&str>, ); fn key_release_qwerty( &self, physical_key: PhysicalKey, modifiers: RawInputModifiers, ); fn key_text_input(&self, text: &str); fn mouse_down( &self, point: Point, button: MouseButton, modifiers: RawInputModifiers, ); fn mouse_move(&self, point: Point, modifiers: RawInputModifiers); fn mouse_up( &self, point: Point, button: MouseButton, modifiers: RawInputModifiers, ); fn mouse_wheel( &self, point: Point, delta: Vector, modifiers: RawInputModifiers, ); fn touch_begin( &self, point: Point, modifiers: RawInputModifiers, ) -> Rc<dyn IHeadlessTouchPointer>; fn touch_move( &self, touch_pointer: &dyn IHeadlessTouchPointer, point: Point, modifiers: RawInputModifiers, ); fn touch_end( &self, touch_pointer: &dyn IHeadlessTouchPointer, point: Point, modifiers: RawInputModifiers, ); fn drag_drop( &self, point: Point, type_: RawDragEventType, data: Rc<dyn IDataTransfer>, effects: DragDropEffects, modifiers: RawInputModifiers, ); fn set_render_scaling(&self, scaling: f64);
}
Expand description

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.

Required Methods§

Source

fn capture_rendered_frame(&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

fn get_last_rendered_frame(&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

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

Simulates a keyboard press on the headless window/toplevel.

Source

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

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

Source

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

Simulates a keyboard release on the headless window/toplevel.

Source

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

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

Source

fn key_text_input(&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

fn mouse_down( &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

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

Simulates a mouse move on the headless window/toplevel.

Source

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

Simulates a mouse up on the headless window/toplevel.

Source

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

Simulates a mouse wheel on the headless window/toplevel.

Source

fn touch_begin( &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

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

Moves a simulated touch contact started by touch_begin.

Source

fn touch_end( &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

fn drag_drop( &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

fn set_render_scaling(&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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl HeadlessWindowExtensions for TopLevel

Source§

fn capture_rendered_frame(&self) -> Option<WriteableBitmap>

Source§

fn get_last_rendered_frame(&self) -> Option<WriteableBitmap>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn key_text_input(&self, text: &str)

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn set_render_scaling(&self, scaling: f64)

Implementors§