pub struct MenuItem { /* private fields */ }Expand description
An item in a Material menu. Callers retain command and selection state.
Implementations§
Source§impl MenuItem
impl MenuItem
pub fn new(id: impl Into<ElementId>, label: impl Into<SharedString>) -> Self
pub fn group(id: impl Into<ElementId>, title: impl Into<SharedString>) -> Self
Sourcepub fn section(
id: impl Into<ElementId>,
name: impl Into<SharedString>,
rows: impl IntoIterator<Item = MenuItem>,
) -> Self
pub fn section( id: impl Into<ElementId>, name: impl Into<SharedString>, rows: impl IntoIterator<Item = MenuItem>, ) -> Self
Creates a surfaced group with rows in the owning menu’s navigation order.
Sourcepub fn group_appearance(self, appearance: MenuSurfaceStyle) -> Self
pub fn group_appearance(self, appearance: MenuSurfaceStyle) -> Self
Sets the styled section’s surface appearance.
Sourcepub fn inactive_shape(self, shape: CornerShape) -> Self
pub fn inactive_shape(self, shape: CornerShape) -> Self
Sets the section shape used after the pointer leaves the section.
Sourcepub fn appearance(self, style: MenuItemStyle) -> Self
pub fn appearance(self, style: MenuItemStyle) -> Self
Configures the appearance of an action, checked or selected row.
pub fn disabled(self, disabled: bool) -> Self
pub fn checked(self, checked: bool) -> Self
pub fn selected(self, selected: bool) -> Self
Sourcepub fn content<E: IntoElement>(self, build: impl Fn() -> E + 'static) -> Self
pub fn content<E: IntoElement>(self, build: impl Fn() -> E + 'static) -> Self
Replaces the visible label while retaining the name passed to new.
Supply a repeatable factory so the content also appears during exit.
Sourcepub fn leading<E: IntoElement>(self, build: impl Fn() -> E + 'static) -> Self
pub fn leading<E: IntoElement>(self, build: impl Fn() -> E + 'static) -> Self
Supplies a decorative element at the logical start of an unmarked row.
Sourcepub fn supporting<E: IntoElement>(self, build: impl Fn() -> E + 'static) -> Self
pub fn supporting<E: IntoElement>(self, build: impl Fn() -> E + 'static) -> Self
Supplies additional visual content below the label.
Sourcepub fn trailing<E: IntoElement>(self, build: impl Fn() -> E + 'static) -> Self
pub fn trailing<E: IntoElement>(self, build: impl Fn() -> E + 'static) -> Self
Supplies decorative content at the logical end of the row.
Sourcepub fn selection_icon<E: IntoElement>(
self,
build: impl Fn() -> E + 'static,
) -> Self
pub fn selection_icon<E: IntoElement>( self, build: impl Fn() -> E + 'static, ) -> Self
Replaces the leading check mark of a checked or selected row.
Sourcepub fn on_checked_change(
self,
callback: impl Fn(bool, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_checked_change( self, callback: impl Fn(bool, &mut Window, &mut App) + 'static, ) -> Self
Requests the inverse of the supplied checked value on activation.
The checked callback takes precedence over on_activate on checked rows.
pub fn on_activate( self, action: impl Fn(&mut Window, &mut App) + 'static, ) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for MenuItem
impl !Send for MenuItem
impl !Sync for MenuItem
impl !UnwindSafe for MenuItem
impl Forget for MenuItem
impl Freeze for MenuItem
impl Move for MenuItem
impl Unpin for MenuItem
impl UnsafeUnpin for MenuItem
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> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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