pub struct SplitButton(/* private fields */);Expand description
A button with a menu of other actions beside its own, as the platform
makes one: an NSComboButton (split), WinUI’s SplitButton, an
adw::SplitButton; on Kirigami, which has none, a QQC2.Button with an
arrow button joined to it. Clicking the button does its action
(on_click); its arrow opens the menu, built as a MenuButton’s.
SplitButton::new("Continue").on_click(proceed).menu((
MenuItem::new("Commit to Edit").on_select(commit),
))Implementations§
Source§impl SplitButton
impl SplitButton
pub fn new(label: impl IntoValue<String>) -> SplitButton
Its menu: MenuItems, MenuSeparators and submenus (Menu).
Its menu, built by entries, and built again whenever what it reads
changes, as for MenuButton::menu_with.
Sourcepub fn vector_icon(self, icon: impl IntoValue<VectorIcon>) -> SplitButton
pub fn vector_icon(self, icon: impl IntoValue<VectorIcon>) -> SplitButton
An icon before its caption, as for Button::icon.
The app’s own icon before its caption, as for
Button::vector_icon.
pub fn icon(self, name: impl IntoValue<String>) -> SplitButton
Sourcepub fn icon_only(self, only: impl IntoValue<bool>) -> SplitButton
pub fn icon_only(self, only: impl IntoValue<bool>) -> SplitButton
Shows only its icon (and the arrow). The caption stays its accessible name.
How the button is drawn: see ButtonStyle. AppKit’s combo button
has one look, so it ignores this.
pub fn enabled(self, enabled: impl IntoValue<bool>) -> SplitButton
pub fn on_click(self, handler: impl Fn() + 'static) -> SplitButton
Sourcepub fn native(self, tweak: Tweak<SplitButton>) -> SplitButton
pub fn native(self, tweak: Tweak<SplitButton>) -> SplitButton
Raw platform settings, past the semantic ones: see Tweak.
Trait Implementations§
Source§impl ElementBuilder for SplitButton
impl ElementBuilder for SplitButton
fn element(&mut self) -> &mut Element
Source§fn style(self, f: impl FnOnce(&mut Style)) -> Self
fn style(self, f: impl FnOnce(&mut Style)) -> Self
Source§fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
f re-runs whenever the
signals it reads change, and must set every field it cares about.fn width(self, value: impl IntoValue<Length>) -> Self
fn height(self, value: impl IntoValue<Length>) -> Self
fn min_width(self, value: impl IntoValue<Length>) -> Self
fn min_height(self, value: impl IntoValue<Length>) -> Self
fn max_width(self, value: impl IntoValue<Length>) -> Self
fn max_height(self, value: impl IntoValue<Length>) -> Self
fn aspect_ratio(self, value: impl IntoValue<f32>) -> Self
fn padding(self, value: impl IntoValue<Length>) -> Self
fn padding_x(self, value: impl IntoValue<Length>) -> Self
fn padding_y(self, value: impl IntoValue<Length>) -> Self
fn padding_start(self, value: impl IntoValue<Length>) -> Self
fn padding_end(self, value: impl IntoValue<Length>) -> Self
fn padding_top(self, value: impl IntoValue<Length>) -> Self
fn padding_bottom(self, value: impl IntoValue<Length>) -> Self
fn margin(self, value: impl IntoValue<Length>) -> Self
fn margin_x(self, value: impl IntoValue<Length>) -> Self
fn margin_y(self, value: impl IntoValue<Length>) -> Self
fn margin_start(self, value: impl IntoValue<Length>) -> Self
fn margin_end(self, value: impl IntoValue<Length>) -> Self
fn margin_top(self, value: impl IntoValue<Length>) -> Self
fn margin_bottom(self, value: impl IntoValue<Length>) -> Self
fn grow(self, value: impl IntoValue<f32>) -> Self
fn shrink(self, value: impl IntoValue<f32>) -> Self
fn basis(self, value: impl IntoValue<Length>) -> Self
fn align_self(self, value: impl IntoValue<Align>) -> Self
Source§fn justify_self(self, value: impl IntoValue<Align>) -> Self
fn justify_self(self, value: impl IntoValue<Align>) -> Self
Source§fn top(self, value: impl IntoValue<Length>) -> Self
fn top(self, value: impl IntoValue<Length>) -> Self
absolute()).fn bottom(self, value: impl IntoValue<Length>) -> Self
Source§fn start(self, value: impl IntoValue<Length>) -> Self
fn start(self, value: impl IntoValue<Length>) -> Self
fn end(self, value: impl IntoValue<Length>) -> Self
fn grid_column(self, value: impl IntoValue<GridPlacement>) -> Self
fn grid_row(self, value: impl IntoValue<GridPlacement>) -> Self
fn direction(self, value: impl IntoValue<TextDirection>) -> Self
display the node had.fn size( self, width: impl IntoValue<Length>, height: impl IntoValue<Length>, ) -> Self
Source§fn tooltip(self, text: impl IntoValue<String>) -> Self
fn tooltip(self, text: impl IntoValue<String>) -> Self
entries, and built again whenever what it
reads changes, as Menu::children_with builds its entries.entries each time the platform opens it,
for a menu that depends on what’s selected or under the pointer at
that moment: a table row’s menu acting on the selection. What it
reads is read then, not followed.