From 40a5de581144886571504b762719f057dbb2e871 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 31 Oct 2021 17:02:59 +0700 Subject: Reintroduce `Box` for `style_sheet` in `Container` --- native/src/widget/pane_grid/content.rs | 9 ++++++--- native/src/widget/pane_grid/title_bar.rs | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'native/src/widget/pane_grid') diff --git a/native/src/widget/pane_grid/content.rs b/native/src/widget/pane_grid/content.rs index 83d96917..d8da6d33 100644 --- a/native/src/widget/pane_grid/content.rs +++ b/native/src/widget/pane_grid/content.rs @@ -14,7 +14,7 @@ use crate::{Clipboard, Element, Hasher, Layout, Point, Rectangle, Size}; pub struct Content<'a, Message, Renderer> { title_bar: Option>, body: Element<'a, Message, Renderer>, - style_sheet: &'a dyn container::StyleSheet, + style_sheet: Box, } impl<'a, Message, Renderer> Content<'a, Message, Renderer> @@ -40,8 +40,11 @@ where } /// Sets the style of the [`Content`]. - pub fn style(mut self, style_sheet: &'a dyn container::StyleSheet) -> Self { - self.style_sheet = style_sheet; + pub fn style( + mut self, + style_sheet: impl Into>, + ) -> Self { + self.style_sheet = style_sheet.into(); self } } diff --git a/native/src/widget/pane_grid/title_bar.rs b/native/src/widget/pane_grid/title_bar.rs index 2d66ba6c..ffd59488 100644 --- a/native/src/widget/pane_grid/title_bar.rs +++ b/native/src/widget/pane_grid/title_bar.rs @@ -17,7 +17,7 @@ pub struct TitleBar<'a, Message, Renderer> { controls: Option>, padding: Padding, always_show_controls: bool, - style_sheet: &'a dyn container::StyleSheet, + style_sheet: Box, } impl<'a, Message, Renderer> TitleBar<'a, Message, Renderer> @@ -54,8 +54,11 @@ where } /// Sets the style of the [`TitleBar`]. - pub fn style(mut self, style: &'a dyn container::StyleSheet) -> Self { - self.style_sheet = style; + pub fn style( + mut self, + style: impl Into>, + ) -> Self { + self.style_sheet = style.into(); self } -- cgit