summaryrefslogtreecommitdiffstats
path: root/style
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-19 03:43:11 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-05-19 03:43:11 +0200
commit96aa0379d58ff799493097e3bd0572f9a87da453 (patch)
treebb3cb685a45244d3b63e423b260f36a6759673bb /style
parent59663d2e45c3c4487fb64f781eb0d0f422763467 (diff)
downloadiced-96aa0379d58ff799493097e3bd0572f9a87da453.tar.gz
iced-96aa0379d58ff799493097e3bd0572f9a87da453.tar.bz2
iced-96aa0379d58ff799493097e3bd0572f9a87da453.zip
Implement `custom` helper for `theme::Button`
Diffstat (limited to '')
-rw-r--r--style/src/theme.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs
index c9835ca3..477bd27b 100644
--- a/style/src/theme.rs
+++ b/style/src/theme.rs
@@ -139,6 +139,15 @@ pub enum Button {
Custom(Box<dyn button::StyleSheet<Style = Theme>>),
}
+impl Button {
+ /// Creates a custom [`Button`] style variant.
+ pub fn custom(
+ style_sheet: impl button::StyleSheet<Style = Theme> + 'static,
+ ) -> Self {
+ Self::Custom(Box::new(style_sheet))
+ }
+}
+
impl button::StyleSheet for Theme {
type Style = Button;