summaryrefslogtreecommitdiffstats
path: root/src/sandbox.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-07-08 20:13:14 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-07-08 20:13:14 +0200
commit3514bd1535bc8421c746d981ca488883486de97f (patch)
tree817d968da3435dcba0aec824cec485e2870c87a1 /src/sandbox.rs
parentbb07d017e8c8e43ac74f66bf649643bebdc5f71d (diff)
downloadiced-3514bd1535bc8421c746d981ca488883486de97f.tar.gz
iced-3514bd1535bc8421c746d981ca488883486de97f.tar.bz2
iced-3514bd1535bc8421c746d981ca488883486de97f.zip
Add `theme::Application` styling support to `Sandbox`
Diffstat (limited to 'src/sandbox.rs')
-rw-r--r--src/sandbox.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/sandbox.rs b/src/sandbox.rs
index f03562fb..3ca3fe8f 100644
--- a/src/sandbox.rs
+++ b/src/sandbox.rs
@@ -1,6 +1,5 @@
-use crate::{
- Application, Command, Element, Error, Settings, Subscription, Theme,
-};
+use crate::theme::{self, Theme};
+use crate::{Application, Command, Element, Error, Settings, Subscription};
/// A sandboxed [`Application`].
///
@@ -121,6 +120,13 @@ pub trait Sandbox {
Theme::default()
}
+ /// Returns the current style variant of [`theme::Application`].
+ ///
+ /// By default, it returns [`theme::Application::default`].
+ fn style(&self) -> theme::Application {
+ theme::Application::default()
+ }
+
/// Returns the scale factor of the [`Sandbox`].
///
/// It can be used to dynamically control the size of the UI at runtime
@@ -186,6 +192,10 @@ where
T::theme(self)
}
+ fn style(&self) -> theme::Application {
+ T::style(self)
+ }
+
fn subscription(&self) -> Subscription<T::Message> {
Subscription::none()
}