pub struct Button { /* private fields */ }Expand description
A button in the app bar.
§Examples
use appcui::prelude::*;
let button = appbar::Button::new("Button", 0, appbar::Side::Left);Implementations§
Source§impl Button
impl Button
Sourcepub fn new(caption: &str, order: u8, pos: Side) -> Self
pub fn new(caption: &str, order: u8, pos: Side) -> Self
Creates a new button with the specified caption, order and position.
§Parameters
caption- The caption of the button. If the caption contains the&character, the next character (if it is a letter or number) will be set as a hot-key for the button. For example,"&Save"will set the hot-key toAlt+S.order- The order of the button (a number that determines the order of the button in the app bar - lower numbers are displayed first from either left or right depending on the pos parameter)pos- The position of the button (LeftorRight)
§Example
use appcui::prelude::*;
let button = appbar::Button::new("Button", 0, appbar::Side::Left);Sourcepub fn with_tooltip(caption: &str, tooltip: &str, order: u8, pos: Side) -> Self
pub fn with_tooltip(caption: &str, tooltip: &str, order: u8, pos: Side) -> Self
Creates a new button with the specified caption, tooltip, order and position.
§Parameters
caption- The caption of the button. If the caption contains the&character, the next character (if it is a letter or number) will be set as a hot-key for the button. For example,"&Save"will set the hot-key toAlt+S.tooltip- The tooltip associated with the button (it will be displayed when the mouse is over the button)order- The order of the button (a number that determines the order of the button in the app bar - lower numbers are displayed first from either left or right depending on the pos parameter)pos- The position of the button (LeftorRight)
§Example
use appcui::prelude::*;
let button = appbar::Button::with_tooltip("Button", "Tooltip", 0, appbar::Side::Left);Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns true if the button is enabled, false otherwise.
Sourcepub fn set_enabled(&mut self, enabled: bool)
pub fn set_enabled(&mut self, enabled: bool)
Enables or disables the button.
Sourcepub fn set_caption(&mut self, text: &str)
pub fn set_caption(&mut self, text: &str)
Sets the caption of the button. If the caption contains the & character, the next character (if it is a letter or number) will be set as a hot-key for the button. For example, "&Save" will set the hot-key to Alt+S.
Sourcepub fn set_tooltip(&mut self, text: &str)
pub fn set_tooltip(&mut self, text: &str)
Sets the tooltip of the button.
Auto Trait Implementations§
impl Freeze for Button
impl RefUnwindSafe for Button
impl Send for Button
impl Sync for Button
impl Unpin for Button
impl UnsafeUnpin for Button
impl UnwindSafe for Button
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.