Struct rustty_oxide::CheckButton
[−]
[src]
pub struct CheckButton { /* fields omitted */ }
Methods
impl CheckButton
[src]
A simple check button that manages an internal state which determines if the button is to be checked or not. The actual checking is handled by the user during an event loop.
Examples
use oxide::core::{HorizontalAlign, VerticalAlign, ButtonResult, Widget, Button}; use oxide::{Dialog, CheckButton}; let mut dlg = Dialog::new(60, 10); let mut b1 = CheckButton::new("Foo", 'f', ButtonResult::Ok); b1.pack(&dlg, HorizontalAlign::Left, VerticalAlign::Bottom, (1,1)); // Change the initial state of the button to checked b1.pressed(); dlg.add_button(b1); // Now switch the state of the button bound to Ok, which unchecks b1 dlg.button_pressed(ButtonResult::Ok);
fn new(text: &str, accel: char, result: ButtonResult) -> CheckButton
[src]
Constructs a new CheckButton
, 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::CheckButton; let mut b1 = CheckButton::new("Foo", 'f', ButtonResult::Ok);
Trait Implementations
impl Button for CheckButton
[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 CheckButton
[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