pub struct ToolbarEntry { /* private fields */ }Expand description
A toolbar item under construction. Build a command with toolbar_button, a two-state
button with toolbar_toggle, a pull-down with toolbar_menu, one control over a set of
choices with toolbar_segmented, static text with toolbar_label, and a divider with
toolbar_separator. Search is declared on the navigation surface instead
(Nav::searchable, docs/search.md).
Implementations§
Source§impl ToolbarEntry
impl ToolbarEntry
Sourcepub fn id(self, id: ElementId) -> Self
pub fn id(self, id: ElementId) -> Self
Override a presentation id (for example, preserve an existing dayscript toolbar id).
Sourcepub fn action(self, f: impl Fn() + 'static) -> ToolbarEntry
pub fn action(self, f: impl Fn() + 'static) -> ToolbarEntry
Run f when the item is chosen. On a toggle or a search field the value binding carries
the change; an action here runs in addition to it.
Sourcepub fn icon(self, symbol: Symbol) -> ToolbarEntry
pub fn icon(self, symbol: Symbol) -> ToolbarEntry
Draw a standard Symbol, using the platform’s icon set: an SF Symbol on macOS, a
freedesktop icon name on GTK and Qt, a Fluent glyph on Windows.
Sourcepub fn image(self, name: impl Into<ImageName>) -> ToolbarEntry
pub fn image(self, name: impl Into<ImageName>) -> ToolbarEntry
Draw a bundled image from resource/images, for an icon only this app has. Prefer
ToolbarEntry::icon for anything standard: one PNG cannot look native on four desktops.
Sourcepub fn tooltip<M>(self, t: impl IntoText<M>) -> ToolbarEntry
pub fn tooltip<M>(self, t: impl IntoText<M>) -> ToolbarEntry
Hover help. Defaults to the item’s label.
Sourcepub fn enabled<M>(self, on: impl IntoReactive<bool, M>) -> ToolbarEntry
pub fn enabled<M>(self, on: impl IntoReactive<bool, M>) -> ToolbarEntry
Whether the item can be used (default true): a constant, a Signal<bool>, or a
closure re-evaluated whenever its reactive reads change. A reactive value patches the
one item rather than rebuilding the bar, so a command greying out never disturbs a
search field mid-word.
Sourcepub fn placement(self, placement: ToolbarPlacement) -> ToolbarEntry
pub fn placement(self, placement: ToolbarPlacement) -> ToolbarEntry
This item’s role on the chrome carrying it (docs/toolbars.md): leading, centered, trailing, or first to fold away. It never names a surface: which chrome an item rides follows from the piece that declared it.
Sourcepub fn label_style(self, style: LabelStyle) -> ToolbarEntry
pub fn label_style(self, style: LabelStyle) -> ToolbarEntry
Draw the title, the icon, or both, where the platform can do more than one. An item folded into an overflow menu shows its title whatever this asks for.
Sourcepub fn prominent(self) -> ToolbarEntry
pub fn prominent(self) -> ToolbarEntry
Draw this item in the platform’s emphasized style, for the one action a chrome is really offering.
Trait Implementations§
Source§impl Clone for ToolbarEntry
impl Clone for ToolbarEntry
Source§fn clone(&self) -> ToolbarEntry
fn clone(&self) -> ToolbarEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ToolbarContent<OneMark> for ToolbarEntry
impl ToolbarContent<OneMark> for ToolbarEntry
fn into_source(self) -> ToolbarSource
Auto Trait Implementations§
impl !RefUnwindSafe for ToolbarEntry
impl !Send for ToolbarEntry
impl !Sync for ToolbarEntry
impl !UnwindSafe for ToolbarEntry
impl Freeze for ToolbarEntry
impl Unpin for ToolbarEntry
impl UnsafeUnpin for ToolbarEntry
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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