Use custom Application::style to enable transparency

This commit is contained in:
Héctor Ramón Jiménez 2024-02-10 00:32:03 +01:00
parent 712c8e53f2
commit 81bed94148
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 28 additions and 27 deletions

View file

@ -172,6 +172,15 @@ pub enum Application {
Custom(Box<dyn application::StyleSheet<Style = Theme>>),
}
impl Application {
/// Creates a custom [`Application`] style.
pub fn custom(
custom: impl application::StyleSheet<Style = Theme> + 'static,
) -> Self {
Self::Custom(Box::new(custom))
}
}
impl application::StyleSheet for Theme {
type Style = Application;
@ -196,14 +205,6 @@ impl<T: Fn(&Theme) -> application::Appearance> application::StyleSheet for T {
}
}
impl<T: Fn(&Theme) -> application::Appearance + 'static> From<T>
for Application
{
fn from(f: T) -> Self {
Self::Custom(Box::new(f))
}
}
/// The style of a button.
#[derive(Default)]
pub enum Button {