Add Style variant support to application::StyleSheet
This commit is contained in:
parent
fa55dff61d
commit
bb07d017e8
11 changed files with 148 additions and 43 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue