pub enum ToolbarItemKind {
Button,
Toggle {
on: bool,
},
Menu {
items: Vec<MenuItem>,
},
Search {
text: String,
placeholder: String,
},
Label,
Separator,
Space,
FlexibleSpace,
}Expand description
What a toolbar item IS. The variants are the vocabulary every desktop toolbar shares; each backend realizes one with its native control, never with a drawn imitation.
Variants§
Button
A push button running the item’s action.
Toggle
A two-state button. on seeds it; the user flipping it emits
ToolbarValue::On, and the app’s own writes arrive as ToolbarPatch::On.
Menu
A button that drops a menu — the same MenuItem model the menu bar uses, so a
toolbar menu and its menu-bar twin are one list of commands.
Search
A search field. Edits emit ToolbarValue::Text; the app’s own writes arrive as
ToolbarPatch::Text.
Label
Static text, for a status or a caption.
Separator
A divider, where the platform draws one (macOS toolbars have no separator, so AppKit renders it as a fixed space — docs/toolbars.md).
Space
A fixed gap.
FlexibleSpace
A gap that absorbs the leftover width. This is how the model expresses each platform’s
packing: items before the first flexible space are leading, items after it trailing —
GTK packs them start/end, XAML splits them across Content/PrimaryCommands, and
AppKit and Qt place a real expanding spacer.
Trait Implementations§
Source§impl Clone for ToolbarItemKind
impl Clone for ToolbarItemKind
Source§fn clone(&self) -> ToolbarItemKind
fn clone(&self) -> ToolbarItemKind
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 ToolbarItemKind
impl Debug for ToolbarItemKind
Source§impl PartialEq for ToolbarItemKind
impl PartialEq for ToolbarItemKind
Source§fn eq(&self, other: &ToolbarItemKind) -> bool
fn eq(&self, other: &ToolbarItemKind) -> bool
self and other values to be equal, and is used by ==.