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

pub struct Button<T> { /* fields omitted */ }

A button with a text label.

Methods

impl<T: Data> Button<T>[src]

pub fn new(text: impl Into<LabelText<T>>) -> Button<T>[src]

Create a new button with a text label.

Use the .on_click method to provide a closure to be called when the button is clicked.

Examples

use druid::widget::Button;

let button = Button::new("Increment").on_click(|_ctx, data: &mut u32, _env| {
    *data += 1;
});

pub fn on_click(
    self,
    f: impl Fn(&mut EventCtx, &mut T, &Env) + 'static
) -> ControllerHost<Self, Click<T>>
[src]

Provide a closure to be called when this button is clicked.

Trait Implementations

impl<T: Data> Widget<T> for Button<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Button<T>

impl<T> !Send for Button<T>

impl<T> !Sync for Button<T>

impl<T> Unpin for Button<T>

impl<T> !UnwindSafe 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

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

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.