pub struct Checkbox { /* private fields */ }Expand description
Checkbox widget: a toggleable checkbox with optional label.
Implementations§
Source§impl Checkbox
impl Checkbox
pub fn new(label: &str) -> Self
pub fn with_checked(self, checked: bool) -> Self
pub fn with_style(self, style: Style) -> Self
pub fn with_checked_style(self, style: Style) -> Self
pub fn on_change<F>(self, callback: F) -> Self
pub fn set_checked(&mut self, checked: bool)
pub fn is_checked(&self) -> bool
pub fn toggle(&mut self)
Trait Implementations§
Source§impl Widget for Checkbox
impl Widget for Checkbox
Source§fn set_bounds(&mut self, bounds: Rect)
fn set_bounds(&mut self, bounds: Rect)
Set widget’s bounds
Source§fn state(&self) -> &WidgetState
fn state(&self) -> &WidgetState
Get widget’s current state
Source§fn state_mut(&mut self) -> &mut WidgetState
fn state_mut(&mut self) -> &mut WidgetState
Get mutable widget state
Source§fn update(&mut self, _dt: f32, _ctx: &mut Context) -> UIResult<()>
fn update(&mut self, _dt: f32, _ctx: &mut Context) -> UIResult<()>
Update widget logic (called every frame)
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Get mutable widget as Any for downcasting
Source§fn render(&self, buffer: &mut Buffer, _ctx: &Context) -> UIResult<()>
fn render(&self, buffer: &mut Buffer, _ctx: &Context) -> UIResult<()>
Render the widget to a buffer
Source§fn handle_event(
&mut self,
event: &UIEvent,
_ctx: &mut Context,
) -> UIResult<bool>
fn handle_event( &mut self, event: &UIEvent, _ctx: &mut Context, ) -> UIResult<bool>
Handle input events
Source§fn preferred_size(&self, available: Rect) -> Rect
fn preferred_size(&self, available: Rect) -> Rect
Calculate preferred size based on content
Source§fn set_visible(&mut self, visible: bool)
fn set_visible(&mut self, visible: bool)
Set widget visibility
Source§fn set_enabled(&mut self, enabled: bool)
fn set_enabled(&mut self, enabled: bool)
Set widget enabled state
Source§fn set_focused(&mut self, focused: bool)
fn set_focused(&mut self, focused: bool)
Set widget focus
Source§fn mark_dirty(&mut self)
fn mark_dirty(&mut self)
Mark widget as dirty (needs redraw)
Source§fn clear_dirty(&mut self)
fn clear_dirty(&mut self)
Clear dirty flag
Source§fn layout_children(&mut self)
fn layout_children(&mut self)
Layout children if this widget is a container
Default implementation does nothing, containers should override this
Auto Trait Implementations§
impl Freeze for Checkbox
impl !RefUnwindSafe for Checkbox
impl !Send for Checkbox
impl !Sync for Checkbox
impl Unpin for Checkbox
impl UnsafeUnpin for Checkbox
impl !UnwindSafe for Checkbox
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<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more