pub struct StdButton { /* private fields */ }
Expand description
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);
Implementations§
Source§impl StdButton
impl StdButton
Sourcepub fn new(text: &str, accel: char, result: ButtonResult) -> StdButton
pub fn new(text: &str, accel: char, result: ButtonResult) -> StdButton
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§
Source§impl Button for StdButton
impl Button for StdButton
Source§fn result(&self) -> ButtonResult
fn result(&self) -> ButtonResult
Return the
ButtonResult
which would be returned if the
key is detectedSource§impl Widget for StdButton
impl Widget for StdButton
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 StdButton
impl RefUnwindSafe for StdButton
impl Send for StdButton
impl Sync for StdButton
impl Unpin for StdButton
impl UnwindSafe for StdButton
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