diff options
author | 2019-10-05 03:56:18 +0200 | |
---|---|---|
committer | 2019-10-05 03:56:18 +0200 | |
commit | a7d11944039a1b5ea5b72256e8d15367d99e6010 (patch) | |
tree | 0b90246e3bec0bb28a9a67b9c62af4bf7602cbc6 /native/src/widget.rs | |
parent | 5204cc8c8bc8361a11815d7c711b7da10a6ca8e5 (diff) | |
download | iced-a7d11944039a1b5ea5b72256e8d15367d99e6010.tar.gz iced-a7d11944039a1b5ea5b72256e8d15367d99e6010.tar.bz2 iced-a7d11944039a1b5ea5b72256e8d15367d99e6010.zip |
Add `Renderer` and `Primitive` concepts
Diffstat (limited to 'native/src/widget.rs')
-rw-r--r-- | native/src/widget.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/native/src/widget.rs b/native/src/widget.rs index 9b770454..eff098a6 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -20,13 +20,12 @@ //! //! [`Widget`]: trait.Widget.html //! [renderer]: ../renderer/index.html -mod column; -mod row; - pub mod button; pub mod checkbox; +pub mod column; pub mod image; pub mod radio; +pub mod row; pub mod slider; pub mod text; @@ -47,7 +46,7 @@ pub use slider::Slider; #[doc(no_inline)] pub use text::Text; -use crate::{Event, Hasher, Layout, MouseCursor, Node, Point}; +use crate::{Event, Hasher, Layout, Node, Point}; /// A component that displays information and allows interaction. /// @@ -56,7 +55,10 @@ use crate::{Event, Hasher, Layout, MouseCursor, Node, Point}; /// /// [`Widget`]: trait.Widget.html /// [`Element`]: ../struct.Element.html -pub trait Widget<Message, Renderer>: std::fmt::Debug { +pub trait Widget<Message, Renderer>: std::fmt::Debug +where + Renderer: crate::Renderer, +{ /// Returns the [`Node`] of the [`Widget`]. /// /// This [`Node`] is used by the runtime to compute the [`Layout`] of the @@ -69,16 +71,13 @@ pub trait Widget<Message, Renderer>: std::fmt::Debug { /// Draws the [`Widget`] using the associated `Renderer`. /// - /// It must return the [`MouseCursor`] state for the [`Widget`]. - /// /// [`Widget`]: trait.Widget.html - /// [`MouseCursor`]: ../enum.MouseCursor.html fn draw( &self, renderer: &mut Renderer, layout: Layout<'_>, cursor_position: Point, - ) -> MouseCursor; + ) -> Renderer::Primitive; /// Computes the _layout_ hash of the [`Widget`]. /// |