pub trait ButtonState {
// Required methods
fn is_hovered(&self, button_id: &str) -> bool;
fn is_pressed(&self, button_id: &str) -> bool;
fn is_focused(&self, button_id: &str) -> bool;
fn set_hovered(&mut self, button_id: Option<&str>);
fn set_pressed(&mut self, button_id: Option<&str>);
fn set_focused(&mut self, button_id: Option<&str>);
}Expand description
State adapter for button interaction
This trait defines the contract for tracking button interaction state. External projects implement this trait to integrate with their state management systems.
Required Methods§
Sourcefn is_hovered(&self, button_id: &str) -> bool
fn is_hovered(&self, button_id: &str) -> bool
Check if button is currently hovered
Sourcefn is_pressed(&self, button_id: &str) -> bool
fn is_pressed(&self, button_id: &str) -> bool
Check if button is currently pressed
Sourcefn is_focused(&self, button_id: &str) -> bool
fn is_focused(&self, button_id: &str) -> bool
Check if button is currently focused
Sourcefn set_hovered(&mut self, button_id: Option<&str>)
fn set_hovered(&mut self, button_id: Option<&str>)
Set button hover state
Sourcefn set_pressed(&mut self, button_id: Option<&str>)
fn set_pressed(&mut self, button_id: Option<&str>)
Set button pressed state
Sourcefn set_focused(&mut self, button_id: Option<&str>)
fn set_focused(&mut self, button_id: Option<&str>)
Set button focus state