diff options
author | 2019-11-14 06:46:50 +0100 | |
---|---|---|
committer | 2019-11-14 06:46:50 +0100 | |
commit | bc8d347736ec997ec0e0c401289e2bc09e212b8a (patch) | |
tree | b98798c09a3aa914b7d0869fba0cfd3efff7754f /native/src/widget.rs | |
parent | 839e039dbf2fb89dcb8c141503740777d2af2eb3 (diff) | |
parent | 73f3c900071f950ea914652ca3f0002c1e173f61 (diff) | |
download | iced-bc8d347736ec997ec0e0c401289e2bc09e212b8a.tar.gz iced-bc8d347736ec997ec0e0c401289e2bc09e212b8a.tar.bz2 iced-bc8d347736ec997ec0e0c401289e2bc09e212b8a.zip |
Merge pull request #52 from hecrj/custom-layout-engine
Custom layout engine
Diffstat (limited to 'native/src/widget.rs')
-rw-r--r-- | native/src/widget.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/native/src/widget.rs b/native/src/widget.rs index 01f5c92e..9010b06f 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -31,6 +31,8 @@ pub mod slider; pub mod text; pub mod text_input; +mod container; + #[doc(no_inline)] pub use button::Button; #[doc(no_inline)] @@ -38,6 +40,8 @@ pub use checkbox::Checkbox; #[doc(no_inline)] pub use column::Column; #[doc(no_inline)] +pub use container::Container; +#[doc(no_inline)] pub use image::Image; #[doc(no_inline)] pub use radio::Radio; @@ -52,7 +56,7 @@ pub use text::Text; #[doc(no_inline)] pub use text_input::TextInput; -use crate::{Event, Hasher, Layout, Node, Point}; +use crate::{layout, Event, Hasher, Layout, Length, Point}; /// A component that displays information and allows interaction. /// @@ -73,7 +77,19 @@ where /// [`Node`]: ../struct.Node.html /// [`Widget`]: trait.Widget.html /// [`Layout`]: ../struct.Layout.html - fn node(&self, renderer: &Renderer) -> Node; + fn layout( + &self, + renderer: &Renderer, + limits: &layout::Limits, + ) -> layout::Node; + + fn width(&self) -> Length { + Length::Shrink + } + + fn height(&self) -> Length { + Length::Shrink + } /// Draws the [`Widget`] using the associated `Renderer`. /// |