pub struct Button { /* private fields */ }Expand description
A clickable button widget
Implementations§
Source§impl Button
impl Button
Sourcepub fn variant(self, variant: ButtonVariant) -> Self
pub fn variant(self, variant: ButtonVariant) -> Self
Set button variant
Sourcepub fn handle_key(&mut self, key: &Key) -> bool
pub fn handle_key(&mut self, key: &Key) -> bool
Handle key input, returns true if button was “clicked”
Sourcepub fn handle_mouse(&mut self, event: &MouseEvent, area: Rect) -> (bool, bool)
pub fn handle_mouse(&mut self, event: &MouseEvent, area: Rect) -> (bool, bool)
Sourcepub fn is_pressed(&self) -> bool
pub fn is_pressed(&self) -> bool
Check if button is pressed
Sourcepub fn is_hovered(&self) -> bool
pub fn is_hovered(&self) -> bool
Check if button is hovered
Source§impl Button
impl Button
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Check if widget is focused
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
Check if widget is disabled
Sourcepub fn set_focused(&mut self, focused: bool)
pub fn set_focused(&mut self, focused: bool)
Set focused state (mutable)
Trait Implementations§
Source§impl Interactive for Button
impl Interactive for Button
Source§fn handle_key(&mut self, event: &KeyEvent) -> EventResult
fn handle_key(&mut self, event: &KeyEvent) -> EventResult
Handle keyboard event Read more
Source§fn handle_mouse(&mut self, event: &MouseEvent, area: Rect) -> EventResult
fn handle_mouse(&mut self, event: &MouseEvent, area: Rect) -> EventResult
Handle mouse event Read more
Source§impl StyledView for Button
impl StyledView for Button
Source§fn remove_class(&mut self, class: &str)
fn remove_class(&mut self, class: &str)
Remove a CSS class
Source§fn toggle_class(&mut self, class: &str)
fn toggle_class(&mut self, class: &str)
Toggle a CSS class
Auto Trait Implementations§
impl Freeze for Button
impl RefUnwindSafe for Button
impl Send for Button
impl Sync for Button
impl Unpin for Button
impl UnwindSafe for Button
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more