pub struct ButtonState { /* private fields */ }Expand description
Implementations§
Source§impl ButtonState
impl ButtonState
pub fn icon(&self) -> Option<Pixmap>
Sourcepub fn set_text(&mut self, text: &str)
pub fn set_text(&mut self, text: &str)
Set the text
Examples found in repository?
More examples
examples/login.rs (line 60)
51 fn on_update(&self, state: &mut ButtonState) {
52 if self.login.borrow().check() {
53 state.set_style(
54 r#"
55 $color: forestgreen;
56 background-color: $color;
57 border-color: $color;
58 "#,
59 );
60 state.set_text("OK");
61 } else {
62 state.set_style(
63 r#"
64 $color: crimson;
65 background-color: $color;
66 border-color: $color;
67 "#,
68 );
69 state.set_text("KO");
70 }
71 }Sourcepub fn set_disabled(&mut self, disabled: bool)
pub fn set_disabled(&mut self, disabled: bool)
Set the disabled flag
Sourcepub fn set_stretched(&mut self, stretched: bool)
pub fn set_stretched(&mut self, stretched: bool)
Set the streched flag
Sourcepub fn set_style(&mut self, style: &str)
pub fn set_style(&mut self, style: &str)
Set the style
Examples found in repository?
examples/login.rs (lines 53-59)
51 fn on_update(&self, state: &mut ButtonState) {
52 if self.login.borrow().check() {
53 state.set_style(
54 r#"
55 $color: forestgreen;
56 background-color: $color;
57 border-color: $color;
58 "#,
59 );
60 state.set_text("OK");
61 } else {
62 state.set_style(
63 r#"
64 $color: crimson;
65 background-color: $color;
66 border-color: $color;
67 "#,
68 );
69 state.set_text("KO");
70 }
71 }Auto Trait Implementations§
impl Freeze for ButtonState
impl RefUnwindSafe for ButtonState
impl Send for ButtonState
impl Sync for ButtonState
impl Unpin for ButtonState
impl UnwindSafe for ButtonState
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