summaryrefslogtreecommitdiffstats
path: root/core/src/widget
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/widget')
-rw-r--r--core/src/widget/column.rs14
-rw-r--r--core/src/widget/row.rs14
-rw-r--r--core/src/widget/scrollable.rs10
3 files changed, 22 insertions, 16 deletions
diff --git a/core/src/widget/column.rs b/core/src/widget/column.rs
index 2df327a0..f0c47f50 100644
--- a/core/src/widget/column.rs
+++ b/core/src/widget/column.rs
@@ -1,5 +1,7 @@
use crate::{Align, Justify, Length};
+use std::u32;
+
/// A container that distributes its contents vertically.
///
/// A [`Column`] will try to fill the horizontal space of its container.
@@ -10,8 +12,8 @@ pub struct Column<Element> {
pub padding: u16,
pub width: Length,
pub height: Length,
- pub max_width: Length,
- pub max_height: Length,
+ pub max_width: u32,
+ pub max_height: u32,
pub align_self: Option<Align>,
pub align_items: Align,
pub justify_content: Justify,
@@ -28,8 +30,8 @@ impl<Element> Column<Element> {
padding: 0,
width: Length::Fill,
height: Length::Shrink,
- max_width: Length::Shrink,
- max_height: Length::Shrink,
+ max_width: u32::MAX,
+ max_height: u32::MAX,
align_self: None,
align_items: Align::Start,
justify_content: Justify::Start,
@@ -74,7 +76,7 @@ impl<Element> Column<Element> {
/// Sets the maximum width of the [`Column`].
///
/// [`Column`]: struct.Column.html
- pub fn max_width(mut self, max_width: Length) -> Self {
+ pub fn max_width(mut self, max_width: u32) -> Self {
self.max_width = max_width;
self
}
@@ -82,7 +84,7 @@ impl<Element> Column<Element> {
/// Sets the maximum height of the [`Column`] in pixels.
///
/// [`Column`]: struct.Column.html
- pub fn max_height(mut self, max_height: Length) -> Self {
+ pub fn max_height(mut self, max_height: u32) -> Self {
self.max_height = max_height;
self
}
diff --git a/core/src/widget/row.rs b/core/src/widget/row.rs
index 6bdb4ed2..10716a7a 100644
--- a/core/src/widget/row.rs
+++ b/core/src/widget/row.rs
@@ -1,5 +1,7 @@
use crate::{Align, Justify, Length};
+use std::u32;
+
/// A container that distributes its contents horizontally.
///
/// A [`Row`] will try to fill the horizontal space of its container.
@@ -10,8 +12,8 @@ pub struct Row<Element> {
pub padding: u16,
pub width: Length,
pub height: Length,
- pub max_width: Length,
- pub max_height: Length,
+ pub max_width: u32,
+ pub max_height: u32,
pub align_self: Option<Align>,
pub align_items: Align,
pub justify_content: Justify,
@@ -28,8 +30,8 @@ impl<Element> Row<Element> {
padding: 0,
width: Length::Fill,
height: Length::Shrink,
- max_width: Length::Shrink,
- max_height: Length::Shrink,
+ max_width: u32::MAX,
+ max_height: u32::MAX,
align_self: None,
align_items: Align::Start,
justify_content: Justify::Start,
@@ -74,7 +76,7 @@ impl<Element> Row<Element> {
/// Sets the maximum width of the [`Row`].
///
/// [`Row`]: struct.Row.html
- pub fn max_width(mut self, max_width: Length) -> Self {
+ pub fn max_width(mut self, max_width: u32) -> Self {
self.max_width = max_width;
self
}
@@ -82,7 +84,7 @@ impl<Element> Row<Element> {
/// Sets the maximum height of the [`Row`].
///
/// [`Row`]: struct.Row.html
- pub fn max_height(mut self, max_height: Length) -> Self {
+ pub fn max_height(mut self, max_height: u32) -> Self {
self.max_height = max_height;
self
}
diff --git a/core/src/widget/scrollable.rs b/core/src/widget/scrollable.rs
index 31a5abed..c5a2fc59 100644
--- a/core/src/widget/scrollable.rs
+++ b/core/src/widget/scrollable.rs
@@ -1,10 +1,12 @@
use crate::{Align, Column, Length, Point, Rectangle};
+use std::u32;
+
#[derive(Debug)]
pub struct Scrollable<'a, Element> {
pub state: &'a mut State,
pub height: Length,
- pub max_height: Length,
+ pub max_height: u32,
pub align_self: Option<Align>,
pub content: Column<Element>,
}
@@ -14,7 +16,7 @@ impl<'a, Element> Scrollable<'a, Element> {
Scrollable {
state,
height: Length::Shrink,
- max_height: Length::Shrink,
+ max_height: u32::MAX,
align_self: None,
content: Column::new(),
}
@@ -57,7 +59,7 @@ impl<'a, Element> Scrollable<'a, Element> {
/// Sets the maximum width of the [`Scrollable`].
///
/// [`Scrollable`]: struct.Scrollable.html
- pub fn max_width(mut self, max_width: Length) -> Self {
+ pub fn max_width(mut self, max_width: u32) -> Self {
self.content = self.content.max_width(max_width);
self
}
@@ -65,7 +67,7 @@ impl<'a, Element> Scrollable<'a, Element> {
/// Sets the maximum height of the [`Scrollable`] in pixels.
///
/// [`Scrollable`]: struct.Scrollable.html
- pub fn max_height(mut self, max_height: Length) -> Self {
+ pub fn max_height(mut self, max_height: u32) -> Self {
self.max_height = max_height;
self
}