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 ==.impl StructuralPartialEq for ToolbarItemKind
Auto Trait Implementations§
impl Freeze for ToolbarItemKind
impl RefUnwindSafe for ToolbarItemKind
impl Send for ToolbarItemKind
impl Sync for ToolbarItemKind
impl Unpin for ToolbarItemKind
impl UnsafeUnpin for ToolbarItemKind
impl UnwindSafe for ToolbarItemKind
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,
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