diff options
author | 2024-07-11 08:19:27 +0200 | |
---|---|---|
committer | 2024-07-11 08:19:27 +0200 | |
commit | c63a81f68396ccd53ab757f1bdaeee6ca998d168 (patch) | |
tree | 20a6ad84a89194835604597b64fca0be8066b44f /core | |
parent | 3c55e076688fd7453e5feb53fccf8139076af584 (diff) | |
parent | 8e9099cdd30fb8a830340889f0e89eb2693e1d04 (diff) | |
download | iced-c63a81f68396ccd53ab757f1bdaeee6ca998d168.tar.gz iced-c63a81f68396ccd53ab757f1bdaeee6ca998d168.tar.bz2 iced-c63a81f68396ccd53ab757f1bdaeee6ca998d168.zip |
Merge pull request #2269 from dtzxporter/scrollbar-disabled
Add a configuration to scrollable to always show the scrollbar. Adds a disabled style for scrollbar.
Diffstat (limited to '')
-rw-r--r-- | core/src/padding.rs | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/core/src/padding.rs b/core/src/padding.rs index a63f6e29..b8c941d8 100644 --- a/core/src/padding.rs +++ b/core/src/padding.rs @@ -1,4 +1,4 @@ -use crate::Size; +use crate::{Pixels, Size}; /// An amount of space to pad for each side of a box /// @@ -54,7 +54,7 @@ impl Padding { left: 0.0, }; - /// Create a Padding that is equal on all sides + /// Create a [`Padding`] that is equal on all sides. pub const fn new(padding: f32) -> Padding { Padding { top: padding, @@ -64,6 +64,38 @@ impl Padding { } } + /// Create some top [`Padding`]. + pub fn top(padding: impl Into<Pixels>) -> Self { + Self { + top: padding.into().0, + ..Self::ZERO + } + } + + /// Create some right [`Padding`]. + pub fn right(padding: impl Into<Pixels>) -> Self { + Self { + right: padding.into().0, + ..Self::ZERO + } + } + + /// Create some bottom [`Padding`]. + pub fn bottom(padding: impl Into<Pixels>) -> Self { + Self { + bottom: padding.into().0, + ..Self::ZERO + } + } + + /// Create some left [`Padding`]. + pub fn left(padding: impl Into<Pixels>) -> Self { + Self { + left: padding.into().0, + ..Self::ZERO + } + } + /// Returns the total amount of vertical [`Padding`]. pub fn vertical(self) -> f32 { self.top + self.bottom |