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: StringStable identity: the native item identifier, the dayscript target, and the key a
ToolbarPatch addresses. Unique within a toolbar.
kind: ToolbarItemKind§label: StringThe 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: u64The 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: ToolbarPlacementThis 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: LabelStyleWhether 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: boolDraw 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: ToolbarColumnWhich 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
impl Clone for ToolbarItem
Source§fn clone(&self) -> ToolbarItem
fn clone(&self) -> ToolbarItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToolbarItem
impl Debug for ToolbarItem
Source§impl PartialEq for ToolbarItem
impl PartialEq for ToolbarItem
impl StructuralPartialEq for ToolbarItem
Auto Trait Implementations§
impl Freeze for ToolbarItem
impl RefUnwindSafe for ToolbarItem
impl Send for ToolbarItem
impl Sync for ToolbarItem
impl Unpin for ToolbarItem
impl UnsafeUnpin for ToolbarItem
impl UnwindSafe for ToolbarItem
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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