Struct rustty_oxide::StdButton [] [src]

pub struct StdButton { /* fields omitted */ }

Standard button that returns some result based on whether a key is pressed

Examples

use oxide::core::{HorizontalAlign, VerticalAlign, ButtonResult, Widget};
use oxide::{Dialog, StdButton};

let mut dlg = Dialog::new(60, 10);

let mut b1 = StdButton::new("Foo", 'f', ButtonResult::Ok);
let mut b2 = StdButton::new("Bar" ,'b', ButtonResult::Cancel);

b1.pack(&dlg, HorizontalAlign::Left, VerticalAlign::Middle, (1,1));
b2.pack(&dlg, HorizontalAlign::Middle, VerticalAlign::Middle, (1,1));

dlg.add_button(b1);
dlg.add_button(b2);

Methods

impl StdButton
[src]

[src]

Constructs a new StdButton, asking for the text to be displayed by the button, the key to map to, and the result returned when the key is detected

Examples

use oxide::core::ButtonResult;
use oxide::StdButton;

let mut b1 = StdButton::new("Foo", 'f', ButtonResult::Ok);

Trait Implementations

impl Button for StdButton
[src]

[src]

Return the char that is acting as the key in the Button

[src]

Return the ButtonResult which would be returned if the key is detected Read more

[src]

If a button is to do some special action upon being pressed, then this function will do so. StdButton for example does nothing when pressed, while CheckButton changes it's ballot Read more

[src]

If a button has a state involved, e.g. needs to keep track of a certain event, this function will return the state of the button. Read more

impl Widget for StdButton
[src]

[src]

Draws the widget to the valid CellAccessor passed

[src]

Aligns the widget with the parent as reference

[src]

Expose the painter trait draw_box for all widgets, which outlines the space enclosed within the widget Read more

[src]

Resize the given widget to new dimensions given by Size

[src]

Return a reference the renderer, Base in general cases

[src]

Return a mutable reference to the renderer, Base in general cases