pub struct SplitButton { /* private fields */ }Expand description
One action, plus the ones it stands in for.
The default action and the arrow are separate targets with separate ids,
because they do separate things: clicking the button acts, clicking the
arrow only offers. Refusing the whole control refuses both. Refusing only
the default action — SplitButton::default_disabled — leaves the arrow
working, because the alternatives may well be exactly what a typist needs
when the usual thing cannot be done.
Implementations§
Source§impl SplitButton
impl SplitButton
pub fn new( ident: impl Into<Ident>, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Self
pub fn label(self, label: impl Into<SharedString>) -> Self
pub fn icon(self, glyph: Icon) -> Self
pub fn variant(self, variant: ButtonVariant) -> Self
pub fn primary(self) -> Self
pub fn secondary(self) -> Self
Sourcepub fn items(
self,
items: impl IntoIterator<Item = MenuItem>,
cx: &mut Context<'_, Self>,
) -> Self
pub fn items( self, items: impl IntoIterator<Item = MenuItem>, cx: &mut Context<'_, Self>, ) -> Self
The alternatives. They are reported by the menu, as
crate::overlay::MenuEvent::Invoked.
What the arrow is named for a reader that cannot see it.
Sourcepub fn default_disabled(self, disabled: bool) -> Self
pub fn default_disabled(self, disabled: bool) -> Self
Refuses the default action while leaving the alternatives reachable.
pub fn on_click(self, handler: impl Fn(&mut Window, &mut App) + 'static) -> Self
pub fn is_open(&self, cx: &App) -> bool
pub fn set_disabled( &mut self, disabled: bool, window: &mut Window, cx: &mut Context<'_, Self>, )
Trait Implementations§
Source§impl Debug for SplitButton
impl Debug for SplitButton
Source§impl Disableable for SplitButton
impl Disableable for SplitButton
Source§impl Focusable for SplitButton
impl Focusable for SplitButton
Source§fn focus_handle(&self, _cx: &App) -> FocusHandle
fn focus_handle(&self, _cx: &App) -> FocusHandle
Returns the focus handle associated with this view.
Source§impl Render for SplitButton
impl Render for SplitButton
Auto Trait Implementations§
impl !RefUnwindSafe for SplitButton
impl !Send for SplitButton
impl !Sync for SplitButton
impl !UnwindSafe for SplitButton
impl Freeze for SplitButton
impl Unpin for SplitButton
impl UnsafeUnpin for SplitButton
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> 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