summaryrefslogtreecommitdiffstats
path: root/native/src/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-31 16:58:02 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-10-31 16:58:02 +0700
commitfcc282bd76c88f389d510411b0ae73e1a4eaf317 (patch)
tree407ad2d80b9a87064787bd3f4b5ee5f3188b4cda /native/src/widget
parentd36ce33a95c277ee8fe45555df17daf21ef02ef8 (diff)
downloadiced-fcc282bd76c88f389d510411b0ae73e1a4eaf317.tar.gz
iced-fcc282bd76c88f389d510411b0ae73e1a4eaf317.tar.bz2
iced-fcc282bd76c88f389d510411b0ae73e1a4eaf317.zip
Reintroduce `Box` for `style_sheet` in `Checkbox`
Diffstat (limited to 'native/src/widget')
-rw-r--r--native/src/widget/checkbox.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/native/src/widget/checkbox.rs b/native/src/widget/checkbox.rs
index 624e01d6..b19a0a25 100644
--- a/native/src/widget/checkbox.rs
+++ b/native/src/widget/checkbox.rs
@@ -44,7 +44,7 @@ pub struct Checkbox<'a, Message, Renderer: text::Renderer> {
text_size: Option<u16>,
font: Renderer::Font,
text_color: Option<Color>,
- style_sheet: &'a dyn StyleSheet,
+ style_sheet: Box<dyn StyleSheet + 'a>,
}
impl<'a, Message, Renderer: text::Renderer> Checkbox<'a, Message, Renderer> {
@@ -119,8 +119,11 @@ impl<'a, Message, Renderer: text::Renderer> Checkbox<'a, Message, Renderer> {
}
/// Sets the style of the [`Checkbox`].
- pub fn style(mut self, style_sheet: &'a dyn StyleSheet) -> Self {
- self.style_sheet = style_sheet;
+ pub fn style(
+ mut self,
+ style_sheet: impl Into<Box<dyn StyleSheet + 'a>>,
+ ) -> Self {
+ self.style_sheet = style_sheet.into();
self
}
}