summaryrefslogtreecommitdiffstats
path: root/widget/src/button.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-24 05:03:09 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-24 05:03:09 +0100
commitf0ae9a0c38c2532220a7460916604914db94c078 (patch)
treea1f0d1732108fa87ce4a63e76def9c38c8804d5d /widget/src/button.rs
parente657dc2ecd2ffa72c0abd87f9a59dcc1acbc7083 (diff)
downloadiced-f0ae9a0c38c2532220a7460916604914db94c078.tar.gz
iced-f0ae9a0c38c2532220a7460916604914db94c078.tar.bz2
iced-f0ae9a0c38c2532220a7460916604914db94c078.zip
Use `Catalog` approach for all widgets
Diffstat (limited to '')
-rw-r--r--widget/src/button.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/widget/src/button.rs b/widget/src/button.rs
index 80a18e82..dc949671 100644
--- a/widget/src/button.rs
+++ b/widget/src/button.rs
@@ -125,7 +125,7 @@ where
self
}
- /// Sets the style of this [`Button`].
+ /// Sets the style of the [`Button`].
#[must_use]
pub fn style(mut self, style: impl Fn(&Theme, Status) -> Style + 'a) -> Self
where
@@ -135,7 +135,7 @@ where
self
}
- /// Sets the style class of this [`Button`].
+ /// Sets the style class of the [`Button`].
#[cfg(feature = "advanced")]
#[must_use]
pub fn class(mut self, class: impl Into<Theme::Class<'a>>) -> Self {
@@ -451,20 +451,18 @@ impl Default for Style {
}
/// The theme catalog of a [`Button`].
-pub trait Catalog: Sized {
- /// The item class of this [`Catalog`].
+pub trait Catalog {
+ /// The item class of the [`Catalog`].
type Class<'a>;
- /// The default class produced by this [`Catalog`].
+ /// The default class produced by the [`Catalog`].
fn default<'a>() -> Self::Class<'a>;
/// The [`Style`] of a class with the given status.
- fn style(&self, item: &Self::Class<'_>, status: Status) -> Style;
+ fn style(&self, class: &Self::Class<'_>, status: Status) -> Style;
}
/// A styling function for a [`Button`].
-///
-/// This is just a boxed closure: `Fn(&Theme, Status) -> Style`.
pub type StyleFn<'a, Theme> = Box<dyn Fn(&Theme, Status) -> Style + 'a>;
impl Catalog for Theme {