From 69bc1df252382a662228c8b0da6f60358e90f376 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 6 Mar 2024 11:36:33 +0100 Subject: Simplify theming for `Svg` widget --- style/src/theme.rs | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) (limited to 'style/src/theme.rs') diff --git a/style/src/theme.rs b/style/src/theme.rs index 993e3d68..27d5b5e0 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -8,7 +8,6 @@ use crate::core::widget::text; use crate::menu; use crate::pane_grid; use crate::pick_list; -use crate::svg; use crate::text_editor; use crate::core::{Background, Border, Color}; @@ -440,52 +439,6 @@ impl pane_grid::StyleSheet for Theme { } } -/** - * Svg - */ -#[derive(Default)] -pub enum Svg { - /// No filtering to the rendered SVG. - #[default] - Default, - /// A custom style. - Custom(Box>), -} - -impl Svg { - /// Creates a custom [`Svg`] style. - pub fn custom_fn(f: fn(&Theme) -> svg::Appearance) -> Self { - Self::Custom(Box::new(f)) - } -} - -impl svg::StyleSheet for Theme { - type Style = Svg; - - fn appearance(&self, style: &Self::Style) -> svg::Appearance { - match style { - Svg::Default => svg::Appearance::default(), - Svg::Custom(custom) => custom.appearance(self), - } - } - - fn hovered(&self, style: &Self::Style) -> svg::Appearance { - self.appearance(style) - } -} - -impl svg::StyleSheet for fn(&Theme) -> svg::Appearance { - type Style = Theme; - - fn appearance(&self, style: &Self::Style) -> svg::Appearance { - (self)(style) - } - - fn hovered(&self, style: &Self::Style) -> svg::Appearance { - self.appearance(style) - } -} - impl text::StyleSheet for Theme {} /// The style of a text input. -- cgit