[][src]Struct druid::widget::Button

pub struct Button<T: Data + 'static + Default> {
    id: WidgetId,
    label: Label<T>,
    action: fn(_: &mut EventCtx<T>, _: &mut T, _: &Env),
}

A button with a text label.

Fields

id: WidgetIdlabel: Label<T>action: fn(_: &mut EventCtx<T>, _: &mut T, _: &Env)

Methods

impl<T: Data + 'static + Default> Button<T>[src]

pub fn new(
    text: impl Into<LabelText<T>>,
    action: fn(_: &mut EventCtx<T>, _: &mut T, _: &Env)
) -> Button<T>
[src]

Create a new button. The closure provided will be called when the button is clicked.

Trait Implementations

impl<T: Clone + Data + 'static + Default> Clone for Button<T>[src]

impl<T: Data + 'static + Default> Widget<T> for Button<T>[src]

Auto Trait Implementations

impl<T> Send for Button<T>

impl<T> Sync for Button<T>

impl<T> Unpin for Button<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T[src]

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.