diff options
author | 2024-02-06 13:55:42 -0500 | |
---|---|---|
committer | 2024-02-12 19:03:32 +0100 | |
commit | 0f920e0435932c0b6927c771424b2ba495ddb46e (patch) | |
tree | 36ff23cfa2ec6ec82457e521f8ebaad7a99ebc32 /style/src/scrollable.rs | |
parent | 891f29eea0cb32f0bee49fbace1757b82e1937f3 (diff) | |
download | iced-0f920e0435932c0b6927c771424b2ba495ddb46e.tar.gz iced-0f920e0435932c0b6927c771424b2ba495ddb46e.tar.bz2 iced-0f920e0435932c0b6927c771424b2ba495ddb46e.zip |
Introduce an appearance for a scrollable, ability to customize the scrollbar gap.
Update scrollable.rs
Diffstat (limited to 'style/src/scrollable.rs')
-rw-r--r-- | style/src/scrollable.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/style/src/scrollable.rs b/style/src/scrollable.rs index 6f37305f..3daa8886 100644 --- a/style/src/scrollable.rs +++ b/style/src/scrollable.rs @@ -1,14 +1,14 @@ //! Change the appearance of a scrollable. use crate::core::{Background, Border, Color}; -/// The appearance of a scrollable. +/// The appearance of the scrollbar of a scrollable. #[derive(Debug, Clone, Copy)] pub struct Scrollbar { - /// The [`Background`] of a scrollable. + /// The [`Background`] of a scrollbar. pub background: Option<Background>, - /// The [`Border`] of a scrollable. + /// The [`Border`] of a scrollbar. pub border: Border, - /// The appearance of the [`Scroller`] of a scrollable. + /// The appearance of the [`Scroller`] of a scrollbar. pub scroller: Scroller, } @@ -21,11 +21,23 @@ pub struct Scroller { pub border: Border, } +/// The appearance of a scrolable. +#[derive(Debug, Clone, Copy)] +pub struct Appearance { + /// The [`Background`] of a scrollable. + pub background: Option<Background>, + /// The [`Background`] of the gap between a horizontal and vertical scrollbar. + pub gap: Option<Background>, +} + /// A set of rules that dictate the style of a scrollable. pub trait StyleSheet { /// The supported style of the [`StyleSheet`]. type Style: Default; + /// Produces the style of the scrollable container. + fn appearance(&self, style: &Self::Style) -> Appearance; + /// Produces the style of an active scrollbar. fn active(&self, style: &Self::Style) -> Scrollbar; |