Merge branch 'master' into improvement/docs

This commit is contained in:
Héctor Ramón Jiménez 2019-11-21 13:53:02 +01:00
commit 428509c84a
13 changed files with 76 additions and 8 deletions

View File

@ -255,6 +255,14 @@ where
A: Clone, A: Clone,
Renderer: crate::Renderer, Renderer: crate::Renderer,
{ {
fn width(&self) -> Length {
self.widget.width()
}
fn height(&self) -> Length {
self.widget.height()
}
fn layout( fn layout(
&self, &self,
renderer: &Renderer, renderer: &Renderer,
@ -320,6 +328,14 @@ impl<'a, Message, Renderer> Widget<Message, Renderer>
where where
Renderer: crate::Renderer + renderer::Debugger, Renderer: crate::Renderer + renderer::Debugger,
{ {
fn width(&self) -> Length {
self.element.widget.width()
}
fn height(&self) -> Length {
self.element.widget.height()
}
fn layout( fn layout(
&self, &self,
renderer: &Renderer, renderer: &Renderer,

View File

@ -69,6 +69,10 @@ pub trait Widget<Message, Renderer>
where where
Renderer: crate::Renderer, Renderer: crate::Renderer,
{ {
fn width(&self) -> Length;
fn height(&self) -> Length;
/// Returns the [`Node`] of the [`Widget`]. /// Returns the [`Node`] of the [`Widget`].
/// ///
/// This [`Node`] is used by the runtime to compute the [`Layout`] of the /// This [`Node`] is used by the runtime to compute the [`Layout`] of the
@ -83,14 +87,6 @@ where
limits: &layout::Limits, limits: &layout::Limits,
) -> layout::Node; ) -> layout::Node;
fn width(&self) -> Length {
Length::Shrink
}
fn height(&self) -> Length {
Length::Shrink
}
/// Draws the [`Widget`] using the associated `Renderer`. /// Draws the [`Widget`] using the associated `Renderer`.
/// ///
/// [`Widget`]: trait.Widget.html /// [`Widget`]: trait.Widget.html

View File

@ -119,6 +119,14 @@ where
Renderer: self::Renderer, Renderer: self::Renderer,
Message: Clone, Message: Clone,
{ {
fn width(&self) -> Length {
self.width
}
fn height(&self) -> Length {
Length::Shrink
}
fn layout( fn layout(
&self, &self,
renderer: &Renderer, renderer: &Renderer,

View File

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

View File

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

View File

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

View File

@ -58,6 +58,14 @@ impl<Message, Renderer> Widget<Message, Renderer> for Image
where where
Renderer: self::Renderer, Renderer: self::Renderer,
{ {
fn width(&self) -> Length {
self.width
}
fn height(&self) -> Length {
self.height
}
fn layout( fn layout(
&self, &self,
renderer: &Renderer, renderer: &Renderer,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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