pub struct ToolbarItem { /* private fields */ }Expand description
One slot in a Toolbar.
Implementations§
Source§impl ToolbarItem
impl ToolbarItem
Sourcepub fn action(action: ToolbarAction) -> Self
pub fn action(action: ToolbarAction) -> Self
A collapsible command.
Sourcepub fn custom(widget: impl Widget + 'static) -> Self
pub fn custom(widget: impl Widget + 'static) -> Self
A pinned arbitrary widget (never collapses) — e.g. a search field. Make
it collapsible with overflow_as.
Sourcepub fn collapsible(widget: impl Widget + ToolbarOverflow + 'static) -> Self
pub fn collapsible(widget: impl Widget + ToolbarOverflow + 'static) -> Self
A collapsible widget that supplies its own menu form via
ToolbarOverflow. When the bar is too narrow, the widget is hidden
and its toolbar_menu_form() appears in the overflow menu.
Sourcepub fn overflow_as(self, menu_form: ToolbarAction) -> Self
pub fn overflow_as(self, menu_form: ToolbarAction) -> Self
Make a custom widget collapsible with an explicit menu
row — the ToolbarAction shown when it overflows (NSToolbar
menuFormRepresentation). Best for controls whose menu form is a
single command; an icon-only inline control reuses its icon here as the
menu item’s leading glyph (pass it to ToolbarAction::new).
Sourcepub fn overflow_widget(
self,
factory: impl Fn() -> Box<dyn Widget> + 'static,
) -> Self
pub fn overflow_widget( self, factory: impl Fn() -> Box<dyn Widget> + 'static, ) -> Self
Make a custom widget collapsible by embedding a live
widget in the overflow menu — the factory rebuilds the control (e.g.
a ComboBox bound to the same signal) so it stays fully interactive
while collapsed, instead of degrading to a one-shot menu row. Best for
stateful inputs (combo boxes, sliders) that have no meaningful single
“command” representation.
Sourcepub fn flexible_space() -> Self
pub fn flexible_space() -> Self
Flexible space that pushes the following items to the trailing edge
(NSToolbar flexibleSpace). Collapses to nothing when over-constrained.
Auto Trait Implementations§
impl !RefUnwindSafe for ToolbarItem
impl !Send for ToolbarItem
impl !Sync for ToolbarItem
impl !UnwindSafe for ToolbarItem
impl Freeze for ToolbarItem
impl Unpin for ToolbarItem
impl UnsafeUnpin for ToolbarItem
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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