Make width and height required methods

This commit is contained in:
Héctor Ramón Jiménez 2019-11-16 22:08:49 +01:00
parent 2cbd5d60c4
commit 6cdf69e76b
13 changed files with 78 additions and 10 deletions

View file

@ -7,7 +7,7 @@
//! [`Class`]: enum.Class.html
use crate::input::{mouse, ButtonState};
use crate::{layout, Element, Event, Hasher, Layout, Point, Widget};
use crate::{layout, Element, Event, Hasher, Layout, Length, Point, Widget};
use std::hash::Hash;
pub use iced_core::button::State;
@ -21,6 +21,14 @@ where
Renderer: self::Renderer,
Message: Clone + std::fmt::Debug,
{
fn width(&self) -> Length {
self.width
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout(
&self,
renderer: &Renderer,

View file

@ -14,6 +14,10 @@ where
Length::Fill
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout(
&self,
renderer: &Renderer,

View file

@ -15,6 +15,10 @@ where
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View file

@ -15,6 +15,10 @@ where
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View file

@ -1,6 +1,6 @@
//! Display images in your user interface.
use crate::{layout, Element, Hasher, Layout, Point, Widget};
use crate::{layout, Element, Hasher, Layout, Length, Point, Widget};
use std::hash::Hash;
@ -10,6 +10,14 @@ impl<Message, Renderer> Widget<Message, Renderer> for Image
where
Renderer: self::Renderer,
{
fn width(&self) -> Length {
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View file

@ -15,6 +15,10 @@ where
Length::Fill
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout(
&self,
renderer: &Renderer,

View file

@ -15,6 +15,10 @@ where
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View file

@ -21,6 +21,14 @@ impl<'a, Message, Renderer> Widget<Message, Renderer>
where
Renderer: self::Renderer + column::Renderer,
{
fn width(&self) -> Length {
Length::Fill
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View file

@ -19,6 +19,10 @@ where
self.width
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout(
&self,
renderer: &Renderer,

View file

@ -13,6 +13,10 @@ where
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout(
&self,
renderer: &Renderer,

View file

@ -15,6 +15,10 @@ where
self.width
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout(
&self,
renderer: &Renderer,