Struct CheckButton

Source
pub struct CheckButton { /* private fields */ }

Implementations§

Source§

impl CheckButton

Source

pub fn new(x: i32, y: i32, w: i32, _h: i32, label: &str) -> Self

Source

pub fn set_value(&mut self, val: bool)

Source

pub fn value(&self) -> bool

Source

pub fn set_callback<F: 'static + FnMut(&mut Self)>(&mut self, cb: F)

Source§

impl CheckButton

Source

pub fn with_pos(self, x: i32, y: i32) -> Self

Initialize to position x, y

Source

pub fn with_size(self, width: i32, height: i32) -> Self

Initialize to size width, height

Source

pub fn with_label(self, title: &str) -> Self

Initialize with a label

Examples found in repository?
examples/buttons.rs (line 17)
4fn main() {
5    let a = app::App::default();
6    app::set_background_color(0, 0, 0);
7    app::set_foreground_color(255, 255, 255);
8    app::set_background2_color(128, 128, 128);
9    let mut w = window::Window::default().with_size(400, 400);
10    let col = group::Flex::default()
11        .with_size(80, 300)
12        .column()
13        .center_of_parent();
14    Toggle::default();
15    RoundToggle::default();
16    RoundToggle2::default();
17    CheckButton::default().with_label("Done?");
18    HollowRoundToggle::default();
19    RadioButton::default().with_label("Radio");
20    HoverButton::default().with_label("Hello");
21    col.end();
22    w.end();
23    w.show();
24    a.run().unwrap();
25}
Source

pub fn with_align(self, align: Align) -> Self

Initialize with alignment

Source

pub fn with_type<T: WidgetType>(self, typ: T) -> Self

Initialize with type

Source

pub fn below_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self

Initialize at bottom of another widget

Source

pub fn above_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self

Initialize above of another widget

Source

pub fn right_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self

Initialize right of another widget

Source

pub fn left_of<W: WidgetExt>(self, wid: &W, padding: i32) -> Self

Initialize left of another widget

Source

pub fn center_of<W: WidgetExt>(self, w: &W) -> Self

Initialize center of another widget

Source

pub fn center_x<W: WidgetExt>(self, w: &W) -> Self

Initialize center of another widget on the x axis

Source

pub fn center_y<W: WidgetExt>(self, w: &W) -> Self

Initialize center of another widget on the y axis

Source

pub fn center_of_parent(self) -> Self

Initialize center of parent

Source

pub fn size_of<W: WidgetExt>(self, w: &W) -> Self

Initialize to the size of another widget

Source

pub fn size_of_parent(self) -> Self

Initialize to the size of the parent

Methods from Deref<Target = ToggleButton>§

Source

pub fn is_toggled(&self) -> bool

Check whether a ToggleButton is toggled

Source

pub fn toggle(&mut self, val: bool)

Sets whether the ToggleButton is toggled or not

Trait Implementations§

Source§

impl Clone for CheckButton

Source§

fn clone(&self) -> CheckButton

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for CheckButton

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Deref for CheckButton

Source§

type Target = ToggleButton

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for CheckButton

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.