pub struct ButtonView<State>where
State: 'static,{ /* private fields */ }Expand description
A declarative pressable button. See the module docs.
Implementations§
Source§impl<State> ButtonView<State>where
State: 'static,
impl<State> ButtonView<State>where
State: 'static,
Sourcepub fn style(self, style: ButtonStyle) -> ButtonView<State>
pub fn style(self, style: ButtonStyle) -> ButtonView<State>
Select the visual style (default ButtonStyle::Primary).
Sourcepub fn small(self) -> ButtonView<State>
pub fn small(self) -> ButtonView<State>
Use the reduced .small() padding scale.
Sourcepub fn loading(self, loading: bool) -> ButtonView<State>
pub fn loading(self, loading: bool) -> ButtonView<State>
Show a loading spinner in place of the label while loading is
true, suppressing on_press and reporting disabled semantics for as
long as it’s shown.
Sourcepub fn disabled(self, disabled: bool) -> ButtonView<State>
pub fn disabled(self, disabled: bool) -> ButtonView<State>
Disable the button while disabled is true, suppressing on_press,
blocking focus acquisition, and dimming the appearance (fill, border,
label) by multiplying their alpha by [DISABLED_ALPHA]. Precedence:
if both .disabled(true) and .loading(true), disabled takes effect
(both suppress interaction and report disabled semantics anyway).
Sourcepub fn label_alignment(self, alignment: Alignment) -> ButtonView<State>
pub fn label_alignment(self, alignment: Alignment) -> ButtonView<State>
Explicitly position the label within a stretched button, overriding
the stretch-aware default on both axes — see the module
docs’s “Label alignment” section. Ignored under
ButtonStyle::Icon, which is always centered.
Trait Implementations§
Source§impl<State> View<State> for ButtonView<State>where
State: 'static,
impl<State> View<State> for ButtonView<State>where
State: 'static,
Source§type Element = ButtonWidget
type Element = ButtonWidget
Source§fn build(&self, ctx: &mut BuildCtx<'_>) -> ButtonWidget
fn build(&self, ctx: &mut BuildCtx<'_>) -> ButtonWidget
Source§fn rebuild(
&self,
prev: &ButtonView<State>,
element: &mut ButtonWidget,
ctx: &mut BuildCtx<'_>,
) -> ChangeFlags
fn rebuild( &self, prev: &ButtonView<State>, element: &mut ButtonWidget, ctx: &mut BuildCtx<'_>, ) -> ChangeFlags
prev (the previous view of the same type) against the live
element, mutating it in place and reporting what changed.Auto Trait Implementations§
impl<State> !RefUnwindSafe for ButtonView<State>
impl<State> !Send for ButtonView<State>
impl<State> !Sync for ButtonView<State>
impl<State> !UnwindSafe for ButtonView<State>
impl<State> Freeze for ButtonView<State>
impl<State> Unpin for ButtonView<State>
impl<State> UnsafeUnpin for ButtonView<State>
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.