diff options
author | 2019-09-15 18:53:13 +0200 | |
---|---|---|
committer | 2019-09-15 18:53:13 +0200 | |
commit | 655978f480c32bc696f0d5fe2fff834bfbf238ea (patch) | |
tree | ee9af0e0e802c7f85004fd28d3854dbb8bfcb4f5 /src | |
parent | 8834772fa70850559f7bd82cc8432394e3fd9db7 (diff) | |
download | iced-655978f480c32bc696f0d5fe2fff834bfbf238ea.tar.gz iced-655978f480c32bc696f0d5fe2fff834bfbf238ea.tar.bz2 iced-655978f480c32bc696f0d5fe2fff834bfbf238ea.zip |
Draft nodes for missing widgets
Diffstat (limited to 'src')
-rw-r--r-- | src/widget/checkbox.rs | 9 | ||||
-rw-r--r-- | src/widget/image.rs | 6 | ||||
-rw-r--r-- | src/widget/radio.rs | 9 | ||||
-rw-r--r-- | src/widget/slider.rs | 12 |
4 files changed, 24 insertions, 12 deletions
diff --git a/src/widget/checkbox.rs b/src/widget/checkbox.rs index c60807fd..4ae167ad 100644 --- a/src/widget/checkbox.rs +++ b/src/widget/checkbox.rs @@ -38,9 +38,12 @@ use crate::{ /// ///  pub struct Checkbox<Color, Message> { - is_checked: bool, - on_toggle: Box<dyn Fn(bool) -> Message>, - label: String, + /// Whether the checkbox is checked or not + pub is_checked: bool, + /// Toggle message to fire + pub on_toggle: Box<dyn Fn(bool) -> Message>, + /// The label of the checkbox + pub label: String, label_color: Option<Color>, } diff --git a/src/widget/image.rs b/src/widget/image.rs index d94bfea5..8c869ab8 100644 --- a/src/widget/image.rs +++ b/src/widget/image.rs @@ -24,9 +24,11 @@ use std::hash::Hash; /// let image = Image::new(my_handle); /// ``` pub struct Image<I> { - image: I, + /// The image handle + pub image: I, source: Option<Rectangle<u16>>, - width: Option<u16>, + /// The width of the image + pub width: Option<u16>, height: Option<u16>, style: Style, } diff --git a/src/widget/radio.rs b/src/widget/radio.rs index 28353ef4..27c0ff17 100644 --- a/src/widget/radio.rs +++ b/src/widget/radio.rs @@ -47,9 +47,12 @@ use std::hash::Hash; /// ///  pub struct Radio<Color, Message> { - is_selected: bool, - on_click: Message, - label: String, + /// Whether the radio button is selected or not + pub is_selected: bool, + /// The message to produce when the radio button is clicked + pub on_click: Message, + /// The label of the radio button + pub label: String, label_color: Option<Color>, } diff --git a/src/widget/slider.rs b/src/widget/slider.rs index cdec9ec4..8a0cea01 100644 --- a/src/widget/slider.rs +++ b/src/widget/slider.rs @@ -6,6 +6,7 @@ //! [`State`]: struct.State.html use std::hash::Hash; use std::ops::RangeInclusive; +use std::rc::Rc; use crate::input::{mouse, ButtonState}; use crate::{ @@ -42,9 +43,12 @@ use crate::{ ///  pub struct Slider<'a, Message> { state: &'a mut State, - range: RangeInclusive<f32>, - value: f32, - on_change: Box<dyn Fn(f32) -> Message>, + /// The range of the slider + pub range: RangeInclusive<f32>, + /// The current value of the slider + pub value: f32, + /// The function to produce messages on change + pub on_change: Rc<Box<dyn Fn(f32) -> Message>>, style: Style, } @@ -85,7 +89,7 @@ impl<'a, Message> Slider<'a, Message> { state, value: value.max(*range.start()).min(*range.end()), range, - on_change: Box::new(on_change), + on_change: Rc::new(Box::new(on_change)), style: Style::default().min_width(100).fill_width(), } } |