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]
fn new(text: &str, accel: char, result: ButtonResult) -> StdButton
[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]
fn accel(&self) -> char
[src]
Return the char that is acting as the key in the Button
fn result(&self) -> ButtonResult
[src]
Return the ButtonResult
which would be returned if the key is detected Read more
fn pressed(&mut self)
[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
fn state(&self) -> bool
[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]
fn draw(&mut self, parent: &mut CellAccessor)
[src]
Draws the widget to the valid CellAccessor
passed
fn pack(
&mut self,
parent: &HasSize,
halign: HorizontalAlign,
valign: VerticalAlign,
margin: (usize, usize)
)
[src]
&mut self,
parent: &HasSize,
halign: HorizontalAlign,
valign: VerticalAlign,
margin: (usize, usize)
)
Aligns the widget with the parent
as reference
fn draw_box(&mut self)
[src]
Expose the painter trait draw_box
for all widgets, which outlines the space enclosed within the widget Read more
fn resize(&mut self, new_size: Size)
[src]
Resize the given widget to new dimensions given by Size
fn frame(&self) -> &Frame
[src]
Return a reference the renderer, Base
in general cases
fn frame_mut(&mut self) -> &mut Frame
[src]
Return a mutable reference to the renderer, Base
in general cases