HeadlessWindowExtensions
trait · ferroui-headless · v0.5.0
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.
Members
capture_rendered_frameget_last_rendered_framekey_presskey_press_qwertykey_releasekey_release_qwertykey_text_inputmouse_downmouse_movemouse_upmouse_wheeltouch_begintouch_movetouch_enddrag_dropset_render_scaling
capture_rendered_frame
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.
get_last_rendered_frame
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.
key_press
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.
key_press_qwerty
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.
key_release
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.
key_release_qwerty
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.
key_text_input
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.
mouse_down
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.
mouse_move
fn mouse_move(self: &Self, point: Point, modifiers: RawInputModifiers)
Simulates a mouse move on the headless window/toplevel.
mouse_up
fn mouse_up(self: &Self, point: Point, button: MouseButton, modifiers: RawInputModifiers)
Simulates a mouse up on the headless window/toplevel.
mouse_wheel
fn mouse_wheel(self: &Self, point: Point, delta: Vector, modifiers: RawInputModifiers)
Simulates a mouse wheel on the headless window/toplevel.
touch_begin
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.
touch_move
fn touch_move(self: &Self, touch_pointer: &dyn IHeadlessTouchPointer, point: Point, modifiers: RawInputModifiers)
Moves a simulated touch contact started by
touch_begin.
touch_end
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.
drag_drop
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.
set_render_scaling
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.
Trait implementations
Availability
Extracted for x86_64-unknown-linux-gnu, aarch64-apple-darwin. Cargo features are listed in the crate index.