pub struct StatusBar<M = ()> { /* private fields */ }Expand description
A status line (#481): StatusItems on the left and on the right,
separated by │. It takes no focus and uses no events but ticks, so it
sits under anything in a container, or under any component with
Overlays::status_bar, which
also feeds its hints the component’s keymap. Change it while it shows
through its handle.
Implementations§
Source§impl<M> StatusBar<M>
impl<M> StatusBar<M>
pub fn new() -> StatusBar<M>
Sourcepub fn left(self, id: &str, item: StatusItem) -> Self
pub fn left(self, id: &str, item: StatusItem) -> Self
Add item as id on the left.
Sourcepub fn right(self, id: &str, item: StatusItem) -> Self
pub fn right(self, id: &str, item: StatusItem) -> Self
Add item as id on the right.
Sourcepub fn keymap(self, keymap: Keymap) -> Self
pub fn keymap(self, keymap: Keymap) -> Self
The keymap hints read (see StatusHandle::set_keymap).
Sourcepub fn style(self, style: Style) -> Self
pub fn style(self, style: Style) -> Self
The style of the whole line, padded to the width (default: none;
on grey23 for a bar with a background).
Sourcepub fn separator(self, separator: impl Into<String>) -> Self
pub fn separator(self, separator: impl Into<String>) -> Self
What goes between items (default │).
pub fn theme(self, theme: Theme) -> Self
Sourcepub fn clock(self, clock: impl Fn() -> Duration + 'static) -> Self
pub fn clock(self, clock: impl Fn() -> Duration + 'static) -> Self
Where spinners read the time from (default: the time since the bar was made): a fixed clock makes a test’s frames exact.
Sourcepub fn animate(self, on: bool) -> Self
pub fn animate(self, on: bool) -> Self
Whether spinners turn (default: unless RICH_ANIMATION=0, or
RICH_A11Y asks for reduced motion, no animation or a screen
reader, as for every other animation). Off, a spinner shows its
first frame and the bar never ticks.
Sourcepub fn handle(&self) -> StatusHandle
pub fn handle(&self) -> StatusHandle
A handle that changes this bar’s items while it shows.
Trait Implementations§
Source§impl<M> Component for StatusBar<M>
impl<M> Component for StatusBar<M>
type Output = M
Source§fn handle(&mut self, event: &Event, _: &Context<'_>) -> Flow<M>
fn handle(&mut self, event: &Event, _: &Context<'_>) -> Flow<M>
Outcome::Interrupted.Source§fn tick(&self) -> Option<Duration>
fn tick(&self) -> Option<Duration>
Event::Tick, for a spinner or a
countdown. None (the default): never.Source§fn focusable(&self) -> bool
fn focusable(&self) -> bool
Source§fn start(&mut self, context: &Context<'_>) -> Flow<Self::Output>
fn start(&mut self, context: &Context<'_>) -> Flow<Self::Output>
Done or Cancel finishes the component
without waiting for an event. The default does nothing.Source§fn mouse(&self) -> bool
fn mouse(&self) -> bool
run then enables mouse reporting
for the session.Source§fn keymap(&self) -> Keymap
fn keymap(&self) -> Keymap
keymap). A container’s include its focused
child’s, before its own. The default declares none.Source§fn focus_step(&mut self, forward: bool) -> bool
fn focus_step(&mut self, forward: bool) -> bool
forward) or previous focus stop inside
this component, for Tab and Shift+Tab. false when there is none
after the current one, so the container moves on to its next
child. The default, for a component that is one stop: false.Source§fn focus_enter(&mut self, forward: bool) -> bool
fn focus_enter(&mut self, forward: bool) -> bool
forward,
at the last otherwise. false when nothing in it can take focus.
The default: whether the component is focusable.Source§fn default_value(&self) -> Option<Self::Output>
fn default_value(&self) -> Option<Self::Output>
None: there is none.Auto Trait Implementations§
impl<M = ()> !RefUnwindSafe for StatusBar<M>
impl<M = ()> !Send for StatusBar<M>
impl<M = ()> !Sync for StatusBar<M>
impl<M = ()> !UnwindSafe for StatusBar<M>
impl<M> Freeze for StatusBar<M>
impl<M> Unpin for StatusBar<M>
impl<M> UnsafeUnpin for StatusBar<M>
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
Source§impl<C> ComponentExt for Cwhere
C: Component,
impl<C> ComponentExt for Cwhere
C: Component,
Source§fn map<'a, M>(
self,
done: impl FnMut(Self::Output) -> Flow<M> + 'a,
) -> Map<'a, Self, M>where
Self: 'a,
fn map<'a, M>(
self,
done: impl FnMut(Self::Output) -> Flow<M> + 'a,
) -> Map<'a, Self, M>where
Self: 'a,
M’s flow: Flow::Done(m) to
finish the whole composition with m, Flow::Continue to carry on
(the component stays, showing its answer, and focus moves past it).
Cancelling cancels the composition unless
on_cancel says otherwise.