summaryrefslogtreecommitdiffstats
path: root/native/src/element.rs
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/element.rs')
-rw-r--r--native/src/element.rs64
1 files changed, 39 insertions, 25 deletions
diff --git a/native/src/element.rs b/native/src/element.rs
index 3bf24317..5335fdc1 100644
--- a/native/src/element.rs
+++ b/native/src/element.rs
@@ -33,31 +33,6 @@ where
}
}
- pub fn width(&self) -> Length {
- self.widget.width()
- }
-
- pub fn height(&self) -> Length {
- self.widget.height()
- }
-
- pub fn layout(
- &self,
- renderer: &Renderer,
- limits: &layout::Limits,
- ) -> layout::Node {
- self.widget.layout(renderer, limits)
- }
-
- pub fn draw(
- &self,
- renderer: &mut Renderer,
- layout: Layout<'_>,
- cursor_position: Point,
- ) -> Renderer::Output {
- self.widget.draw(renderer, layout, cursor_position)
- }
-
/// Applies a transformation to the produced message of the [`Element`].
///
/// This method is useful when you want to decouple different parts of your
@@ -225,6 +200,45 @@ where
}
}
+ /// Returns the width of the [`Element`].
+ ///
+ /// [`Element`]: struct.Element.html
+ pub fn width(&self) -> Length {
+ self.widget.width()
+ }
+
+ /// Returns the height of the [`Element`].
+ ///
+ /// [`Element`]: struct.Element.html
+ pub fn height(&self) -> Length {
+ self.widget.height()
+ }
+
+ /// Computes the layout of the [`Element`] in the given [`Limits`].
+ ///
+ /// [`Element`]: struct.Element.html
+ /// [`Limits`]: layout/struct.Limits.html
+ pub fn layout(
+ &self,
+ renderer: &Renderer,
+ limits: &layout::Limits,
+ ) -> layout::Node {
+ self.widget.layout(renderer, limits)
+ }
+
+ /// Draws the [`Element`] and its children using the given [`Layout`].
+ ///
+ /// [`Element`]: struct.Element.html
+ /// [`Layout`]: layout/struct.Layout.html
+ pub fn draw(
+ &self,
+ renderer: &mut Renderer,
+ layout: Layout<'_>,
+ cursor_position: Point,
+ ) -> Renderer::Output {
+ self.widget.draw(renderer, layout, cursor_position)
+ }
+
pub(crate) fn hash_layout(&self, state: &mut Hasher) {
self.widget.hash_layout(state);
}