From 4c44517556976454c0598c876addb10b88515cda Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 1 Apr 2020 04:34:14 +0200 Subject: Fix minor documentation issues --- native/src/widget/pane_grid.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'native') diff --git a/native/src/widget/pane_grid.rs b/native/src/widget/pane_grid.rs index 2eca68d3..ccb46571 100644 --- a/native/src/widget/pane_grid.rs +++ b/native/src/widget/pane_grid.rs @@ -59,12 +59,13 @@ use crate::{ /// /// let (mut state, _) = pane_grid::State::new(PaneState::SomePane); /// -/// let pane_grid = PaneGrid::new(&mut state, |pane, state, focus| { -/// match state { -/// PaneState::SomePane => Text::new("This is some pane"), -/// PaneState::AnotherKindOfPane => Text::new("This is another kind of pane"), -/// }.into() -/// }) +/// let pane_grid = +/// PaneGrid::new(&mut state, |pane, state, focus| { +/// match state { +/// PaneState::SomePane => Text::new("This is some pane"), +/// PaneState::AnotherKindOfPane => Text::new("This is another kind of pane"), +/// }.into() +/// }) /// .on_drag(Message::PaneDragged) /// .on_resize(Message::PaneResized); /// ``` -- cgit From 1f85e1167c6fc2249647a42ada06ca5e2ba8f94c Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Apr 2020 02:35:23 +0200 Subject: Add examples to `iced_native::Widget` --- native/src/widget.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'native') 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 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, -- cgit From 1b0cb0d13ab2854de9da0f30e20b92a5159c244e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Apr 2020 02:35:36 +0200 Subject: Add example to `iced_native::UserInterface` --- native/src/user_interface.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'native') diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 08914bed..5d9221e9 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -12,6 +12,13 @@ use std::hash::Hasher; /// charge of using this type in your system in any way you want. /// /// [`Layout`]: struct.Layout.html +/// +/// # Example +/// The [`integration` example] uses a [`UserInterface`] to integrate Iced in +/// an existing graphical application. +/// +/// [`integration` example]: https://github.com/hecrj/iced/tree/0.1/examples/integration +/// [`UserInterface`]: struct.UserInterface.html #[allow(missing_debug_implementations)] pub struct UserInterface<'a, Message, Renderer> { hash: u64, -- cgit From c114be034a1f35a83b044c0b18f0359165db8c15 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Apr 2020 03:22:33 +0200 Subject: Fix typo in `text_input::Renderer::draw` docs --- native/src/widget/text_input.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'native') diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index b4ba5afa..1c07e252 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -562,7 +562,7 @@ pub trait Renderer: crate::Renderer + Sized { /// Draws a [`TextInput`]. /// /// It receives: - /// - its bounds of the [`TextInput`] + /// - the bounds of the [`TextInput`] /// - the bounds of the text (i.e. the current value) /// - the cursor position /// - the placeholder to show when the value is empty -- cgit From 703f7657e15234554afb5c62fafed6fd4f8d1d03 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Apr 2020 03:29:46 +0200 Subject: Add example to `pane_grid` module documentation --- native/src/widget/pane_grid.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'native') diff --git a/native/src/widget/pane_grid.rs b/native/src/widget/pane_grid.rs index ccb46571..f6dd328e 100644 --- a/native/src/widget/pane_grid.rs +++ b/native/src/widget/pane_grid.rs @@ -1,6 +1,13 @@ //! Let your users split regions of your application and organize layout dynamically. //! //! [![Pane grid - Iced](https://thumbs.gfycat.com/MixedFlatJellyfish-small.gif)](https://gfycat.com/mixedflatjellyfish) +//! +//! # Example +//! The [`pane_grid` example] showcases how to use a [`PaneGrid`] with resizing, +//! drag and drop, and hotkey support. +//! +//! [`pane_grid` example]: https://github.com/hecrj/iced/tree/0.1/examples/pane_grid +//! [`PaneGrid`]: struct.PaneGrid.html mod axis; mod direction; mod node; -- cgit From 2ef1b4317a6d8a99cb9d9653597e09666bd9ea81 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Apr 2020 03:37:56 +0200 Subject: Remove subcrates `CHANGELOG` At this stage, it is important to allow the library to change rapidly. Because of this, keeping a log of changes can be counter-productive. We do not want pin down design decisions by writing detailed changelogs (sunk cost fallacy). Once the library and its different parts start becoming more stable and mature, we will reintroduce changelogs accordingly. For now, we will keep a main `CHANGELOG` file just for the `iced` crate. --- native/CHANGELOG.md | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 native/CHANGELOG.md (limited to 'native') diff --git a/native/CHANGELOG.md b/native/CHANGELOG.md deleted file mode 100644 index df8852b7..00000000 --- a/native/CHANGELOG.md +++ /dev/null @@ -1,38 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] -### Added -- `image::Handle` type with `from_path` and `from_memory` methods. [#90] -- `image::Data` enum representing different kinds of image data. [#90] -- `text_input::Renderer::measure_value` required method to measure the width of a `TextInput` value. [#108] -- Click-based cursor positioning for `TextInput`. [#108] -- `Home` and `End` keys support for `TextInput`. [#108] -- `Ctrl+Left` and `Ctrl+Right` cursor word jump for `TextInput`. [#108] -- `keyboard::ModifiersState` struct which contains the state of the keyboard modifiers. [#108] -- `TextInput::password` method to enable secure password input mode. [#113] -- `Button::height` and `Button::min_height` methods to control the height of a button. - -### Changed -- `Image::new` takes an `Into` now instead of an `Into`. [#90] -- `Button::background` takes an `Into` now instead of a `Background`. -- `keyboard::Event::Input` now contains key modifiers state. [#108] - -### Fixed -- `Image` widget not keeping aspect ratio consistently. [#90] -- `TextInput` not taking grapheme clusters into account. [#108] - -[#90]: https://github.com/hecrj/iced/pull/90 -[#108]: https://github.com/hecrj/iced/pull/108 -[#113]: https://github.com/hecrj/iced/pull/113 - - -## [0.1.0] - 2019-11-25 -### Added -- First release! :tada: - -[Unreleased]: https://github.com/hecrj/iced/compare/native-0.1.0...HEAD -[0.1.0]: https://github.com/hecrj/iced/releases/tag/native-0.1.0 -- cgit From 4a498ed0e3d0526ce9f47b7eefa0b2716f9b27a8 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 2 Apr 2020 03:58:47 +0200 Subject: Fix `window::Renderer` link in `iced_winit` docs --- native/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'native') diff --git a/native/src/lib.rs b/native/src/lib.rs index d17dd918..89612391 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -14,7 +14,7 @@ //! - A [`Widget`] trait, which is used to implement new widgets: from layout //! requirements to event and drawing logic. //! - A bunch of `Renderer` traits, meant to keep the crate renderer-agnostic. -//! - A [`window::Renderer`] trait, leveraging [`raw-window-handle`], which can be +//! - A [`window::Backend`] trait, leveraging [`raw-window-handle`], which can be //! implemented by graphical renderers that target _windows_. Window-based //! shells (like [`iced_winit`]) can use this trait to stay renderer-agnostic. //! @@ -31,7 +31,7 @@ //! [`druid`]: https://github.com/xi-editor/druid //! [`raw-window-handle`]: https://github.com/rust-windowing/raw-window-handle //! [`Widget`]: widget/trait.Widget.html -//! [`window::Renderer`]: window/trait.Renderer.html +//! [`window::Backend`]: window/trait.Backend.html //! [`UserInterface`]: struct.UserInterface.html //! [renderer]: renderer/index.html #![deny(missing_docs)] -- cgit