pub struct KeyHints { /* private fields */ }Expand description
A bar of key hints such as tab next ctrl q quit, fed from the keymap and from hints
the application adds for the current screen.
Keys sit on a raised surface and labels are faint; nothing is bracketed. When the bar is
too narrow, hints are dropped from the end of the left group first; the right group stays.
Style keys: key-hints (bg, padding), key-hint-key, key-hint-label, and
key-hint-key.faint, key-hint-label.faint for a faint bar.
Implementations§
Source§impl KeyHints
impl KeyHints
Sourcepub fn hint(self, key: impl Into<String>, label: impl Into<String>) -> Self
pub fn hint(self, key: impl Into<String>, label: impl Into<String>) -> Self
Adds a hint on the left: key such as "↑↓" and its label.
Sourcepub fn action(self, scope: Scope, action: impl Into<String>) -> Self
pub fn action(self, scope: Scope, action: impl Into<String>) -> Self
Adds a keymap action on the left; its keys and translated label come from the keymap and the locale.
Sourcepub fn action_first(self, scope: Scope, action: impl Into<String>) -> Self
pub fn action_first(self, scope: Scope, action: impl Into<String>) -> Self
Sourcepub fn action_labelled(
self,
scope: Scope,
action: impl Into<String>,
label: impl Into<String>,
) -> Self
pub fn action_labelled( self, scope: Scope, action: impl Into<String>, label: impl Into<String>, ) -> Self
Adds a keymap action on the left with the application’s own label: the key comes from
the keymap, so it follows the person’s bindings, and the words from the application, for
a key whose meaning changes with the screen, such as enter saying “install” or “open”.
Like action, an action without a chord draws nothing.
Sourcepub fn action_right(self, scope: Scope, action: impl Into<String>) -> Self
pub fn action_right(self, scope: Scope, action: impl Into<String>) -> Self
Adds a keymap action on the right.
Sourcepub fn faint(self, faint: bool) -> Self
pub fn faint(self, faint: bool) -> Self
Draws the whole bar in the faint tone, keys and labels alike, for a screen that has gone
quiet, as Breadcrumb::faint does for a path.
Trait Implementations§
Source§impl<Msg: 'static> Widget<Msg> for KeyHints
impl<Msg: 'static> Widget<Msg> for KeyHints
Source§fn measure(&self, _cx: &mut MeasureCx<'_>, available: Size) -> Size
fn measure(&self, _cx: &mut MeasureCx<'_>, available: Size) -> Size
available.Source§fn paint_overlay(&self, _cx: &mut PaintCx<'_>, _anchor: Rect)
fn paint_overlay(&self, _cx: &mut PaintCx<'_>, _anchor: Rect)
PaintCx::request_overlay. anchor is the area the widget was painted in.Source§fn event(&self, _cx: &mut EventCx<'_, Msg>, _event: &Event) -> bool
fn event(&self, _cx: &mut EventCx<'_, Msg>, _event: &Event) -> bool
true when the event was used; unused key and scroll events
bubble to the parent widget.Source§fn children_mut(&mut self) -> &mut [Node<Msg>]
fn children_mut(&mut self) -> &mut [Node<Msg>]
Auto Trait Implementations§
impl Freeze for KeyHints
impl RefUnwindSafe for KeyHints
impl Send for KeyHints
impl Sync for KeyHints
impl Unpin for KeyHints
impl UnsafeUnpin for KeyHints
impl UnwindSafe for KeyHints
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<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> ⓘ
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> ⓘ
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