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§
Sourcefn capture_rendered_frame(&self) -> Option<WriteableBitmap>
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.
Sourcefn get_last_rendered_frame(&self) -> Option<WriteableBitmap>
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.
Sourcefn key_press(
&self,
key: Key,
modifiers: RawInputModifiers,
physical_key: PhysicalKey,
key_symbol: Option<&str>,
)
fn key_press( &self, key: Key, modifiers: RawInputModifiers, physical_key: PhysicalKey, key_symbol: Option<&str>, )
Simulates a keyboard press on the headless window/toplevel.
Sourcefn key_press_qwerty(
&self,
physical_key: PhysicalKey,
modifiers: RawInputModifiers,
)
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.
Sourcefn key_release(
&self,
key: Key,
modifiers: RawInputModifiers,
physical_key: PhysicalKey,
key_symbol: Option<&str>,
)
fn key_release( &self, key: Key, modifiers: RawInputModifiers, physical_key: PhysicalKey, key_symbol: Option<&str>, )
Simulates a keyboard release on the headless window/toplevel.
Sourcefn key_release_qwerty(
&self,
physical_key: PhysicalKey,
modifiers: RawInputModifiers,
)
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.
Sourcefn key_text_input(&self, text: &str)
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.
Sourcefn mouse_down(
&self,
point: Point,
button: MouseButton,
modifiers: RawInputModifiers,
)
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.
Sourcefn mouse_move(&self, point: Point, modifiers: RawInputModifiers)
fn mouse_move(&self, point: Point, modifiers: RawInputModifiers)
Simulates a mouse move on the headless window/toplevel.
Sourcefn mouse_up(
&self,
point: Point,
button: MouseButton,
modifiers: RawInputModifiers,
)
fn mouse_up( &self, point: Point, button: MouseButton, modifiers: RawInputModifiers, )
Simulates a mouse up on the headless window/toplevel.
Sourcefn mouse_wheel(&self, point: Point, delta: Vector, modifiers: RawInputModifiers)
fn mouse_wheel(&self, point: Point, delta: Vector, modifiers: RawInputModifiers)
Simulates a mouse wheel on the headless window/toplevel.
Sourcefn touch_begin(
&self,
point: Point,
modifiers: RawInputModifiers,
) -> Rc<dyn IHeadlessTouchPointer>
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.
Sourcefn touch_move(
&self,
touch_pointer: &dyn IHeadlessTouchPointer,
point: Point,
modifiers: RawInputModifiers,
)
fn touch_move( &self, touch_pointer: &dyn IHeadlessTouchPointer, point: Point, modifiers: RawInputModifiers, )
Moves a simulated touch contact started by
touch_begin.
Sourcefn touch_end(
&self,
touch_pointer: &dyn IHeadlessTouchPointer,
point: Point,
modifiers: RawInputModifiers,
)
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.
Sourcefn drag_drop(
&self,
point: Point,
type_: RawDragEventType,
data: Rc<dyn IDataTransfer>,
effects: DragDropEffects,
modifiers: RawInputModifiers,
)
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.
Sourcefn set_render_scaling(&self, scaling: f64)
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".