summaryrefslogtreecommitdiffstats
path: root/pure/src/widget/row.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-05-04 17:19:28 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-05-04 17:19:28 +0200
commit27fdc707562d4e229f07ed9496ed5d64f4e108bc (patch)
tree8a87286f0ccd125df1c2b5c597c2d2805ceb27c5 /pure/src/widget/row.rs
parenta97c520c814a6d3cc538537791be39e0c3182d6d (diff)
parent02914e5e68d1fbaad53483cd32c74d9ac448d1eb (diff)
downloadiced-27fdc707562d4e229f07ed9496ed5d64f4e108bc.tar.gz
iced-27fdc707562d4e229f07ed9496ed5d64f4e108bc.tar.bz2
iced-27fdc707562d4e229f07ed9496ed5d64f4e108bc.zip
Merge branch 'master' into dev/system-information
Diffstat (limited to 'pure/src/widget/row.rs')
-rw-r--r--pure/src/widget/row.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/pure/src/widget/row.rs b/pure/src/widget/row.rs
index 92812d27..0385b8bd 100644
--- a/pure/src/widget/row.rs
+++ b/pure/src/widget/row.rs
@@ -11,6 +11,7 @@ use iced_native::{
Alignment, Clipboard, Length, Padding, Point, Rectangle, Shell,
};
+/// A container that distributes its contents horizontally.
pub struct Row<'a, Message, Renderer> {
spacing: u16,
padding: Padding,
@@ -21,10 +22,12 @@ pub struct Row<'a, Message, Renderer> {
}
impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
+ /// Creates an empty [`Row`].
pub fn new() -> Self {
Self::with_children(Vec::new())
}
+ /// Creates a [`Row`] with the given elements.
pub fn with_children(
children: Vec<Element<'a, Message, Renderer>>,
) -> Self {
@@ -38,31 +41,41 @@ impl<'a, Message, Renderer> Row<'a, Message, Renderer> {
}
}
+ /// Sets the horizontal spacing _between_ elements.
+ ///
+ /// Custom margins per element do not exist in iced. You should use this
+ /// method instead! While less flexible, it helps you keep spacing between
+ /// elements consistent.
pub fn spacing(mut self, units: u16) -> Self {
self.spacing = units;
self
}
+ /// Sets the [`Padding`] of the [`Row`].
pub fn padding<P: Into<Padding>>(mut self, padding: P) -> Self {
self.padding = padding.into();
self
}
+ /// Sets the width of the [`Row`].
pub fn width(mut self, width: Length) -> Self {
self.width = width;
self
}
+ /// Sets the height of the [`Row`].
pub fn height(mut self, height: Length) -> Self {
self.height = height;
self
}
+ /// Sets the vertical alignment of the contents of the [`Row`] .
pub fn align_items(mut self, align: Alignment) -> Self {
self.align_items = align;
self
}
+ /// Adds an [`Element`] to the [`Row`].
pub fn push(
mut self,
child: impl Into<Element<'a, Message, Renderer>>,