pub struct Button { /* private fields */ }Expand description
A clickable box around one child, which it centers.
While the pointer is over it, hover_style is laid over its style, and
while it is also held down, pressed_style on top of that. Handlers run
on the main thread and receive the button’s Cx. A handler that panics
is logged and never called again.
Implementations§
Source§impl Button
impl Button
Sourcepub fn hover_style(self, style: impl IntoProp<Style>) -> Button
pub fn hover_style(self, style: impl IntoProp<Style>) -> Button
Sets the style laid over the normal one while the pointer is over the button.
Sourcepub fn pressed_style(self, style: impl IntoProp<Style>) -> Button
pub fn pressed_style(self, style: impl IntoProp<Style>) -> Button
Sets the style laid over the hover style while the button is held down.
Sourcepub fn on_click(self, handler: impl Fn(&Cx) + 'static) -> Button
pub fn on_click(self, handler: impl Fn(&Cx) + 'static) -> Button
Runs handler when the left button is pressed and released over this
button.
Sourcepub fn on_right_click(self, handler: impl Fn(&Cx) + 'static) -> Button
pub fn on_right_click(self, handler: impl Fn(&Cx) + 'static) -> Button
Runs handler when the right button is pressed and released over this
button.
Sourcepub fn on_middle_click(self, handler: impl Fn(&Cx) + 'static) -> Button
pub fn on_middle_click(self, handler: impl Fn(&Cx) + 'static) -> Button
Runs handler when the middle button is pressed and released over
this button.
Trait Implementations§
Source§impl Widget for Button
impl Widget for Button
Source§fn into_element(self: Box<Self>) -> Element
fn into_element(self: Box<Self>) -> Element
Turns the description, and everything inside it, into the element
the window builds nodes from. It runs when the window is created or a
list item first appears, before the window’s tree is touched and
without recording what it reads, so it only describes.
Auto Trait Implementations§
impl !RefUnwindSafe for Button
impl !Send for Button
impl !Sync for Button
impl !UnwindSafe for Button
impl Forget for Button
impl Freeze for Button
impl Move for Button
impl Unpin for Button
impl UnsafeUnpin for Button
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
Mutably borrows from an owned value. Read more