From 664251f3f5c7b76f69a97683af1468094bba887f Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 14 May 2022 01:47:55 +0200 Subject: Draft first-class `Theme` support RFC: https://github.com/iced-rs/rfcs/pull/6 --- src/pure/widget.rs | 67 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 29 deletions(-) (limited to 'src/pure/widget.rs') diff --git a/src/pure/widget.rs b/src/pure/widget.rs index c84edde3..1c0a32a6 100644 --- a/src/pure/widget.rs +++ b/src/pure/widget.rs @@ -1,23 +1,24 @@ //! Pure versions of the widgets. /// A container that distributes its contents vertically. -pub type Column<'a, Message> = - iced_pure::widget::Column<'a, Message, crate::Renderer>; +pub type Column<'a, Message, Theme = crate::Theme> = + iced_pure::widget::Column<'a, Message, crate::Renderer>; /// A container that distributes its contents horizontally. -pub type Row<'a, Message> = - iced_pure::widget::Row<'a, Message, crate::Renderer>; +pub type Row<'a, Message, Theme = crate::Theme> = + iced_pure::widget::Row<'a, Message, crate::Renderer>; /// A paragraph of text. -pub type Text = iced_pure::widget::Text; +pub type Text = + iced_pure::widget::Text>; pub mod button { //! Allow your users to perform actions by pressing a button. pub use iced_pure::widget::button::{Style, StyleSheet}; /// A widget that produces a message when clicked. - pub type Button<'a, Message> = - iced_pure::widget::Button<'a, Message, crate::Renderer>; + pub type Button<'a, Message, Theme = crate::Theme> = + iced_pure::widget::Button<'a, Message, crate::Renderer>; } pub mod checkbox { @@ -25,8 +26,8 @@ pub mod checkbox { pub use iced_pure::widget::checkbox::{Style, StyleSheet}; /// A box that can be checked. - pub type Checkbox<'a, Message> = - iced_native::widget::Checkbox<'a, Message, crate::Renderer>; + pub type Checkbox<'a, Message, Theme> = + iced_native::widget::Checkbox<'a, Message, crate::Renderer>; } pub mod container { @@ -34,8 +35,8 @@ pub mod container { pub use iced_pure::widget::container::{Style, StyleSheet}; /// An element decorating some content. - pub type Container<'a, Message> = - iced_pure::widget::Container<'a, Message, crate::Renderer>; + pub type Container<'a, Message, Theme = crate::Theme> = + iced_pure::widget::Container<'a, Message, crate::Renderer>; } pub mod pane_grid { @@ -57,16 +58,24 @@ pub mod pane_grid { /// to completely fill the space available. /// /// [![Pane grid - Iced](https://thumbs.gfycat.com/MixedFlatJellyfish-small.gif)](https://gfycat.com/mixedflatjellyfish) - pub type PaneGrid<'a, Message> = - iced_pure::widget::PaneGrid<'a, Message, crate::Renderer>; + pub type PaneGrid<'a, Message, Theme> = + iced_pure::widget::PaneGrid<'a, Message, crate::Renderer>; /// The content of a [`Pane`]. - pub type Content<'a, Message> = - iced_pure::widget::pane_grid::Content<'a, Message, crate::Renderer>; + pub type Content<'a, Message, Theme> = + iced_pure::widget::pane_grid::Content< + 'a, + Message, + crate::Renderer, + >; /// The title bar of a [`Pane`]. - pub type TitleBar<'a, Message> = - iced_pure::widget::pane_grid::TitleBar<'a, Message, crate::Renderer>; + pub type TitleBar<'a, Message, Theme> = + iced_pure::widget::pane_grid::TitleBar< + 'a, + Message, + crate::Renderer, + >; } pub mod pick_list { @@ -75,8 +84,8 @@ pub mod pick_list { pub use iced_pure::widget::pick_list::{Style, StyleSheet}; /// A widget allowing the selection of a single value from a list of options. - pub type PickList<'a, T, Message> = - iced_pure::widget::PickList<'a, T, Message, crate::Renderer>; + pub type PickList<'a, T, Message, Theme> = + iced_pure::widget::PickList<'a, T, Message, crate::Renderer>; } pub mod radio { @@ -84,8 +93,8 @@ pub mod radio { pub use iced_pure::widget::radio::{Style, StyleSheet}; /// A circular button representing a choice. - pub type Radio<'a, Message> = - iced_pure::widget::Radio<'a, Message, crate::Renderer>; + pub type Radio<'a, Message, Theme> = + iced_pure::widget::Radio<'a, Message, crate::Renderer>; } pub mod scrollable { @@ -94,8 +103,8 @@ pub mod scrollable { /// A widget that can vertically display an infinite amount of content /// with a scrollbar. - pub type Scrollable<'a, Message> = - iced_pure::widget::Scrollable<'a, Message, crate::Renderer>; + pub type Scrollable<'a, Message, Theme> = + iced_pure::widget::Scrollable<'a, Message, crate::Renderer>; } pub mod toggler { @@ -103,8 +112,8 @@ pub mod toggler { pub use iced_pure::widget::toggler::{Style, StyleSheet}; /// A toggler widget. - pub type Toggler<'a, Message> = - iced_pure::widget::Toggler<'a, Message, crate::Renderer>; + pub type Toggler<'a, Message, Theme> = + iced_pure::widget::Toggler<'a, Message, crate::Renderer>; } pub mod text_input { @@ -114,8 +123,8 @@ pub mod text_input { pub use iced_pure::widget::text_input::{Style, StyleSheet}; /// A field that can be filled with text. - pub type TextInput<'a, Message> = - iced_pure::widget::TextInput<'a, Message, Renderer>; + pub type TextInput<'a, Message, Theme> = + iced_pure::widget::TextInput<'a, Message, Renderer>; } pub mod tooltip { @@ -123,8 +132,8 @@ pub mod tooltip { pub use iced_pure::widget::tooltip::Position; /// A widget allowing the selection of a single value from a list of options. - pub type Tooltip<'a, Message> = - iced_pure::widget::Tooltip<'a, Message, crate::Renderer>; + pub type Tooltip<'a, Message, Theme> = + iced_pure::widget::Tooltip<'a, Message, crate::Renderer>; } pub use iced_pure::widget::progress_bar; -- cgit From cf0230072c01ea9523f4d98a3656f5c975b3f347 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 26 May 2022 23:07:34 +0200 Subject: Rename `Variant` to `Style` and `Style` to `Appearance` --- src/pure/widget.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pure/widget.rs') diff --git a/src/pure/widget.rs b/src/pure/widget.rs index 1c0a32a6..e91cf56a 100644 --- a/src/pure/widget.rs +++ b/src/pure/widget.rs @@ -14,7 +14,7 @@ pub type Text = pub mod button { //! Allow your users to perform actions by pressing a button. - pub use iced_pure::widget::button::{Style, StyleSheet}; + pub use iced_pure::widget::button::{Appearance, StyleSheet}; /// A widget that produces a message when clicked. pub type Button<'a, Message, Theme = crate::Theme> = -- cgit From 28d09bfff1dde55190986bab10d7aaeb0ceb49de Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 27 May 2022 01:26:57 +0200 Subject: Implement theme styling for `Radio` --- src/pure/widget.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/pure/widget.rs') diff --git a/src/pure/widget.rs b/src/pure/widget.rs index e91cf56a..04975c0d 100644 --- a/src/pure/widget.rs +++ b/src/pure/widget.rs @@ -90,11 +90,11 @@ pub mod pick_list { pub mod radio { //! Create choices using radio buttons. - pub use iced_pure::widget::radio::{Style, StyleSheet}; + pub use iced_pure::widget::radio::{Appearance, StyleSheet}; /// A circular button representing a choice. - pub type Radio<'a, Message, Theme> = - iced_pure::widget::Radio<'a, Message, crate::Renderer>; + pub type Radio = + iced_pure::widget::Radio>; } pub mod scrollable { -- cgit From 3e2b6247f72815b6e928237f242c2d66478cf15d Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 31 May 2022 05:13:57 +0200 Subject: Implement theme styling for `Toggler` ... and wire up theming to the `styling` example. --- src/pure/widget.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pure/widget.rs') diff --git a/src/pure/widget.rs b/src/pure/widget.rs index 04975c0d..36226109 100644 --- a/src/pure/widget.rs +++ b/src/pure/widget.rs @@ -109,7 +109,7 @@ pub mod scrollable { pub mod toggler { //! Show toggle controls using togglers. - pub use iced_pure::widget::toggler::{Style, StyleSheet}; + pub use iced_pure::widget::toggler::{Appearance, StyleSheet}; /// A toggler widget. pub type Toggler<'a, Message, Theme> = -- cgit From 835877fc636d71c1faaa4826cbfde8e09b3c82ba Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 4 Jun 2022 03:26:53 +0200 Subject: Implement theme styling for `Checkbox` --- src/pure/widget.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pure/widget.rs') diff --git a/src/pure/widget.rs b/src/pure/widget.rs index 36226109..de460bec 100644 --- a/src/pure/widget.rs +++ b/src/pure/widget.rs @@ -23,7 +23,7 @@ pub mod button { pub mod checkbox { //! Show toggle controls using checkboxes. - pub use iced_pure::widget::checkbox::{Style, StyleSheet}; + pub use iced_pure::widget::checkbox::{Appearance, StyleSheet}; /// A box that can be checked. pub type Checkbox<'a, Message, Theme> = -- cgit From ce53d3933c860cd958636cce415ac97c04aee746 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 7 Jun 2022 01:11:35 +0200 Subject: Implement theme styling for `TextInput` --- src/pure/widget.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pure/widget.rs') diff --git a/src/pure/widget.rs b/src/pure/widget.rs index de460bec..6ef9262f 100644 --- a/src/pure/widget.rs +++ b/src/pure/widget.rs @@ -120,7 +120,7 @@ pub mod text_input { //! Display fields that can be filled with text. use crate::Renderer; - pub use iced_pure::widget::text_input::{Style, StyleSheet}; + pub use iced_pure::widget::text_input::{Appearance, StyleSheet}; /// A field that can be filled with text. pub type TextInput<'a, Message, Theme> = -- cgit From 97555e67af8b4bcc77df69c5e72156e14948150e Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 7 Jun 2022 04:11:24 +0200 Subject: Implement theme styling for `Container` --- src/pure/widget.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pure/widget.rs') diff --git a/src/pure/widget.rs b/src/pure/widget.rs index 6ef9262f..a16ff22b 100644 --- a/src/pure/widget.rs +++ b/src/pure/widget.rs @@ -32,7 +32,7 @@ pub mod checkbox { pub mod container { //! Decorate content and apply alignment. - pub use iced_pure::widget::container::{Style, StyleSheet}; + pub use iced_pure::widget::container::{Appearance, StyleSheet}; /// An element decorating some content. pub type Container<'a, Message, Theme = crate::Theme> = -- cgit From 396735b682433928f52ba777891e14f2fbc703c7 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 7 Jun 2022 04:51:44 +0200 Subject: Implement theme styling for `PickList` and `Menu` --- src/pure/widget.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/pure/widget.rs') diff --git a/src/pure/widget.rs b/src/pure/widget.rs index a16ff22b..14cf3512 100644 --- a/src/pure/widget.rs +++ b/src/pure/widget.rs @@ -80,8 +80,7 @@ pub mod pane_grid { pub mod pick_list { //! Display a dropdown list of selectable values. - pub use iced_pure::overlay::menu::Style as Menu; - pub use iced_pure::widget::pick_list::{Style, StyleSheet}; + pub use iced_pure::widget::pick_list::{Appearance, StyleSheet}; /// A widget allowing the selection of a single value from a list of options. pub type PickList<'a, T, Message, Theme> = -- cgit From 2d6d26cef4e3963a59d4c58e4fc811f246e3e794 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 8 Jul 2022 20:49:57 +0200 Subject: Make widget aliases in `iced` compatible with `iced_native` --- src/pure/widget.rs | 69 +++++++++++++++++++++++------------------------------- 1 file changed, 29 insertions(+), 40 deletions(-) (limited to 'src/pure/widget.rs') diff --git a/src/pure/widget.rs b/src/pure/widget.rs index 14cf3512..336f498f 100644 --- a/src/pure/widget.rs +++ b/src/pure/widget.rs @@ -1,24 +1,23 @@ //! Pure versions of the widgets. /// A container that distributes its contents vertically. -pub type Column<'a, Message, Theme = crate::Theme> = - iced_pure::widget::Column<'a, Message, crate::Renderer>; +pub type Column<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Column<'a, Message, Renderer>; /// A container that distributes its contents horizontally. -pub type Row<'a, Message, Theme = crate::Theme> = - iced_pure::widget::Row<'a, Message, crate::Renderer>; +pub type Row<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Row<'a, Message, Renderer>; /// A paragraph of text. -pub type Text = - iced_pure::widget::Text>; +pub type Text = iced_pure::widget::Text; pub mod button { //! Allow your users to perform actions by pressing a button. pub use iced_pure::widget::button::{Appearance, StyleSheet}; /// A widget that produces a message when clicked. - pub type Button<'a, Message, Theme = crate::Theme> = - iced_pure::widget::Button<'a, Message, crate::Renderer>; + pub type Button<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Button<'a, Message, Renderer>; } pub mod checkbox { @@ -26,8 +25,8 @@ pub mod checkbox { pub use iced_pure::widget::checkbox::{Appearance, StyleSheet}; /// A box that can be checked. - pub type Checkbox<'a, Message, Theme> = - iced_native::widget::Checkbox<'a, Message, crate::Renderer>; + pub type Checkbox<'a, Message, Renderer = crate::Renderer> = + iced_native::widget::Checkbox<'a, Message, Renderer>; } pub mod container { @@ -35,8 +34,8 @@ pub mod container { pub use iced_pure::widget::container::{Appearance, StyleSheet}; /// An element decorating some content. - pub type Container<'a, Message, Theme = crate::Theme> = - iced_pure::widget::Container<'a, Message, crate::Renderer>; + pub type Container<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Container<'a, Message, Renderer>; } pub mod pane_grid { @@ -58,24 +57,16 @@ pub mod pane_grid { /// to completely fill the space available. /// /// [![Pane grid - Iced](https://thumbs.gfycat.com/MixedFlatJellyfish-small.gif)](https://gfycat.com/mixedflatjellyfish) - pub type PaneGrid<'a, Message, Theme> = - iced_pure::widget::PaneGrid<'a, Message, crate::Renderer>; + pub type PaneGrid<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::PaneGrid<'a, Message, Renderer>; /// The content of a [`Pane`]. - pub type Content<'a, Message, Theme> = - iced_pure::widget::pane_grid::Content< - 'a, - Message, - crate::Renderer, - >; + pub type Content<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::pane_grid::Content<'a, Message, Renderer>; /// The title bar of a [`Pane`]. - pub type TitleBar<'a, Message, Theme> = - iced_pure::widget::pane_grid::TitleBar< - 'a, - Message, - crate::Renderer, - >; + pub type TitleBar<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::pane_grid::TitleBar<'a, Message, Renderer>; } pub mod pick_list { @@ -83,8 +74,8 @@ pub mod pick_list { pub use iced_pure::widget::pick_list::{Appearance, StyleSheet}; /// A widget allowing the selection of a single value from a list of options. - pub type PickList<'a, T, Message, Theme> = - iced_pure::widget::PickList<'a, T, Message, crate::Renderer>; + pub type PickList<'a, T, Message, Renderer = crate::Renderer> = + iced_pure::widget::PickList<'a, T, Message, Renderer>; } pub mod radio { @@ -92,8 +83,8 @@ pub mod radio { pub use iced_pure::widget::radio::{Appearance, StyleSheet}; /// A circular button representing a choice. - pub type Radio = - iced_pure::widget::Radio>; + pub type Radio = + iced_pure::widget::Radio; } pub mod scrollable { @@ -102,8 +93,8 @@ pub mod scrollable { /// A widget that can vertically display an infinite amount of content /// with a scrollbar. - pub type Scrollable<'a, Message, Theme> = - iced_pure::widget::Scrollable<'a, Message, crate::Renderer>; + pub type Scrollable<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Scrollable<'a, Message, Renderer>; } pub mod toggler { @@ -111,19 +102,17 @@ pub mod toggler { pub use iced_pure::widget::toggler::{Appearance, StyleSheet}; /// A toggler widget. - pub type Toggler<'a, Message, Theme> = - iced_pure::widget::Toggler<'a, Message, crate::Renderer>; + pub type Toggler<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Toggler<'a, Message, Renderer>; } pub mod text_input { //! Display fields that can be filled with text. - use crate::Renderer; - pub use iced_pure::widget::text_input::{Appearance, StyleSheet}; /// A field that can be filled with text. - pub type TextInput<'a, Message, Theme> = - iced_pure::widget::TextInput<'a, Message, Renderer>; + pub type TextInput<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::TextInput<'a, Message, Renderer>; } pub mod tooltip { @@ -131,8 +120,8 @@ pub mod tooltip { pub use iced_pure::widget::tooltip::Position; /// A widget allowing the selection of a single value from a list of options. - pub type Tooltip<'a, Message, Theme> = - iced_pure::widget::Tooltip<'a, Message, crate::Renderer>; + pub type Tooltip<'a, Message, Renderer = crate::Renderer> = + iced_pure::widget::Tooltip<'a, Message, Renderer>; } pub use iced_pure::widget::progress_bar; -- cgit