pub struct SidebarMenuItem { /* private fields */ }Expand description
Menu item for the SidebarMenu
Implementations§
Source§impl SidebarMenuItem
impl SidebarMenuItem
Sourcepub fn new(label: impl Into<SharedString>) -> Self
pub fn new(label: impl Into<SharedString>) -> Self
Create a new SidebarMenuItem with a label.
Sourcepub fn on_click(
self,
handler: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_click( self, handler: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, ) -> Self
Add a click handler to the menu item
Sourcepub fn default_open(self, open: bool) -> Self
pub fn default_open(self, open: bool) -> Self
Set the default open state of the Submenu, default is false.
This only used on initial render, the internal state will be used afterwards.
Sourcepub fn click_to_open(self, click_to_open: bool) -> Self
pub fn click_to_open(self, click_to_open: bool) -> Self
Set whether clicking the menu item open the submenu.
Default is false.
If false we only handle open/close via the caret button.
Sourcepub fn click_to_toggle(self, click_to_toggle: bool) -> Self
pub fn click_to_toggle(self, click_to_toggle: bool) -> Self
Set whether clicking the menu item toggles the submenu.
If click_to_open is true, this has no effect.
Default is false.
pub fn children( self, children: impl IntoIterator<Item = impl Into<Self>>, ) -> Self
Set the context menu for the menu item.
Trait Implementations§
Source§impl Clone for SidebarMenuItem
impl Clone for SidebarMenuItem
Source§fn clone(&self) -> SidebarMenuItem
fn clone(&self) -> SidebarMenuItem
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Collapsible for SidebarMenuItem
impl Collapsible for SidebarMenuItem
Source§impl FluentBuilder for SidebarMenuItem
impl FluentBuilder for SidebarMenuItem
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Imperatively modify self with the given closure.
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
Conditionally modify self with the given closure.
Source§impl SidebarItem for SidebarMenuItem
impl SidebarItem for SidebarMenuItem
Auto Trait Implementations§
impl !RefUnwindSafe for SidebarMenuItem
impl !Send for SidebarMenuItem
impl !Sync for SidebarMenuItem
impl !UnwindSafe for SidebarMenuItem
impl Freeze for SidebarMenuItem
impl Unpin for SidebarMenuItem
impl UnsafeUnpin for SidebarMenuItem
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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