From 03b34931383e701c39c653a7662a616fe21a0947 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 14 Oct 2021 16:07:22 +0700 Subject: Remove trait-specific draw logic in `iced_native` --- native/src/widget.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 43c1b023..01c5bed3 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -135,7 +135,7 @@ where layout: Layout<'_>, cursor_position: Point, viewport: &Rectangle, - ) -> Renderer::Output; + ); /// Computes the _layout_ hash of the [`Widget`]. /// -- cgit From edea093350e1b576e2b7db50c525e7fa5c3bea9f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 18 Oct 2021 15:19:04 +0700 Subject: Move `Defaults` from `iced_graphics` to `iced_native` --- native/src/widget.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 01c5bed3..9a494771 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -81,6 +81,7 @@ pub use tooltip::Tooltip; use crate::event::{self, Event}; use crate::layout; use crate::overlay; +use crate::renderer; use crate::{Clipboard, Hasher, Layout, Length, Point, Rectangle}; /// A component that displays information and allows interaction. @@ -131,7 +132,7 @@ where fn draw( &self, renderer: &mut Renderer, - defaults: &Renderer::Defaults, + style: &renderer::Style, layout: Layout<'_>, cursor_position: Point, viewport: &Rectangle, -- cgit From be97a5d502df8c8b23704f5a8a0d425f4eff2215 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Mon, 18 Oct 2021 16:43:18 +0700 Subject: Introduce `mouse_interaction` method to `Widget` trait --- native/src/widget.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 9a494771..9999701e 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -80,6 +80,7 @@ pub use tooltip::Tooltip; use crate::event::{self, Event}; use crate::layout; +use crate::mouse; use crate::overlay; use crate::renderer; use crate::{Clipboard, Hasher, Layout, Length, Point, Rectangle}; @@ -175,6 +176,18 @@ where event::Status::Ignored } + /// Returns the current [`mouse::Interaction`] of the [`Widget`]. + /// + /// By default, it returns [`mouse::Interaction::Idle`]. + fn mouse_interaction( + &self, + _layout: Layout<'_>, + _viewport: &Rectangle, + _cursor_position: Point, + ) -> mouse::Interaction { + mouse::Interaction::Idle + } + /// Returns the overlay of the [`Widget`], if there is any. fn overlay( &mut self, -- cgit From 0aafcde0ef1533c9eeba0379de8c0082e30c7504 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 31 Oct 2021 15:35:12 +0700 Subject: Remove `widget` module re-exports in `iced_native` --- native/src/widget.rs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 9999701e..6a2bbfbd 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -10,14 +10,6 @@ //! [`Widget`] trait. You can use the API of the built-in widgets as a guide or //! source of inspiration. //! -//! # Re-exports -//! For convenience, the contents of this module are available at the root -//! module. Therefore, you can directly type: -//! -//! ``` -//! use iced_native::{button, Button, Widget}; -//! ``` -//! //! [renderer]: crate::renderer pub mod button; pub mod checkbox; -- cgit From 631e95ee0be01dc7f5e5183e1429972aee37787f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 2 Nov 2021 15:03:29 +0700 Subject: Move `viewport` argument to last position in `mouse_interaction` methods This keeps the order of the arguments consistent with `draw`. --- native/src/widget.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 6a2bbfbd..07214b16 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -174,8 +174,8 @@ where fn mouse_interaction( &self, _layout: Layout<'_>, - _viewport: &Rectangle, _cursor_position: Point, + _viewport: &Rectangle, ) -> mouse::Interaction { mouse::Interaction::Idle } -- cgit