summaryrefslogtreecommitdiffstats
path: root/native/src/widget.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2019-10-23 04:52:51 +0200
committerLibravatar GitHub <noreply@github.com>2019-10-23 04:52:51 +0200
commit4769272122e8cd0a4d666bb06c00cb27f8cad3c4 (patch)
tree68e513170347d804f55b3743f1fd960bbf700950 /native/src/widget.rs
parente95e656fcd780264f7a3c9a2ba3d0bd471d4894e (diff)
parent99e1a3780a1ea3ccb173d1fb4cbe889bb08b9643 (diff)
downloadiced-4769272122e8cd0a4d666bb06c00cb27f8cad3c4.tar.gz
iced-4769272122e8cd0a4d666bb06c00cb27f8cad3c4.tar.bz2
iced-4769272122e8cd0a4d666bb06c00cb27f8cad3c4.zip
Merge pull request #22 from hecrj/basic-renderer
Basic `wgpu` renderer
Diffstat (limited to 'native/src/widget.rs')
-rw-r--r--native/src/widget.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/native/src/widget.rs b/native/src/widget.rs
index 9b770454..bcef2665 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
@@ -65,20 +67,17 @@ pub trait Widget<Message, Renderer>: std::fmt::Debug {
/// [`Node`]: ../struct.Node.html
/// [`Widget`]: trait.Widget.html
/// [`Layout`]: ../struct.Layout.html
- fn node(&self, renderer: &mut Renderer) -> Node;
+ fn node(&self, renderer: &Renderer) -> Node;
/// 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::Output;
/// Computes the _layout_ hash of the [`Widget`].
///