[][src]Struct nannou::ui::prelude::widget::button::Button

pub struct Button<'a, S> {
    pub show: S,
    pub style: Style,
    // some fields omitted
}

A pressable button widget whose reaction is triggered upon release.

Fields

show: S

Whether the Button is a Flat color or an Image.

style: Style

Unique styling parameters for the Button.

Methods

impl<'a> Button<'a, Image>[src]

pub fn image(image_id: Id) -> Button<'a, Image>[src]

Begin building a button displaying the given Image on top.

pub fn source_rectangle(self, rect: Rect) -> Button<'a, Image>[src]

The rectangular area of the image that we wish to display.

If this method is not called, the entire image will be used.

pub fn image_color(self, color: Color) -> Button<'a, Image>[src]

Map the Image's luminance to the given color.

pub fn image_color_with_feedback(self, color: Color) -> Button<'a, Image>[src]

Map the Image's luminance to the given color.

The color will change slightly when the button is highlighted or clicked to give the user some visual feedback.

pub fn hover_image(self, id: Id) -> Button<'a, Image>[src]

The image displayed while the mouse hovers over the Button.

pub fn press_image(self, id: Id) -> Button<'a, Image>[src]

The image displayed while the Button is pressed.

impl<'a> Button<'a, Flat>[src]

pub fn new() -> Button<'a, Flat>[src]

Begin building a flat-colored Button widget.

pub fn with_style(self, s: Style) -> Button<'a, Flat>[src]

Override the default button style

pub fn hover_color(self, color: Color) -> Button<'a, Flat>[src]

Specify a color to use when the mouse hovers over the button.

By default, this is color.highlighted() where color is the button's regular color.

pub fn press_color(self, color: Color) -> Button<'a, Flat>[src]

Specify a color to use when the mouse presses the button.

By default, this is color.clicked() where color is the button's regular color.

impl<'a, S> Button<'a, S>[src]

pub fn label_font_id(self, font_id: Id) -> Button<'a, S>[src]

Specify the font used for displaying the label.

pub fn left_justify_label(self) -> Button<'a, S>[src]

Align the label to the left of the Button's surface.

pub fn center_justify_label(self) -> Button<'a, S>[src]

Align the label to the mid-left of the Button's surface.

This is the default label alignment.

pub fn right_justify_label(self) -> Button<'a, S>[src]

Align the label to the mid-left of the Button's surface.

pub fn label_x(self, x: Relative) -> Button<'a, S>[src]

Specify the label's position relatively to Button along the x axis.

pub fn label_y(self, y: Relative) -> Button<'a, S>[src]

Specify the label's position relatively to Button along the y axis.

pub fn enabled(self, enabled: bool) -> Button<'a, S>[src]

Build the type's self.$($assignee).+ with the given $Type.

Trait Implementations

impl<'a, S> Borderable for Button<'a, S>[src]

fn border(self, border: f64) -> Button<'a, S>[src]

Build the type's self.$($assignee).+ with the given $Type.

fn border_color(self, border_color: Color) -> Button<'a, S>[src]

Build the type's self.$($assignee).+ with the given $Type.

impl<'a, S> Clone for Button<'a, S> where
    S: Clone
[src]

impl<'a, S> Colorable for Button<'a, S>[src]

fn color(self, color: Color) -> Button<'a, S>[src]

Build the type's self.$($assignee).+ with the given $Type.

impl<'a, S> Common for Button<'a, S>[src]

impl<'a, S> Labelable<'a> for Button<'a, S>[src]

fn label(self, label: &'a str) -> Button<'a, S>[src]

Build the type's self.$($assignee).+ with the given $Type.

fn label_color(self, label_color: Color) -> Button<'a, S>[src]

Build the type's self.$($assignee).+ with the given $Type.

fn label_font_size(self, label_font_size: u32) -> Button<'a, S>[src]

Build the type's self.$($assignee).+ with the given $Type.

impl<'a> Widget for Button<'a, Flat>[src]

type State = FlatIds

State to be stored within the Uis widget cache. Read more

type Style = Style

Every widget is required to have its own associated Style type. This type is intended to contain high-level styling information for the widget that can be optionally specified by a user of the widget. Read more

type Event = TimesClicked

The type of event yielded by the widget, returned via the Widget::set function. Read more

fn update(
    self,
    args: UpdateArgs<Button<'a, Flat>>
) -> <Button<'a, Flat> as Widget>::Event
[src]

Update the state of the Button.

impl<'a> Widget for Button<'a, Image>[src]

type State = ImageIds

State to be stored within the Uis widget cache. Read more

type Style = Style

Every widget is required to have its own associated Style type. This type is intended to contain high-level styling information for the widget that can be optionally specified by a user of the widget. Read more

type Event = TimesClicked

The type of event yielded by the widget, returned via the Widget::set function. Read more

fn update(
    self,
    args: UpdateArgs<Button<'a, Image>>
) -> <Button<'a, Image> as Widget>::Event
[src]

Update the state of the Button.

Auto Trait Implementations

impl<'a, S> RefUnwindSafe for Button<'a, S> where
    S: RefUnwindSafe

impl<'a, S> Send for Button<'a, S> where
    S: Send

impl<'a, S> Sync for Button<'a, S> where
    S: Sync

impl<'a, S> Unpin for Button<'a, S> where
    S: Unpin

impl<'a, S> UnwindSafe for Button<'a, S> where
    S: UnwindSafe

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

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, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

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

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

impl<W> Positionable for W where
    W: Widget
[src]

impl<T> SetParameter for T

impl<T> SetParameter for T

impl<W> Sizeable for W where
    W: Widget
[src]

fn get_x_dimension(&self, ui: &Ui) -> Dimension[src]

We attempt to retrieve the x Dimension for the widget via the following:

  • Check for specified value at maybe_x_dimension
  • Otherwise, use the default returned by Widget::default_x_dimension.

fn get_y_dimension(&self, ui: &Ui) -> Dimension[src]

We attempt to retrieve the y Dimension for the widget via the following:

  • Check for specified value at maybe_y_dimension
  • Otherwise, use the default returned by Widget::default_y_dimension.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,