Struct direct_gui::controls::Button [] [src]

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

A button widget that can be rendered in multiple ways: Flat: using a simpel pixel rectangle algorithm. Image: using a spritesheet divided into 3 parts for rendering its state.

Methods

impl<S> Button<S>
[src]

[src]

Retrieve the position.

[src]

Map a position.

[src]

Change the position.

[src]

Get if the button is currently pressed.

[src]

Set the event to a closure which will be called if the button state changes.

impl Button<Flat>
[src]

[src]

Create a new colored button without text.

impl Button<Image>
[src]

[src]

Create a new button with a sprite without text.

The button image needs to be 3 buttons divided vertically: 1. normal state 2. mouse hover state 3. mouse pressed state

Be careful when using this code, it's not being tested!
+-------+
|Normal |
+-------+
| Hover |
+-------+
|Pressed|
+-------+

Trait Implementations

impl Control for Button<Flat>
[src]

[src]

Update the control.

[src]

Draw the control on the output buffer.

[src]

Retrieve what type of control this is.

[src]

For downcasting.

[src]

For downcasting.

impl Control for Button<Image>
[src]

[src]

Update the control.

[src]

Draw the control on the output buffer.

[src]

Retrieve what type of control this is.

[src]

For downcasting.

[src]

For downcasting.