diff options
author | 2022-07-08 20:07:33 +0200 | |
---|---|---|
committer | 2022-07-08 20:07:33 +0200 | |
commit | bb07d017e8c8e43ac74f66bf649643bebdc5f71d (patch) | |
tree | 6e780f78ef4eae7dbe590a82ceef11e47289d953 /src/application.rs | |
parent | fa55dff61db47197a961152285c6a6abfab0b217 (diff) | |
download | iced-bb07d017e8c8e43ac74f66bf649643bebdc5f71d.tar.gz iced-bb07d017e8c8e43ac74f66bf649643bebdc5f71d.tar.bz2 iced-bb07d017e8c8e43ac74f66bf649643bebdc5f71d.zip |
Add `Style` variant support to `application::StyleSheet`
Diffstat (limited to 'src/application.rs')
-rw-r--r-- | src/application.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/application.rs b/src/application.rs index b7c8cf9f..d4297eea 100644 --- a/src/application.rs +++ b/src/application.rs @@ -1,7 +1,7 @@ use crate::window; use crate::{Command, Element, Executor, Settings, Subscription}; -pub use iced_native::application::StyleSheet; +pub use iced_native::application::{Appearance, StyleSheet}; /// An interactive cross-platform application. /// @@ -141,10 +141,20 @@ pub trait Application: Sized { fn view(&mut self) -> Element<'_, Self::Message, Self::Theme>; /// Returns the current [`Theme`] of the [`Application`]. + /// + /// [`Theme`]: Self::Theme fn theme(&self) -> Self::Theme { Self::Theme::default() } + /// Returns the current [`Style`] of the [`Theme`]. + /// + /// [`Style`]: <Self::Theme as StyleSheet>::Style + /// [`Theme`]: Self::Theme + fn style(&self) -> <Self::Theme as StyleSheet>::Style { + <Self::Theme as StyleSheet>::Style::default() + } + /// Returns the event [`Subscription`] for the current state of the /// application. /// @@ -260,6 +270,10 @@ where self.0.theme() } + fn style(&self) -> <A::Theme as StyleSheet>::Style { + self.0.style() + } + fn mode(&self) -> iced_winit::Mode { match self.0.mode() { window::Mode::Windowed => iced_winit::Mode::Windowed, |