Struct ButtonProps
pub struct ButtonProps {Show 17 fields
pub label: String,
pub accessible_name: Option<String>,
pub icon: Option<Icon>,
pub icon_only: bool,
pub faces: Vec<String>,
pub role: Option<ButtonRole>,
pub toggled: Option<bool>,
pub size: ControlSize,
pub enabled: bool,
pub description: Option<String>,
pub key: Option<String>,
pub count: Option<i64>,
pub dot: bool,
pub alert: bool,
pub in_menu: bool,
pub group: Option<String>,
pub press: Event,
}Expand description
A button: pressing it does one thing. Its role says what kind of thing, which decides its whole look: the window’s one primary action, a destructive one, or an ordinary one.
Fields§
§label: StringWhat pressing it does, in a word or two. An icon-only button is still named by it.
accessible_name: Option<String>How assistive technology names it, where that says more than the label shows: the charge reads “61%” beside its charging glyph and is named “61%, charging”. Unset, the label names it.
icon: Option<Icon>A glyph before the label, or instead of it when icon_only.
icon_only: boolShow only the icon, the label naming the button to assistive technology.
faces: Vec<String>Who is here, as their faces: up to three faces, then a face counting the rest, and
nothing else on the button at any width. icon_only’s rule holds for it too: the
label is the name assistive technology hears, naming the people (“Mia Clayton and Sam
Okafor are here”). One press opens the roster of everyone here.
role: Option<ButtonRole>What kind of action it is: secondary unless said, plain for an icon-only one.
toggled: Option<bool>A toggle button, and whether it is on: on, it stands on a lift of its ground and is announced as pressed.
size: ControlSizeHow prominent it is: regular unless said.
enabled: boolWhether it can be pressed now. A button with nothing to do never can.
description: Option<String>Why it cannot be pressed now, where the label does not say: the requirement an action does not meet. Its tooltip, and the description assistive technology reads beside the name it announces.
key: Option<String>The plain key that presses it while its window has the keyboard (and, on a row’s action,
while that row is selected), as the app declared it (key: "e"): the host answers it
beside the pressed control’s own event. Never drawn here; the header shows it at the
action’s menu row.
count: Option<i64>How many new things wait behind it (unread notifications, new mail), on an icon-only button: a count standing on its icon’s top-trailing corner, as an app icon’s does, and nothing at 0. The button keeps room for it, so it never covers the control beside it. The label says the count to assistive technology.
dot: boolSomething new behind it without a number: a dot on its icon’s corner.
alert: boolIt needs the person: the count or the dot in the warning tone, not in your colour.
It belongs in its header’s menu rather than in the row
(crate::widget::Button::in_menu).
group: Option<String>The run of its owner’s actions it stands in (group: "Due"), as the app names it: the
header’s menu shows rows of one run together, under the run’s own row.
press: EventIt was pressed (a click, Enter or Space, an assistive technology).
Trait Implementations§
§impl Component for ButtonProps
impl Component for ButtonProps
fn describe() -> Description
§fn from_source(source: &mut dyn Source) -> Result<ButtonProps, Error>
fn from_source(source: &mut dyn Source) -> Result<ButtonProps, Error>
source gives. Read more§impl Default for ButtonProps
impl Default for ButtonProps
§fn default() -> ButtonProps
fn default() -> ButtonProps
Auto Trait Implementations§
impl Freeze for ButtonProps
impl !RefUnwindSafe for ButtonProps
impl !Send for ButtonProps
impl !Sync for ButtonProps
impl Unpin for ButtonProps
impl UnsafeUnpin for ButtonProps
impl !UnwindSafe for ButtonProps
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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