Struct egui::widgets::Button[][src]

#[must_use = "You should put this widget in an ui with `ui.add(widget);`"]
pub struct Button { /* fields omitted */ }

Clickable button with text.

See also Ui::button.

if ui.add(egui::Button::new("Click mew")).clicked() {
    do_stuff();
}

Implementations

impl Button[src]

pub fn new(text: impl ToString) -> Self[src]

pub fn text_color(self, text_color: Color32) -> Self[src]

pub fn text_color_opt(self, text_color: Option<Color32>) -> Self[src]

pub fn text_style(self, text_style: TextStyle) -> Self[src]

pub fn fill(self, fill: Option<Color32>) -> Self[src]

pub fn small(self) -> Self[src]

Make this a small button, suitable for embedding into text.

pub fn frame(self, frame: bool) -> Self[src]

Turn off the frame

pub fn sense(self, sense: Sense) -> Self[src]

By default, buttons senses clicks. Change this to a drag-button with Sense::drag().

pub fn enabled(self, enabled: bool) -> Self[src]

If you set this to false, the button will be grayed out and un-clickable. enabled(false) has the same effect as calling sense(Sense::hover()).

This is a convenience for Ui::set_enabled.

pub fn wrap(self, wrap: bool) -> Self[src]

If true, the text will wrap at the max_width. By default Self::wrap will be true in vertical layouts and horizontal layouts with wrapping, and false on non-wrapping horizontal layouts.

Note that any \n in the button text will always produce a new line.

Trait Implementations

impl Widget for Button[src]

fn ui(self, ui: &mut Ui) -> Response[src]

Allocate space, interact, paint, and return a Response.

Auto Trait Implementations

impl RefUnwindSafe for Button

impl Send for Button

impl Sync for Button

impl Unpin for Button

impl UnwindSafe for Button

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.