summaryrefslogtreecommitdiffstats
path: root/style
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-01-08 03:30:15 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-01-08 03:30:15 +0100
commitcae4463e8379cddefbd8322a40ad8957bce07215 (patch)
treecca5db7b0a01cceb840721c828f78c0419badaa7 /style
parent08faaaf6234e93acb3b0dc8e10bf9c4cb266f21c (diff)
downloadiced-cae4463e8379cddefbd8322a40ad8957bce07215.tar.gz
iced-cae4463e8379cddefbd8322a40ad8957bce07215.tar.bz2
iced-cae4463e8379cddefbd8322a40ad8957bce07215.zip
Allow `Checkbox` style to change based on its state
Diffstat (limited to 'style')
-rw-r--r--style/src/checkbox.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/style/src/checkbox.rs b/style/src/checkbox.rs
index e84dfd18..3c645f15 100644
--- a/style/src/checkbox.rs
+++ b/style/src/checkbox.rs
@@ -13,15 +13,15 @@ pub struct Style {
/// A set of rules that dictate the style of a checkbox.
pub trait StyleSheet {
- fn active(&self) -> Style;
+ fn active(&self, is_checked: bool) -> Style;
- fn hovered(&self) -> Style;
+ fn hovered(&self, is_checked: bool) -> Style;
}
struct Default;
impl StyleSheet for Default {
- fn active(&self) -> Style {
+ fn active(&self, _is_checked: bool) -> Style {
Style {
background: Background::Color(Color::from_rgb(0.95, 0.95, 0.95)),
checkmark_color: Color::from_rgb(0.3, 0.3, 0.3),
@@ -31,10 +31,10 @@ impl StyleSheet for Default {
}
}
- fn hovered(&self) -> Style {
+ fn hovered(&self, is_checked: bool) -> Style {
Style {
background: Background::Color(Color::from_rgb(0.90, 0.90, 0.90)),
- ..self.active()
+ ..self.active(is_checked)
}
}
}