Skip to main content

ToolbarEntry

Struct ToolbarEntry 

Source
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

Source

pub fn id(self, id: ElementId) -> Self

Override a presentation id (for example, preserve an existing dayscript toolbar id).

Source

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.

Source

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.

Source

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.

Source

pub fn tooltip<M>(self, t: impl IntoText<M>) -> ToolbarEntry

Hover help. Defaults to the item’s label.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> ToolbarEntry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ToolbarContent<OneMark> for ToolbarEntry

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoReactive<T, StaticMark> for T
where T: Clone + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Day API ↩ Guides· daybrite.dev