summaryrefslogtreecommitdiffstats
path: root/native/src/widget.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-11-18 21:55:20 +0100
committerLibravatar GitHub <noreply@github.com>2019-11-18 21:55:20 +0100
commit54ffefcc0b8f4558a93ca51f044594db009bacc8 (patch)
treed915860ee02bb0041ef5aad4660466c5420ca62e /native/src/widget.rs
parent2cbd5d60c46d956fcab685b448a40c1aa5f5b69f (diff)
parent6cdf69e76b8052fb726d5c2bf6c9746182e04d05 (diff)
downloadiced-54ffefcc0b8f4558a93ca51f044594db009bacc8.tar.gz
iced-54ffefcc0b8f4558a93ca51f044594db009bacc8.tar.bz2
iced-54ffefcc0b8f4558a93ca51f044594db009bacc8.zip
Merge pull request #60 from hecrj/fix/required-width-height
Make `width` and `height` in `Widget` required methods
Diffstat (limited to 'native/src/widget.rs')
-rw-r--r--native/src/widget.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/native/src/widget.rs b/native/src/widget.rs
index 9010b06f..ff765ee6 100644
--- a/native/src/widget.rs
+++ b/native/src/widget.rs
@@ -69,6 +69,10 @@ pub trait Widget<Message, Renderer>: std::fmt::Debug
where
Renderer: crate::Renderer,
{
+ fn width(&self) -> Length;
+
+ fn height(&self) -> Length;
+
/// Returns the [`Node`] of the [`Widget`].
///
/// This [`Node`] is used by the runtime to compute the [`Layout`] of the
@@ -83,14 +87,6 @@ where
limits: &layout::Limits,
) -> layout::Node;
- fn width(&self) -> Length {
- Length::Shrink
- }
-
- fn height(&self) -> Length {
- Length::Shrink
- }
-
/// Draws the [`Widget`] using the associated `Renderer`.
///
/// [`Widget`]: trait.Widget.html