pub trait ButtonInputHandler {
// Provided methods
fn hit_test(&self, mouse_x: f64, mouse_y: f64, rect: &Rect) -> bool { ... }
fn is_click(
&self,
press_x: f64,
press_y: f64,
release_x: f64,
release_y: f64,
rect: &Rect,
) -> bool { ... }
fn next_focus(&self, current_id: &str, all_ids: &[String]) -> String { ... }
fn prev_focus(&self, current_id: &str, all_ids: &[String]) -> String { ... }
fn is_activation_key(&self, key: &str) -> bool { ... }
}Expand description
Input handler adapter for button events
This trait defines the contract for converting raw input events into button actions. External projects implement this trait to customize input behavior (rare).
Provided Methods§
Sourcefn hit_test(&self, mouse_x: f64, mouse_y: f64, rect: &Rect) -> bool
fn hit_test(&self, mouse_x: f64, mouse_y: f64, rect: &Rect) -> bool
Test if mouse position is inside button rect
Sourcefn is_click(
&self,
press_x: f64,
press_y: f64,
release_x: f64,
release_y: f64,
rect: &Rect,
) -> bool
fn is_click( &self, press_x: f64, press_y: f64, release_x: f64, release_y: f64, rect: &Rect, ) -> bool
Detect if button was clicked
Sourcefn next_focus(&self, current_id: &str, all_ids: &[String]) -> String
fn next_focus(&self, current_id: &str, all_ids: &[String]) -> String
Get next focus target when Tab is pressed
Sourcefn prev_focus(&self, current_id: &str, all_ids: &[String]) -> String
fn prev_focus(&self, current_id: &str, all_ids: &[String]) -> String
Get previous focus target when Shift+Tab is pressed
Sourcefn is_activation_key(&self, key: &str) -> bool
fn is_activation_key(&self, key: &str) -> bool
Check if key activates button (like click)