pub struct ButtonState {
pub area: Rect,
pub inner: Rect,
pub armed: bool,
pub armed_delay: Option<Duration>,
pub focus: FocusFlag,
pub mouse: MouseFlags,
pub non_exhaustive: NonExhaustive,
}Expand description
State & event-handling.
Fields§
§area: RectComplete area read only. renewed for each render.
inner: RectArea inside the block. read only. renewed for each render.
armed: boolButton has been clicked but not released yet. read only
armed_delay: Option<Duration>Some terminals repaint too fast to see the click. This adds some delay when the button state goes from armed to clicked.
Default is 50ms. read+write
focus: FocusFlagCurrent focus state. read+write
mouse: MouseFlagsMouse interaction. read only
non_exhaustive: NonExhaustiveImplementations§
Source§impl ButtonState
impl ButtonState
Source§impl ButtonState
impl ButtonState
Sourcepub fn pressed(&mut self, is_pressed: bool) -> ButtonOutcome
pub fn pressed(&mut self, is_pressed: bool) -> ButtonOutcome
Simulates the button-press event.
Trait Implementations§
Source§impl Clone for ButtonState
impl Clone for ButtonState
Source§impl Debug for ButtonState
impl Debug for ButtonState
Source§impl Default for ButtonState
impl Default for ButtonState
Source§impl HandleEvent<Event, KeyEvent, ButtonOutcome> for ButtonState
Check event-handling for this hot-key and do Regular key-events otherwise.
impl HandleEvent<Event, KeyEvent, ButtonOutcome> for ButtonState
Check event-handling for this hot-key and do Regular key-events otherwise.
Source§impl HandleEvent<Event, MouseOnly, ButtonOutcome> for ButtonState
impl HandleEvent<Event, MouseOnly, ButtonOutcome> for ButtonState
Source§impl HandleEvent<Event, Regular, ButtonOutcome> for ButtonState
impl HandleEvent<Event, Regular, ButtonOutcome> for ButtonState
Source§impl HasFocus for ButtonState
impl HasFocus for ButtonState
Source§fn build(&self, builder: &mut FocusBuilder)
fn build(&self, builder: &mut FocusBuilder)
Build the focus-structure for the container/widget.
Build the focus-structure for the container/widget.
This is called when the default navigation will be
overridden by the builder. Read more
Declares how the widget interacts with focus. Read more
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Focused?
Source§fn lost_focus(&self) -> bool
fn lost_focus(&self) -> bool
Just lost focus.
Source§fn gained_focus(&self) -> bool
fn gained_focus(&self) -> bool
Just gained focus.
Source§impl HasScreenCursor for ButtonState
impl HasScreenCursor for ButtonState
Source§impl RelocatableState for ButtonState
impl RelocatableState for ButtonState
Source§fn relocate(&mut self, shift: (i16, i16), clip: Rect)
fn relocate(&mut self, shift: (i16, i16), clip: Rect)
Relocate the areas in this widgets state. Read more
Source§fn relocate_popup(&mut self, shift: (i16, i16), clip: Rect)
fn relocate_popup(&mut self, shift: (i16, i16), clip: Rect)
Relocate only popup areas.
As rendering the popups is a separate render,
this has to be separate too.
Relocate all popup areas to a clip-rect (0,0+0x0).
Relocate all areas to a clip-rect (0,0+0x0).
Auto Trait Implementations§
impl !Freeze for ButtonState
impl !RefUnwindSafe for ButtonState
impl !Send for ButtonState
impl !Sync for ButtonState
impl Unpin for ButtonState
impl !UnwindSafe for ButtonState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more