From c901f40fd6c5aa39f4dc056b2b59bc7133b287e6 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 14 Apr 2020 12:11:10 +0200 Subject: Introduce `Widget::overlay` :tada: --- native/src/widget.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 4453145b..dd1a97d2 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -67,7 +67,7 @@ pub use text::Text; #[doc(no_inline)] pub use text_input::TextInput; -use crate::{layout, Clipboard, Event, Hasher, Layout, Length, Point}; +use crate::{layout, Clipboard, Event, Hasher, Layout, Length, Overlay, Point}; /// A component that displays information and allows interaction. /// @@ -94,7 +94,7 @@ use crate::{layout, Clipboard, Event, Hasher, Layout, Length, Point}; /// [`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 +pub trait Widget<'a, Message, Renderer> where Renderer: crate::Renderer, { @@ -175,4 +175,8 @@ where _clipboard: Option<&dyn Clipboard>, ) { } + + fn overlay(&mut self) -> Option + 'a>> { + None + } } -- cgit From f064f0482b653a1fbee4afbddcecf91e3a399004 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 16 Apr 2020 13:22:00 +0200 Subject: Introduce `Layer` trait --- native/src/widget.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index dd1a97d2..0494636f 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -176,7 +176,10 @@ where ) { } - fn overlay(&mut self) -> Option + 'a>> { + fn overlay( + &mut self, + _layout: Layout<'_>, + ) -> Option> { None } } -- cgit From afd9274de26ccf65285df02007b4ddb697bea9a3 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 18 Apr 2020 14:42:48 +0200 Subject: Draft `ComboBox` and `Menu` layer --- native/src/widget.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 0494636f..664a0cfd 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -23,6 +23,7 @@ pub mod button; pub mod checkbox; pub mod column; +pub mod combo_box; pub mod container; pub mod image; pub mod pane_grid; @@ -43,6 +44,8 @@ pub use checkbox::Checkbox; #[doc(no_inline)] pub use column::Column; #[doc(no_inline)] +pub use combo_box::ComboBox; +#[doc(no_inline)] pub use container::Container; #[doc(no_inline)] pub use image::Image; -- cgit From 625979b6652a8a14a0eaf6bd62f1e9a8da0ae421 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 5 Jul 2020 05:44:10 +0200 Subject: Draft `Widget::overlay` idempotency --- native/src/widget.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 664a0cfd..4bca7722 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -179,10 +179,10 @@ where ) { } - fn overlay( - &mut self, + fn overlay<'b>( + &'b mut self, _layout: Layout<'_>, - ) -> Option> { + ) -> Option> { None } } -- cgit From 1070b61f3408539f6c9cb9d265f3295e6d055db7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 10 Jul 2020 01:31:56 +0200 Subject: Rename `overlay::Content` trait to `Overlay` The `Overlay` struct is now `overlay::Element`. --- native/src/widget.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 4bca7722..11952018 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -70,7 +70,7 @@ pub use text::Text; #[doc(no_inline)] pub use text_input::TextInput; -use crate::{layout, Clipboard, Event, Hasher, Layout, Length, Overlay, Point}; +use crate::{layout, overlay, Clipboard, Event, Hasher, Layout, Length, Point}; /// A component that displays information and allows interaction. /// @@ -182,7 +182,7 @@ where fn overlay<'b>( &'b mut self, _layout: Layout<'_>, - ) -> Option> { + ) -> Option> { None } } -- cgit From dc0e423142f053c59c326d92920e7829b6852cca Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 10 Jul 2020 02:01:30 +0200 Subject: Remove unnecessary lifetime in `Widget` trait --- native/src/widget.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 11952018..a7f279ed 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -97,7 +97,7 @@ use crate::{layout, overlay, Clipboard, Event, Hasher, Layout, Length, Point}; /// [`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<'a, Message, Renderer> +pub trait Widget where Renderer: crate::Renderer, { @@ -179,10 +179,10 @@ where ) { } - fn overlay<'b>( - &'b mut self, + fn overlay( + &mut self, _layout: Layout<'_>, - ) -> Option> { + ) -> Option> { None } } -- cgit From 2118a726f8b6134820e1ca5b7b802fa1344e453a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 10 Jul 2020 02:39:12 +0200 Subject: Write documentation for the new `overlay` API --- native/src/widget.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index a7f279ed..931b4739 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -179,6 +179,9 @@ where ) { } + /// Returns the overlay of the [`Element`], if there is any. + /// + /// [`Element`]: struct.Element.html fn overlay( &mut self, _layout: Layout<'_>, -- cgit From 73b8ae8e5e7f57c608c775272a2980995ab22bb3 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 10 Jul 2020 02:50:47 +0200 Subject: Rename `ComboBox` to `PickList` --- native/src/widget.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'native/src/widget.rs') diff --git a/native/src/widget.rs b/native/src/widget.rs index 931b4739..8539e519 100644 --- a/native/src/widget.rs +++ b/native/src/widget.rs @@ -23,10 +23,10 @@ pub mod button; pub mod checkbox; pub mod column; -pub mod combo_box; pub mod container; pub mod image; pub mod pane_grid; +pub mod pick_list; pub mod progress_bar; pub mod radio; pub mod row; @@ -44,14 +44,14 @@ pub use checkbox::Checkbox; #[doc(no_inline)] pub use column::Column; #[doc(no_inline)] -pub use combo_box::ComboBox; -#[doc(no_inline)] pub use container::Container; #[doc(no_inline)] pub use image::Image; #[doc(no_inline)] pub use pane_grid::PaneGrid; #[doc(no_inline)] +pub use pick_list::PickList; +#[doc(no_inline)] pub use progress_bar::ProgressBar; #[doc(no_inline)] pub use radio::Radio; -- cgit