From a7d11944039a1b5ea5b72256e8d15367d99e6010 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 5 Oct 2019 03:56:18 +0200 Subject: Add `Renderer` and `Primitive` concepts --- native/src/lib.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'native/src/lib.rs') diff --git a/native/src/lib.rs b/native/src/lib.rs index 39da4943..f6b6f807 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -83,6 +83,10 @@ //! # //! # pub struct Renderer {} //! # +//! # impl iced_native::Renderer for Renderer { +//! # type Primitive = (); +//! # } +//! # //! # impl button::Renderer for Renderer { //! # fn node( //! # &self, @@ -96,9 +100,7 @@ //! # _button: &Button<'_, Message>, //! # _layout: Layout<'_>, //! # _cursor_position: Point, -//! # ) -> MouseCursor { -//! # MouseCursor::OutOfBounds -//! # } +//! # ) {} //! # } //! # //! # impl text::Renderer for Renderer { @@ -192,7 +194,7 @@ //! [documentation]: https://docs.rs/iced //! [examples]: https://github.com/hecrj/iced/tree/master/examples //! [`UserInterface`]: struct.UserInterface.html -#![deny(missing_docs)] +//#![deny(missing_docs)] #![deny(missing_debug_implementations)] #![deny(unused_results)] #![deny(unsafe_code)] @@ -223,6 +225,7 @@ pub use hasher::Hasher; pub use layout::Layout; pub use mouse_cursor::MouseCursor; pub use node::Node; +pub use renderer::Renderer; pub use style::Style; pub use user_interface::{Cache, UserInterface}; pub use widget::*; -- cgit From a90f7fcb987f667a80038a5e72f379abbd59d932 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 5 Oct 2019 03:58:23 +0200 Subject: Move `MouseCursor` to `iced_wgpu` --- native/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'native/src/lib.rs') diff --git a/native/src/lib.rs b/native/src/lib.rs index f6b6f807..6067f49d 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -77,8 +77,7 @@ //! # //! # mod iced_wgpu { //! # use iced_native::{ -//! # button, text, Button, Text, -//! # MouseCursor, Node, Point, Rectangle, Style, Color, Layout +//! # button, text, Button, Text, Node, Point, Rectangle, Style, Color, Layout //! # }; //! # //! # pub struct Renderer {} @@ -207,7 +206,6 @@ mod element; mod event; mod hasher; mod layout; -mod mouse_cursor; mod node; mod style; mod user_interface; @@ -223,7 +221,6 @@ pub use element::Element; pub use event::Event; pub use hasher::Hasher; pub use layout::Layout; -pub use mouse_cursor::MouseCursor; pub use node::Node; pub use renderer::Renderer; pub use style::Style; -- cgit From 10e10e5e06841574425d2633f1c2916733f7b4ff Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 8 Oct 2019 03:13:41 +0200 Subject: Make `iced_core::Button` customizable Now it supports: - Any kind of content - Custom border radius - Custom background --- native/src/lib.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'native/src/lib.rs') diff --git a/native/src/lib.rs b/native/src/lib.rs index 6067f49d..18ce3a37 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -89,14 +89,14 @@ //! # impl button::Renderer for Renderer { //! # fn node( //! # &self, -//! # _button: &Button<'_, Message> +//! # _button: &Button<'_, Message, Self> //! # ) -> Node { //! # Node::new(Style::default()) //! # } //! # //! # fn draw( //! # &mut self, -//! # _button: &Button<'_, Message>, +//! # _button: &Button<'_, Message, Self>, //! # _layout: Layout<'_>, //! # _cursor_position: Point, //! # ) {} @@ -125,7 +125,7 @@ //! .push( //! // The increment button. We tell it to produce an //! // `IncrementPressed` message when pressed -//! Button::new(&mut self.increment_button, "+") +//! Button::new(&mut self.increment_button, Text::new("+")) //! .on_press(Message::IncrementPressed), //! ) //! .push( @@ -135,7 +135,7 @@ //! .push( //! // The decrement button. We tell it to produce a //! // `DecrementPressed` message when pressed -//! Button::new(&mut self.decrement_button, "-") +//! Button::new(&mut self.decrement_button, Text::new("-")) //! .on_press(Message::DecrementPressed), //! ) //! } @@ -212,7 +212,9 @@ mod user_interface; pub(crate) use iced_core::Vector; -pub use iced_core::{Align, Color, Justify, Length, Point, Rectangle}; +pub use iced_core::{ + Align, Background, Color, Justify, Length, Point, Rectangle, +}; #[doc(no_inline)] pub use stretch::{geometry::Size, number::Number}; -- cgit From a92a0b73ed7ed935df762d06c4249894fd35b227 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 9 Oct 2019 05:36:49 +0200 Subject: Move `winit` logic from `iced` to `iced_winit` - Added new `renderer::Windowed` trait. This shoud allow users to easily try different renderers by simply changing one line. - Renamed `UserInterface` traits to `Application`, as the `run` method takes total control of the current thread. - Moved `MouseCursor` back to `iced_native`. The new `renderer::Windowed` trait returns one on `draw`. - Split `iced_native` renderer in multiple modules, for consistency. --- native/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'native/src/lib.rs') diff --git a/native/src/lib.rs b/native/src/lib.rs index 18ce3a37..cada56f9 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -206,6 +206,7 @@ mod element; mod event; mod hasher; mod layout; +mod mouse_cursor; mod node; mod style; mod user_interface; @@ -223,6 +224,7 @@ pub use element::Element; pub use event::Event; pub use hasher::Hasher; pub use layout::Layout; +pub use mouse_cursor::MouseCursor; pub use node::Node; pub use renderer::Renderer; pub use style::Style; -- cgit From 8846a239cf14edd464b1d09f6d6d57ad9b5c9fc7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 11 Oct 2019 22:15:39 +0200 Subject: Rename `Renderer::Primitive` to `Renderer::Output` --- native/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'native/src/lib.rs') diff --git a/native/src/lib.rs b/native/src/lib.rs index cada56f9..fa72a553 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -83,7 +83,7 @@ //! # pub struct Renderer {} //! # //! # impl iced_native::Renderer for Renderer { -//! # type Primitive = (); +//! # type Output = (); //! # } //! # //! # impl button::Renderer for Renderer { -- cgit