pub struct CheckButton { /* private fields */ }
Implementations§
Source§impl CheckButton
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.
impl CheckButton
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);
Sourcepub fn new(text: &str, accel: char, result: ButtonResult) -> CheckButton
pub fn new(text: &str, accel: char, result: ButtonResult) -> CheckButton
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§
Source§impl Button for CheckButton
impl Button for CheckButton
Source§fn result(&self) -> ButtonResult
fn result(&self) -> ButtonResult
Return the
ButtonResult
which would be returned if the
key is detectedSource§impl Widget for CheckButton
impl Widget for CheckButton
Source§fn draw(&mut self, parent: &mut dyn CellAccessor)
fn draw(&mut self, parent: &mut dyn CellAccessor)
Draws the widget to the valid
CellAccessor
passedSource§fn pack(
&mut self,
parent: &dyn HasSize,
halign: HorizontalAlign,
valign: VerticalAlign,
margin: (usize, usize),
)
fn pack( &mut self, parent: &dyn HasSize, halign: HorizontalAlign, valign: VerticalAlign, margin: (usize, usize), )
Aligns the widget with the
parent
as referenceAuto Trait Implementations§
impl Freeze for CheckButton
impl RefUnwindSafe for CheckButton
impl Send for CheckButton
impl Sync for CheckButton
impl Unpin for CheckButton
impl UnwindSafe for CheckButton
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