Skip to main content

ToolbarItem

Struct ToolbarItem 

Source
pub struct ToolbarItem {
    pub id: String,
    pub kind: ToolbarItemKind,
    pub label: String,
    pub tooltip: Option<String>,
    pub icon: Option<Icon>,
    pub enabled: bool,
    pub action: u64,
    pub placement: ToolbarPlacement,
    pub label_style: LabelStyle,
    pub prominent: bool,
    pub column: ToolbarColumn,
}
Expand description

One item in a window’s toolbar (docs/toolbars.md).

Fields§

§id: String

Stable identity: the native item identifier, the dayscript target, and the key a ToolbarPatch addresses. Unique within a toolbar.

§kind: ToolbarItemKind§label: String

The item’s name. Shown beside or below the icon where the platform does that, and used verbatim in the overflow and customization menus, so it is never optional, even on a toolbar that only shows icons. It is also the item’s accessible name.

§tooltip: Option<String>

Hover help. Defaults to label where the platform expects a tooltip and none is given.

§icon: Option<Icon>§enabled: bool§action: u64

The item’s command, as a dispatch id from the same registry Event::MenuAction uses (0 = no command), so a toolbar button and its menu twin can share one closure.

§placement: ToolbarPlacement

This item’s role on the chrome carrying it (docs/toolbars.md). It never names a surface: Which chrome an item rides is decided by where the app declared it, so this says only where on that chrome it belongs.

§label_style: LabelStyle

Whether the item draws its title, its 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; a menu row with no words is not a menu row.

§prominent: bool

Draw this item in the platform’s emphasized style (a tinted/filled bar button, a prominent NSToolbarItem). For the one action a chrome is really offering.

§column: ToolbarColumn

Which column of a multi-pane window this item came from (docs/toolbars.md), set by Day from the piece that declared it, never by an app.

A desktop toolbar spans every column at once, and a three-pane app expects each column’s commands to sit over that column: the sidebar’s against the first divider, the list’s over the list, the rest over the detail. That is what Mail, Notes and Finder do, and it is only expressible because the declaration site already said which pane the command belongs to. Backends that draw one undivided bar ignore it.

Trait Implementations§

Source§

impl Clone for ToolbarItem

Source§

fn clone(&self) -> ToolbarItem

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 Debug for ToolbarItem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ToolbarItem

Source§

fn eq(&self, other: &ToolbarItem) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ToolbarItem

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
§

impl<T> AnyEq for T
where T: Any + PartialEq,

§

fn equals(&self, other: &(dyn Any + 'static)) -> bool

§

fn as_any(&self) -> &(dyn Any + 'static)

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