[][src]Struct cursive::views::Checkbox

pub struct Checkbox { /* fields omitted */ }

Checkable box.

Examples

use cursive_core::views::Checkbox;
use cursive_core::traits::Identifiable;

let checkbox = Checkbox::new().checked().with_name("check");

Implementations

impl Checkbox[src]

pub fn disable(&mut self)[src]

Disables this view.

A disabled view cannot be selected.

pub fn disabled(self) -> Checkbox[src]

Disables this view.

Chainable variant.

pub fn enable(&mut self)[src]

Re-enables this view.

pub fn set_enabled(&mut self, enabled: bool)[src]

Enable or disable this view.

pub fn with_enabled(self, is_enabled: bool) -> Checkbox[src]

Enable or disable this view.

Chainable variant.

pub fn is_enabled(&self) -> bool[src]

Returns true if this view is enabled.

pub fn new() -> Checkbox[src]

Creates a new, unchecked checkbox.

pub fn set_on_change<F>(&mut self, on_change: F) where
    F: 'static + Fn(&mut Cursive, bool), 
[src]

Sets a callback to be used when the state changes.

pub fn on_change<F>(self, on_change: F) -> Checkbox where
    F: 'static + Fn(&mut Cursive, bool), 
[src]

Sets a callback to be used when the state changes.

Chainable variant.

pub fn toggle(&mut self) -> EventResult[src]

Toggles the checkbox state.

pub fn check(&mut self) -> EventResult[src]

Check the checkbox.

pub fn checked(self) -> Checkbox[src]

Check the checkbox.

Chainable variant.

pub fn is_checked(&self) -> bool[src]

Returns true if the checkbox is checked.

Examples

use cursive_core::views::Checkbox;

let mut checkbox = Checkbox::new().checked();
assert!(checkbox.is_checked());

checkbox.uncheck();
assert!(!checkbox.is_checked());

pub fn uncheck(&mut self) -> EventResult[src]

Uncheck the checkbox.

pub fn unchecked(self) -> Checkbox[src]

Uncheck the checkbox.

Chainable variant.

pub fn set_checked(&mut self, checked: bool) -> EventResult[src]

Sets the checkbox state.

pub fn with_checked(self, is_checked: bool) -> Checkbox[src]

Set the checkbox state.

Chainable variant.

Trait Implementations

impl Default for Checkbox[src]

impl View for Checkbox[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AnyView for T where
    T: View
[src]

pub fn as_any(&self) -> &(dyn Any + 'static)[src]

Downcast self to a Any.

pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)[src]

Downcast self to a mutable Any.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> Finder for T where
    T: View
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoBoxedView for T where
    T: View
[src]

impl<T> Nameable for T where
    T: View
[src]

impl<T> Resizable for T where
    T: View
[src]

impl<T> Scrollable for T where
    T: View
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> With for T[src]