diff options
author | 2024-03-12 18:17:19 +0100 | |
---|---|---|
committer | 2024-03-12 18:17:19 +0100 | |
commit | 3d915d3cb30e5d08829aa2928676a53c505a601e (patch) | |
tree | 4acb46e00ef3037aad6a8273ab67d4278d560784 /widget/src/pane_grid/content.rs | |
parent | 34317bba5db0a0f9e3ffdbbac0d7136a32bd0f95 (diff) | |
parent | 98621aa344a7a0e1b23f320d21a4687af559998e (diff) | |
download | iced-3d915d3cb30e5d08829aa2928676a53c505a601e.tar.gz iced-3d915d3cb30e5d08829aa2928676a53c505a601e.tar.bz2 iced-3d915d3cb30e5d08829aa2928676a53c505a601e.zip |
Merge pull request #2326 from iced-rs/closure-styles
Use closures for widget styling
Diffstat (limited to 'widget/src/pane_grid/content.rs')
-rw-r--r-- | widget/src/pane_grid/content.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/widget/src/pane_grid/content.rs b/widget/src/pane_grid/content.rs index aecec777..98f4f99a 100644 --- a/widget/src/pane_grid/content.rs +++ b/widget/src/pane_grid/content.rs @@ -24,7 +24,7 @@ pub struct Content< { title_bar: Option<TitleBar<'a, Message, Theme, Renderer>>, body: Element<'a, Message, Theme, Renderer>, - style: container::Style<Theme>, + style: container::Style<'a, Theme>, } impl<'a, Message, Theme, Renderer> Content<'a, Message, Theme, Renderer> @@ -34,12 +34,12 @@ where /// Creates a new [`Content`] with the provided body. pub fn new(body: impl Into<Element<'a, Message, Theme, Renderer>>) -> Self where - Theme: container::DefaultStyle, + Theme: container::DefaultStyle + 'a, { Self { title_bar: None, body: body.into(), - style: Theme::default_style(), + style: Box::new(Theme::default_style), } } @@ -55,9 +55,9 @@ where /// Sets the style of the [`Content`]. pub fn style( mut self, - style: fn(&Theme, container::Status) -> container::Appearance, + style: impl Fn(&Theme, container::Status) -> container::Appearance + 'a, ) -> Self { - self.style = style.into(); + self.style = Box::new(style); self } } @@ -403,7 +403,7 @@ impl<'a, T, Message, Theme, Renderer> From<T> for Content<'a, Message, Theme, Renderer> where T: Into<Element<'a, Message, Theme, Renderer>>, - Theme: container::DefaultStyle, + Theme: container::DefaultStyle + 'a, Renderer: crate::core::Renderer, { fn from(element: T) -> Self { |