diff options
| author | 2019-11-10 06:05:20 +0100 | |
|---|---|---|
| committer | 2019-11-11 03:08:00 +0100 | |
| commit | 0240c3981b716c82ecb3364945815335b420a63e (patch) | |
| tree | 441eebaa9441649a4e878bde71cdec20d4a67391 /native/src/widget.rs | |
| parent | 2303111e09d806ef2a652bddc2b73be6dccf6ae2 (diff) | |
| download | iced-0240c3981b716c82ecb3364945815335b420a63e.tar.gz iced-0240c3981b716c82ecb3364945815335b420a63e.tar.bz2 iced-0240c3981b716c82ecb3364945815335b420a63e.zip | |
Draft custom layout engine based on `druid`
Diffstat (limited to 'native/src/widget.rs')
| -rw-r--r-- | native/src/widget.rs | 20 | 
1 files changed, 16 insertions, 4 deletions
| diff --git a/native/src/widget.rs b/native/src/widget.rs index 0dfd5fd7..2d6d347f 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -52,7 +52,7 @@ pub use text::Text;  #[doc(no_inline)]  pub use text_input::TextInput; -use crate::{layout, Event, Hasher, Layout, Point}; +use crate::{layout, Event, Hasher, Layout, Length, Point};  /// A component that displays information and allows interaction.  /// @@ -73,7 +73,19 @@ where      /// [`Node`]: ../struct.Node.html      /// [`Widget`]: trait.Widget.html      /// [`Layout`]: ../struct.Layout.html -    fn layout(&self, renderer: &Renderer, limits: &layout::Limits) -> Layout; +    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`.      /// @@ -81,7 +93,7 @@ where      fn draw(          &self,          renderer: &mut Renderer, -        layout: &Layout, +        layout: Layout<'_>,          cursor_position: Point,      ) -> Renderer::Output; @@ -117,7 +129,7 @@ where      fn on_event(          &mut self,          _event: Event, -        _layout: &Layout, +        _layout: Layout<'_>,          _cursor_position: Point,          _messages: &mut Vec<Message>,          _renderer: &Renderer, | 
