Struct ButtonFace
pub struct ButtonFace<'a> { /* private fields */ }Expand description
An immediate-mode button: the Button look for a canvas host that owns
its own hit-testing. Built fluently:
ButtonFace::new(rect, "Save").role(ButtonRole::Primary).hovered(hit).
Size the rect from the face itself, so rect and glyphs agree at every
scale: ButtonFace::height for the height,
ButtonFace::intrinsic_width for the width, and hit-test with
ButtonFace::hit_rect (never smaller than the minimum pointer target).
Implementations§
§impl<'a> ButtonFace<'a>
impl<'a> ButtonFace<'a>
pub fn new(rect: Rect, label: &'a str) -> ButtonFace<'a>
pub fn icon_only(rect: Rect, icon: Icon, name: &'a str) -> ButtonFace<'a>
pub fn icon_only(rect: Rect, icon: Icon, name: &'a str) -> ButtonFace<'a>
An icon-only face; name is its accessible name.
pub fn role(self, role: ButtonRole) -> ButtonFace<'a>
pub fn role(self, role: ButtonRole) -> ButtonFace<'a>
What the button does; the role decides its whole look.
pub fn icon(self, icon: Icon) -> ButtonFace<'a>
pub fn control_size(self, size: ControlSize) -> ButtonFace<'a>
pub fn control_size(self, size: ControlSize) -> ButtonFace<'a>
The face’s height and label role.
pub fn shortcut_hint(self, shortcut: Shortcut) -> ButtonFace<'a>
pub fn shortcut_hint(self, shortcut: Shortcut) -> ButtonFace<'a>
A trailing keyboard shortcut in the platform’s keycap legends.
pub fn toggled(self, on: bool) -> ButtonFace<'a>
pub fn toggled(self, on: bool) -> ButtonFace<'a>
A toggle that is on: the face stands on the selection lift.
pub fn hovered(self, v: bool) -> ButtonFace<'a>
pub fn pressed(self, v: bool) -> ButtonFace<'a>
pub fn focused(self, v: bool) -> ButtonFace<'a>
pub fn disabled(self, v: bool) -> ButtonFace<'a>
pub fn accessible_name(self, name: &'a str) -> ButtonFace<'a>
pub fn accessible_name(self, name: &'a str) -> ButtonFace<'a>
For callers that expose their own accessibility node for the region.
pub fn spoken_name(&self) -> &str
pub fn spoken_name(&self) -> &str
The visible label, or the explicit accessible_name when it’s empty.
pub fn colors(
&self,
theme: &Theme,
) -> (AlphaColor<Srgb>, Option<AlphaColor<Srgb>>, AlphaColor<Srgb>)
pub fn colors( &self, theme: &Theme, ) -> (AlphaColor<Srgb>, Option<AlphaColor<Srgb>>, AlphaColor<Srgb>)
The resolved palette without painting: (fill, edge, ink).
pub fn height(size: ControlSize, theme: &Theme) -> f64
pub fn height(size: ControlSize, theme: &Theme) -> f64
The height of a face of size in theme.
pub fn intrinsic_width(&self, text: &mut TextRenderer, theme: &Theme) -> f64
pub fn intrinsic_width(&self, text: &mut TextRenderer, theme: &Theme) -> f64
The narrowest rect width that shows this face’s icon, label and shortcut without eliding.
Auto Trait Implementations§
impl<'a> Freeze for ButtonFace<'a>
impl<'a> RefUnwindSafe for ButtonFace<'a>
impl<'a> Send for ButtonFace<'a>
impl<'a> Sync for ButtonFace<'a>
impl<'a> Unpin for ButtonFace<'a>
impl<'a> UnsafeUnpin for ButtonFace<'a>
impl<'a> UnwindSafe for ButtonFace<'a>
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> DowncastSync for T
impl<T> DowncastSync for T
§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