pub struct SplitButton { /* private fields */ }Expand description
Two adjoining actions with independent focus, content, and appearance.
Implementations§
Source§impl SplitButton
impl SplitButton
Sourcepub fn new(
id: impl Into<ElementId>,
leading_name: impl Into<SharedString>,
trailing_name: impl Into<SharedString>,
menu: impl IntoIterator<Item = MenuItem>,
) -> SplitButton
pub fn new( id: impl Into<ElementId>, leading_name: impl Into<SharedString>, trailing_name: impl Into<SharedString>, menu: impl IntoIterator<Item = MenuItem>, ) -> SplitButton
Creates a split button with a primary leading_name, a trailing_name for the secondary
control, and default dropdown menu items.
Sourcepub fn accessible_label(self, label: impl Into<SharedString>) -> SplitButton
pub fn accessible_label(self, label: impl Into<SharedString>) -> SplitButton
Sets an accessible name for the outer split button group (Role::Group).
Sourcepub fn size(self, size: ControlSize) -> SplitButton
pub fn size(self, size: ControlSize) -> SplitButton
Sets the ControlSize shared by both segments.
Sourcepub fn variant(self, variant: ButtonVariant) -> SplitButton
pub fn variant(self, variant: ButtonVariant) -> SplitButton
Sets the ButtonVariant shared by both segments.
Sourcepub fn tone(self, tone: SemanticTone) -> SplitButton
pub fn tone(self, tone: SemanticTone) -> SplitButton
Applies a Material 3 semantic tone to both segments.
Sourcepub fn leading_tone(self, tone: SemanticTone) -> SplitButton
pub fn leading_tone(self, tone: SemanticTone) -> SplitButton
Applies a Material 3 semantic tone to the leading segment.
Sourcepub fn trailing_tone(self, tone: SemanticTone) -> SplitButton
pub fn trailing_tone(self, tone: SemanticTone) -> SplitButton
Applies a Material 3 semantic tone to the trailing segment.
Sourcepub fn spacing(self, spacing: Pixels) -> SplitButton
pub fn spacing(self, spacing: Pixels) -> SplitButton
Sets the space between segments. Invalid lengths use the default 2 dp.
Sourcepub fn disabled(self, disabled: bool) -> SplitButton
pub fn disabled(self, disabled: bool) -> SplitButton
Sets availability for the leading action.
Alias for Self::trailing_disabled when the trailing segment opens a menu.
Sourcepub fn trailing_disabled(self, disabled: bool) -> SplitButton
pub fn trailing_disabled(self, disabled: bool) -> SplitButton
Disables the trailing segment (menu trigger, command, or toggle) when true.
Sourcepub fn on_activate(
self,
callback: impl Fn(&mut Window, &mut App) + 'static,
) -> SplitButton
pub fn on_activate( self, callback: impl Fn(&mut Window, &mut App) + 'static, ) -> SplitButton
Registers a callback invoked when the leading primary segment is activated.
Sourcepub fn on_trailing_activate(
self,
callback: impl Fn(&mut Window, &mut App) + 'static,
) -> SplitButton
pub fn on_trailing_activate( self, callback: impl Fn(&mut Window, &mut App) + 'static, ) -> SplitButton
Replaces the trailing menu or toggle with a command.
Sourcepub fn trailing_toggle(
self,
selected: bool,
callback: impl Fn(bool, &mut Window, &mut App) + 'static,
) -> SplitButton
pub fn trailing_toggle( self, selected: bool, callback: impl Fn(bool, &mut Window, &mut App) + 'static, ) -> SplitButton
Replaces the trailing menu or command with a caller-controlled toggle.
Sourcepub fn leading_icon(self, icon: impl IntoElement) -> SplitButton
pub fn leading_icon(self, icon: impl IntoElement) -> SplitButton
Displays an icon before the leading segment’s label.
Sourcepub fn leading_icon_only(self, icon: impl IntoElement) -> SplitButton
pub fn leading_icon_only(self, icon: impl IntoElement) -> SplitButton
Renders the leading segment with an icon only, keeping leading_name as its accessible name.
Sourcepub fn leading_content(self, content: impl IntoElement) -> SplitButton
pub fn leading_content(self, content: impl IntoElement) -> SplitButton
Replaces the leading label’s presentation and retains its accessible name.
Sourcepub fn trailing_icon(self, icon: impl IntoElement) -> SplitButton
pub fn trailing_icon(self, icon: impl IntoElement) -> SplitButton
Replaces the default dropdown arrow icon on the trailing segment.
Sourcepub fn trailing_content(self, content: impl IntoElement) -> SplitButton
pub fn trailing_content(self, content: impl IntoElement) -> SplitButton
Replaces the trailing icon’s presentation and retains its accessible name.
Sourcepub fn leading_style(self, style: ButtonSegmentStyle) -> SplitButton
pub fn leading_style(self, style: ButtonSegmentStyle) -> SplitButton
Applies appearance overrides to the leading segment.
Sourcepub fn trailing_style(self, style: ButtonSegmentStyle) -> SplitButton
pub fn trailing_style(self, style: ButtonSegmentStyle) -> SplitButton
Applies appearance overrides to the trailing segment.
Sourcepub fn leading_interaction_source(
self,
source: &Entity<InteractionSource>,
) -> SplitButton
pub fn leading_interaction_source( self, source: &Entity<InteractionSource>, ) -> SplitButton
Connects an InteractionSource to observe interaction states on the leading segment.
Sourcepub fn trailing_interaction_source(
self,
source: &Entity<InteractionSource>,
) -> SplitButton
pub fn trailing_interaction_source( self, source: &Entity<InteractionSource>, ) -> SplitButton
Connects an InteractionSource to observe interaction states on the trailing segment.
Sourcepub fn track_focus(
self,
primary: &FocusHandle,
trailing: &FocusHandle,
) -> SplitButton
pub fn track_focus( self, primary: &FocusHandle, trailing: &FocusHandle, ) -> SplitButton
Supplies independent focus handles for the leading and trailing segments.
Trait Implementations§
Source§impl IntoElement for SplitButton
impl IntoElement for SplitButton
Source§type Element = ViewElement<SplitButton>
type Element = ViewElement<SplitButton>
Source§fn into_element(self) -> <SplitButton as IntoElement>::Element
fn into_element(self) -> <SplitButton as IntoElement>::Element
Element.Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement.Source§impl RenderOnce for SplitButton
impl RenderOnce for SplitButton
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl !RefUnwindSafe for SplitButton
impl !Send for SplitButton
impl !Sync for SplitButton
impl !UnwindSafe for SplitButton
impl Forget for SplitButton
impl Freeze for SplitButtonwhere
NonZero<u32>: Freeze,
&'static str: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const ArcInner<Path> is !null: Freeze,
PhantomData<ArcInner<Path>>: Freeze,
*const str is !null: Freeze,
PhantomData<&'static str>: Freeze,
*const ArcInner<ElementId> is !null: Freeze,
PhantomData<ArcInner<ElementId>>: Freeze,
*mut dyn ElementObject: Freeze,
*const RcInner<Cell<bool>> is !null: Freeze,
PhantomData<RcInner<Cell<bool>>>: Freeze,
*const (): Freeze,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Freeze,
PhantomData<fn(InteractionSource) -> InteractionSource>: Freeze,
*const u8 is !null: Freeze,
PhantomData<MenuItem>: Freeze,
*const RcInner<dyn Fn(&mut Window, &mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut Window, &mut App)>>: Freeze,
*const RcInner<dyn Fn(bool, &mut Window, &mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(bool, &mut Window, &mut App)>>: Freeze,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: Freeze,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: Freeze,
impl Move for SplitButton
impl Unpin for SplitButtonwhere
NonZero<u32>: Unpin,
&'static str: Unpin,
Arc<str>: Unpin,
Arc<Path>: Unpin,
*const str is !null: Unpin,
Arc<ElementId>: Unpin,
*mut dyn ElementObject: Unpin,
Rc<Cell<bool>>: Unpin,
*const (): Unpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: Unpin,
*const u8 is !null: Unpin,
Rc<dyn Fn(&mut Window, &mut App)>: Unpin,
Rc<dyn Fn() -> AnyElement>: Unpin,
Rc<dyn Fn(bool, &mut Window, &mut App)>: Unpin,
Arc<RwLock<RawRwLock, FocusMap>>: Unpin,
impl UnsafeUnpin for SplitButtonwhere
NonZeroU32Inner: UnsafeUnpin,
&'static str: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const ArcInner<Path> is !null: UnsafeUnpin,
PhantomData<ArcInner<Path>>: UnsafeUnpin,
*const str is !null: UnsafeUnpin,
PhantomData<&'static str>: UnsafeUnpin,
*const ArcInner<ElementId> is !null: UnsafeUnpin,
PhantomData<ArcInner<ElementId>>: UnsafeUnpin,
*mut dyn ElementObject: UnsafeUnpin,
*const RcInner<Cell<bool>> is !null: UnsafeUnpin,
PhantomData<RcInner<Cell<bool>>>: UnsafeUnpin,
*const (): UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, EntityRefCounts>> is !null: UnsafeUnpin,
PhantomData<fn(InteractionSource) -> InteractionSource>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<MenuItem>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut Window, &mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut Window, &mut App)>>: UnsafeUnpin,
*const RcInner<dyn Fn(bool, &mut Window, &mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(bool, &mut Window, &mut App)>>: UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
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,
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,
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,
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 moreSource§impl<T> MaterialElementExt for Twhere
T: IntoElement,
impl<T> MaterialElementExt for Twhere
T: IntoElement,
Source§fn badge_label(self, text: impl Into<SharedString>) -> Badge
fn badge_label(self, text: impl Into<SharedString>) -> Badge
Badge to this element’s upper trailing edge.Source§fn badge_count(self, count: usize, maximum: usize) -> Badge
fn badge_count(self, count: usize, maximum: usize) -> Badge
Badge to this element’s upper trailing edge.Source§fn tooltip(
self,
id: impl Into<ElementId>,
text: impl Into<SharedString>,
) -> Tooltip
fn tooltip( self, id: impl Into<ElementId>, text: impl Into<SharedString>, ) -> Tooltip
Tooltip.Menu.Menu
whose items are built lazily only while the menu is open.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> ObservedText<Self::Element>
fn test_text(self, text: impl Into<SharedString>) -> ObservedText<Self::Element>
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(
self,
text: impl Into<SharedString>,
) -> ObservedText<Self::Element>
fn test_alt_text( self, text: impl Into<SharedString>, ) -> ObservedText<Self::Element>
Self::test_text for an image’s alternative text, which
stands in for what the element draws.