Skip to main content

NativeControl

Trait NativeControl 

Source
pub trait NativeControl: Send + Sync {
Show 24 methods // Required methods fn platform_info(&self) -> PlatformInfo; fn mouse_position(&self) -> Result<(i32, i32)>; fn screen_size(&self) -> Result<(i32, i32)>; fn click(&self, x: i32, y: i32, button: &str) -> Result<()>; fn double_click(&self, x: i32, y: i32) -> Result<()>; fn move_to(&self, x: i32, y: i32) -> Result<()>; fn drag( &self, start_x: i32, start_y: i32, end_x: i32, end_y: i32, button: &str, ) -> Result<()>; fn scroll(&self, amount: i32, x: Option<i32>, y: Option<i32>) -> Result<()>; fn key_down(&self, key: &str) -> Result<()>; fn key_up(&self, key: &str) -> Result<()>; fn press(&self, key: &str) -> Result<()>; fn hotkey(&self, keys: &[String]) -> Result<()>; fn type_char(&self, c: char) -> Result<()>; fn type_text(&self, text: &str, interval: f64) -> Result<()>; fn screenshot(&self, region: Option<&[i32]>) -> Result<Vec<u8>>; fn get_pixel(&self, x: i32, y: i32) -> Result<(u8, u8, u8)>; fn get_active_window(&self) -> Result<WindowInfo>; fn list_windows(&self) -> Result<Vec<WindowInfo>>; fn focus_window(&self, title: &str) -> Result<bool>; fn minimize_window(&self, title: &str) -> Result<bool>; fn maximize_window(&self, title: &str) -> Result<bool>; fn resize_window( &self, title: &str, width: i32, height: i32, ) -> Result<bool>; fn move_window(&self, title: &str, x: i32, y: i32) -> Result<bool>; fn close_window(&self, title: &str) -> Result<bool>;
}
Expand description

Native control trait - implemented per platform Aligned with TypeScript AutoGUIAdapter interface

Required Methods§

Source

fn platform_info(&self) -> PlatformInfo

Get platform info

Source

fn mouse_position(&self) -> Result<(i32, i32)>

Get mouse position

Source

fn screen_size(&self) -> Result<(i32, i32)>

Get screen size

Source

fn click(&self, x: i32, y: i32, button: &str) -> Result<()>

Click at position

Source

fn double_click(&self, x: i32, y: i32) -> Result<()>

Double click

Source

fn move_to(&self, x: i32, y: i32) -> Result<()>

Move mouse

Source

fn drag( &self, start_x: i32, start_y: i32, end_x: i32, end_y: i32, button: &str, ) -> Result<()>

Drag from current to target

Source

fn scroll(&self, amount: i32, x: Option<i32>, y: Option<i32>) -> Result<()>

Scroll

Source

fn key_down(&self, key: &str) -> Result<()>

Press key down

Source

fn key_up(&self, key: &str) -> Result<()>

Release key

Source

fn press(&self, key: &str) -> Result<()>

Press and release key

Source

fn hotkey(&self, keys: &[String]) -> Result<()>

Press key combination

Source

fn type_char(&self, c: char) -> Result<()>

Type character

Source

fn type_text(&self, text: &str, interval: f64) -> Result<()>

Type text

Source

fn screenshot(&self, region: Option<&[i32]>) -> Result<Vec<u8>>

Take screenshot

Source

fn get_pixel(&self, x: i32, y: i32) -> Result<(u8, u8, u8)>

Get pixel color at position

Source

fn get_active_window(&self) -> Result<WindowInfo>

Get active window

Source

fn list_windows(&self) -> Result<Vec<WindowInfo>>

List all windows

Source

fn focus_window(&self, title: &str) -> Result<bool>

Focus/activate window by title

Source

fn minimize_window(&self, title: &str) -> Result<bool>

Minimize window by title

Source

fn maximize_window(&self, title: &str) -> Result<bool>

Maximize window by title

Source

fn resize_window(&self, title: &str, width: i32, height: i32) -> Result<bool>

Resize window by title

Source

fn move_window(&self, title: &str, x: i32, y: i32) -> Result<bool>

Move window by title

Source

fn close_window(&self, title: &str) -> Result<bool>

Close window by title

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§