Skip to main content

ButtonInputHandler

Trait ButtonInputHandler 

Source
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§

Source

fn hit_test(&self, mouse_x: f64, mouse_y: f64, rect: &Rect) -> bool

Test if mouse position is inside button rect

Source

fn is_click( &self, press_x: f64, press_y: f64, release_x: f64, release_y: f64, rect: &Rect, ) -> bool

Detect if button was clicked

Source

fn next_focus(&self, current_id: &str, all_ids: &[String]) -> String

Get next focus target when Tab is pressed

Source

fn prev_focus(&self, current_id: &str, all_ids: &[String]) -> String

Get previous focus target when Shift+Tab is pressed

Source

fn is_activation_key(&self, key: &str) -> bool

Check if key activates button (like click)

Implementors§