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§
Sourcefn platform_info(&self) -> PlatformInfo
fn platform_info(&self) -> PlatformInfo
Get platform info
Sourcefn mouse_position(&self) -> Result<(i32, i32)>
fn mouse_position(&self) -> Result<(i32, i32)>
Get mouse position
Sourcefn screen_size(&self) -> Result<(i32, i32)>
fn screen_size(&self) -> Result<(i32, i32)>
Get screen size
Sourcefn drag(
&self,
start_x: i32,
start_y: i32,
end_x: i32,
end_y: i32,
button: &str,
) -> Result<()>
fn drag( &self, start_x: i32, start_y: i32, end_x: i32, end_y: i32, button: &str, ) -> Result<()>
Drag from current to target
Sourcefn get_active_window(&self) -> Result<WindowInfo>
fn get_active_window(&self) -> Result<WindowInfo>
Get active window
Sourcefn list_windows(&self) -> Result<Vec<WindowInfo>>
fn list_windows(&self) -> Result<Vec<WindowInfo>>
List all windows
Sourcefn focus_window(&self, title: &str) -> Result<bool>
fn focus_window(&self, title: &str) -> Result<bool>
Focus/activate window by title
Sourcefn minimize_window(&self, title: &str) -> Result<bool>
fn minimize_window(&self, title: &str) -> Result<bool>
Minimize window by title
Sourcefn maximize_window(&self, title: &str) -> Result<bool>
fn maximize_window(&self, title: &str) -> Result<bool>
Maximize window by title
Sourcefn resize_window(&self, title: &str, width: i32, height: i32) -> Result<bool>
fn resize_window(&self, title: &str, width: i32, height: i32) -> Result<bool>
Resize window by title
Sourcefn close_window(&self, title: &str) -> Result<bool>
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".