summaryrefslogtreecommitdiffstats
path: root/native/src/widget.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-02 02:35:23 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-02 03:44:14 +0200
commit1f85e1167c6fc2249647a42ada06ca5e2ba8f94c (patch)
tree2832fa6c9102af0ef6fafd7ec2d4b211af6db61d /native/src/widget.rs
parent512dbd5076a7718077db81c1d3cb22d3a580b557 (diff)
downloadiced-1f85e1167c6fc2249647a42ada06ca5e2ba8f94c.tar.gz
iced-1f85e1167c6fc2249647a42ada06ca5e2ba8f94c.tar.bz2
iced-1f85e1167c6fc2249647a42ada06ca5e2ba8f94c.zip
Add examples to `iced_native::Widget`
Diffstat (limited to 'native/src/widget.rs')
-rw-r--r--native/src/widget.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/native/src/widget.rs b/native/src/widget.rs
index 88f819c9..4453145b 100644
--- a/native/src/widget.rs
+++ b/native/src/widget.rs
@@ -76,6 +76,24 @@ use crate::{layout, Clipboard, Event, Hasher, Layout, Length, Point};
///
/// [`Widget`]: trait.Widget.html
/// [`Element`]: ../struct.Element.html
+///
+/// # Examples
+/// The repository has some [examples] showcasing how to implement a custom
+/// widget:
+///
+/// - [`bezier_tool`], a Paint-like tool for drawing Bézier curves using
+/// [`lyon`].
+/// - [`custom_widget`], a demonstration of how to build a custom widget that
+/// draws a circle.
+/// - [`geometry`], a custom widget showcasing how to draw geometry with the
+/// `Mesh2D` primitive in [`iced_wgpu`].
+///
+/// [examples]: https://github.com/hecrj/iced/tree/0.1/examples
+/// [`bezier_tool`]: https://github.com/hecrj/iced/tree/0.1/examples/bezier_tool
+/// [`custom_widget`]: https://github.com/hecrj/iced/tree/0.1/examples/custom_widget
+/// [`geometry`]: https://github.com/hecrj/iced/tree/0.1/examples/geometry
+/// [`lyon`]: https://github.com/nical/lyon
+/// [`iced_wgpu`]: https://github.com/hecrj/iced/tree/0.1/wgpu
pub trait Widget<Message, Renderer>
where
Renderer: crate::Renderer,
@@ -139,12 +157,14 @@ where
/// * a mutable `Message` list, allowing the [`Widget`] to produce
/// new messages based on user interaction.
/// * the `Renderer`
+ /// * a [`Clipboard`], if available
///
/// By default, it does nothing.
///
/// [`Event`]: ../enum.Event.html
/// [`Widget`]: trait.Widget.html
/// [`Layout`]: ../layout/struct.Layout.html
+ /// [`Clipboard`]: ../trait.Clipboard.html
fn on_event(
&mut self,
_event: Event,