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, a search field with
toolbar_search, and the gaps with toolbar_space / toolbar_flexible_space.
Implementations§
Source§impl ToolbarEntry
impl ToolbarEntry
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 own 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 placeholder<M>(self, t: impl IntoText<M>) -> ToolbarEntry
pub fn placeholder<M>(self, t: impl IntoText<M>) -> ToolbarEntry
The empty-state prompt of a search item (ignored on other kinds).
Sourcepub fn enabled(self, on: bool) -> ToolbarEntry
pub fn enabled(self, on: bool) -> ToolbarEntry
Enable or disable the item once, at build.
Sourcepub fn enabled_when(self, f: impl Fn() -> bool + 'static) -> ToolbarEntry
pub fn enabled_when(self, f: impl Fn() -> bool + 'static) -> ToolbarEntry
Enable the item while f reads true, re-evaluated whenever its reactive reads change.
This is the live path: it patches the one item rather than rebuilding the bar, so a
command greying out never disturbs a search field mid-word.
Auto Trait Implementations§
impl Freeze for ToolbarEntry
impl !RefUnwindSafe for ToolbarEntry
impl !Send for ToolbarEntry
impl !Sync for ToolbarEntry
impl Unpin for ToolbarEntry
impl UnsafeUnpin for ToolbarEntry
impl !UnwindSafe 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> 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