Skip to main content

ButtonState

Trait ButtonState 

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

Source

fn is_hovered(&self, button_id: &str) -> bool

Check if button is currently hovered

Source

fn is_pressed(&self, button_id: &str) -> bool

Check if button is currently pressed

Source

fn is_focused(&self, button_id: &str) -> bool

Check if button is currently focused

Source

fn set_hovered(&mut self, button_id: Option<&str>)

Set button hover state

Source

fn set_pressed(&mut self, button_id: Option<&str>)

Set button pressed state

Source

fn set_focused(&mut self, button_id: Option<&str>)

Set button focus state

Implementors§