diff --git a/Cargo.toml b/Cargo.toml index 678e3e4f..ba72a263 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,8 +18,8 @@ categories = ["gui"] badge = [] card = [] date_picker = ["chrono", "once_cell", "icons"] -color_picker = ["icons", "iced_widget/canvas"] -cupertino = ["iced_widget/canvas", "time"] +color_picker = ["icons", "iced/canvas"] +cupertino = ["time", "iced/canvas"] floating_element = [] grid = ["itertools"] glow = [] # TODO @@ -27,7 +27,7 @@ icons = [] modal = [] tab_bar = [] tabs = ["tab_bar"] -time_picker = ["chrono", "icons", "iced_widget/canvas"] +time_picker = ["chrono", "icons", "iced/canvas"] wrap = [] number_input = ["num-traits"] selection_list = [] @@ -71,11 +71,11 @@ chrono = { version = "0.4.26", optional = true } once_cell = { version = "1.18.0", optional = true } itertools = { version = "0.11.0", optional = true } - -[dependencies.iced_widget] -git = "https://github.com/iced-rs/iced.git" +[dependencies.iced] +#git = "https://github.com/iced-rs/iced.git" #rev = "b474a2b7a763dcde6a377cb409001a7b5285ee8d" -#version = "0.1.1" +version = "0.12.0" +features = ["advanced", "lazy", "tokio",] [profile.dev.package."*"] opt-level = 2 @@ -97,10 +97,10 @@ members = [ "examples/tabs", "examples/time_picker", "examples/sliderbar", - "examples/wrap", + #"examples/wrap", "examples/selection_list", "examples/split", - "examples/split_scroller", + #"examples/split_scroller", "examples/context_menu", "examples/spinner", "examples/cupertino/cupertino_button", @@ -112,10 +112,10 @@ members = [ ] [workspace.dependencies.iced] -git = "https://github.com/iced-rs/iced.git" +#git = "https://github.com/iced-rs/iced.git" #rev = "b474a2b7a763dcde6a377cb409001a7b5285ee8d" -#version = "0.10.0" -features = ["advanced", "lazy", "tokio"] +version = "0.12.0" +features = ["advanced", "lazy", "tokio", "canvas"] [workspace.dependencies.iced_aw] path = "./" diff --git a/examples/multiple_modals/src/main.rs b/examples/multiple_modals/src/main.rs index c7287bf8..0d74475a 100644 --- a/examples/multiple_modals/src/main.rs +++ b/examples/multiple_modals/src/main.rs @@ -169,9 +169,11 @@ impl Application for MultipleModalsExample { match foot_row { Some(foot_row) => container( column![ - vertical_space(Length::Fill), + //vertical_space(Length::Fill), + vertical_space(), text(body_string), - vertical_space(Length::Fill), + //vertical_space(Length::Fill), + vertical_space(), foot_row.spacing(20) ] .spacing(20) diff --git a/examples/split_scroller/src/main.rs b/examples/split_scroller/src/main.rs index 49aac80f..7b7c545f 100644 --- a/examples/split_scroller/src/main.rs +++ b/examples/split_scroller/src/main.rs @@ -367,9 +367,11 @@ mod demo { column![ scroll_to_end_button(), text("Beginning!"), - vertical_space(1200), + //vertical_space(1200), + vertical_space(), text("Middle!"), - vertical_space(1200), + //vertical_space(1200), + vertical_space(), text("End!"), scroll_to_beginning_button(), ] @@ -391,9 +393,11 @@ mod demo { row![ scroll_to_end_button(), text("Beginning!"), - horizontal_space(1200), + //horizontal_space(1200), + horizontal_space(), text("Middle!"), - horizontal_space(1200), + //horizontal_space(1200), + horizontal_space(), text("End!"), scroll_to_beginning_button(), ] @@ -415,24 +419,33 @@ mod demo { Direction::Multi => scrollable( //horizontal content row![ - column![text("Let's do some scrolling!"), vertical_space(2400)], + column![ + text("Let's do some scrolling!"), + //vertical_space(2400), + vertical_space(), + ], scroll_to_end_button(), text("Horizontal - Beginning!"), - horizontal_space(1200), + //horizontal_space(1200), + horizontal_space(), //vertical content column![ text("Horizontal - Middle!"), scroll_to_end_button(), text("Vertical - Beginning!"), - vertical_space(1200), + //vertical_space(1200), + vertical_space(), text("Vertical - Middle!"), - vertical_space(1200), + //vertical_space(1200), + vertical_space(), text("Vertical - End!"), scroll_to_beginning_button(), - vertical_space(40), + //vertical_space(40), + vertical_space(), ] .spacing(40), - horizontal_space(1200), + //horizontal_space(1200), + horizontal_space(), text("Horizontal - End!"), scroll_to_beginning_button(), ] diff --git a/examples/tabs/src/login.rs b/examples/tabs/src/login.rs index befe8c72..1cb27916 100644 --- a/examples/tabs/src/login.rs +++ b/examples/tabs/src/login.rs @@ -71,7 +71,7 @@ impl Tab for LoginTab { .on_input(LoginMessage::PasswordChanged) .padding(10) .size(32) - .password(), + .secure(true), ) .push( Row::new() diff --git a/src/core/clock.rs b/src/core/clock.rs index 821e45d7..ebe9c894 100644 --- a/src/core/clock.rs +++ b/src/core/clock.rs @@ -1,6 +1,6 @@ //! Helper functions for calculating the clock -use iced_widget::core::Point; +use iced::Point; use std::fmt::Display; /// The size of the period on the clock based on the clock's size. @@ -123,7 +123,7 @@ pub fn nearest_radius( #[cfg(test)] mod tests { - use iced_widget::core::{Point, Vector}; + use iced::{Point, Vector}; use super::{circle_points, nearest_point, nearest_radius, NearestRadius}; diff --git a/src/core/color.rs b/src/core/color.rs index 658dac93..cb9206ce 100644 --- a/src/core/color.rs +++ b/src/core/color.rs @@ -1,6 +1,6 @@ //! Helper functions and structs for picking dates. -use iced_widget::core::Color; +use iced::Color; /// A color in the HSV color space. #[derive(Clone, Copy, Debug, PartialEq)] @@ -99,7 +99,7 @@ impl From for Color { #[cfg(test)] mod tests { - use iced_widget::core::Color; + use iced::Color; use super::Hsv; diff --git a/src/core/overlay.rs b/src/core/overlay.rs index b427119a..9257cfa0 100644 --- a/src/core/overlay.rs +++ b/src/core/overlay.rs @@ -1,6 +1,6 @@ //! Helper functions for overlays -use iced_widget::core::{layout, Point, Size}; +use iced::{advanced::layout, Point, Size}; /// Trait containing functions for positioning of nodes. pub trait Position { diff --git a/src/core/renderer.rs b/src/core/renderer.rs index bfae4cf0..ffaaf4e0 100644 --- a/src/core/renderer.rs +++ b/src/core/renderer.rs @@ -1,6 +1,6 @@ //! Helper struct for drawing -use iced_widget::core::{Layout, Point, Rectangle}; +use iced::{advanced::Layout, Point, Rectangle}; /// Collection of all necessary data to draw a widget. #[derive(Debug)] diff --git a/src/graphics/icons.rs b/src/graphics/icons.rs index 334ed50c..b03a5b6f 100644 --- a/src/graphics/icons.rs +++ b/src/graphics/icons.rs @@ -1,7 +1,7 @@ //! The default icon font of the widgets of this library. use cfg_if::cfg_if; -use iced_widget::core::Font; +use iced::Font; cfg_if! { if #[cfg(feature = "icons")] { diff --git a/src/graphics/mod.rs b/src/graphics/mod.rs index fc0a948b..d40f7be2 100644 --- a/src/graphics/mod.rs +++ b/src/graphics/mod.rs @@ -8,5 +8,4 @@ pub const SF_UI_ROUNDED_BYTES: &[u8] = include_bytes!("./fonts/SFUIRounded.ttf") /// The default cupertino font for alerts and button. #[cfg(feature = "cupertino")] -pub const SF_UI_ROUNDED: iced_widget::core::Font = - iced_widget::core::Font::with_name(".SF UI Rounded"); +pub const SF_UI_ROUNDED: iced::Font = iced::Font::with_name(".SF UI Rounded"); diff --git a/src/lib.rs b/src/lib.rs index 0e3f7864..b8a2982b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -53,7 +53,7 @@ pub mod native; pub mod core; pub mod style; -pub use iced_widget::core::Element; +pub use iced::Element; /// Exports for all platforms that are not WASM32. mod platform { diff --git a/src/native/badge.rs b/src/native/badge.rs index 092cdc07..ae507776 100644 --- a/src/native/badge.rs +++ b/src/native/badge.rs @@ -1,14 +1,18 @@ //! Use a badge for color highlighting important information. //! //! *This API requires the following crate features to be activated: badge* -use iced_widget::core::{ - self, event, - layout::{Limits, Node}, + +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + renderer, + widget::Tree, + Clipboard, Layout, Shell, Widget, + }, + event, mouse::{self, Cursor}, - renderer, - widget::tree::Tree, - Alignment, Border, Clipboard, Color, Element, Event, Layout, Length, Padding, Point, Rectangle, - Shadow, Shell, Size, Widget, + Alignment, Border, Color, Element, Event, Length, Padding, Point, Rectangle, Shadow, Size, }; pub use crate::style::badge::{Appearance, StyleSheet}; @@ -30,9 +34,9 @@ const BORDER_RADIUS_RATIO: f32 = 34.0 / 15.0; /// let badge = Badge::::new(Text::new("Text")); /// ``` #[allow(missing_debug_implementations)] -pub struct Badge<'a, Message, Theme = iced_widget::Theme, Renderer = iced_widget::Renderer> +pub struct Badge<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// The padding of the [`Badge`]. @@ -53,7 +57,7 @@ where impl<'a, Message, Theme, Renderer> Badge<'a, Message, Theme, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// Creates a new [`Badge`] with the given content. @@ -122,7 +126,7 @@ impl<'a, Message, Theme, Renderer> Widget for Badge<'a, Message, Theme, Renderer> where Message: 'a + Clone, - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: StyleSheet, { fn children(&self) -> Vec { @@ -263,7 +267,7 @@ impl<'a, Message, Theme, Renderer> From> for Element<'a, Message, Theme, Renderer> where Message: 'a + Clone, - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: 'a + StyleSheet, { fn from(badge: Badge<'a, Message, Theme, Renderer>) -> Self { diff --git a/src/native/card.rs b/src/native/card.rs index 1f74caea..08c3c197 100644 --- a/src/native/card.rs +++ b/src/native/card.rs @@ -4,19 +4,20 @@ use crate::graphics::icons::{icon_to_string, BootstrapIcon, BOOTSTRAP_FONT}; -use iced_widget::{ - core::{ - self, - alignment::{Horizontal, Vertical}, - event, +use iced::{ + self, + advanced::{ layout::{Limits, Node}, - mouse::{self, Cursor}, - renderer, touch, + renderer, + text::LineHeight, widget::{Operation, Tree}, - Alignment, Border, Clipboard, Color, Element, Event, Layout, Length, Padding, Pixels, - Point, Rectangle, Shadow, Shell, Size, Vector, Widget, + Clipboard, Layout, Shell, Widget, }, - text::LineHeight, + alignment::{Horizontal, Vertical}, + event, + mouse::{self, Cursor}, + touch, Alignment, Border, Color, Element, Event, Length, Padding, Pixels, Point, Rectangle, + Shadow, Size, Vector, }; pub use crate::style::card::{Appearance, StyleSheet}; @@ -45,9 +46,9 @@ const DEFAULT_PADDING: f32 = 10.0; /// /// ``` #[allow(missing_debug_implementations)] -pub struct Card<'a, Message, Theme = iced_widget::Theme, Renderer = iced_widget::Renderer> +pub struct Card<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// The width of the [`Card`]. @@ -80,7 +81,7 @@ where impl<'a, Message, Theme, Renderer> Card<'a, Message, Theme, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// Creates a new [`Card`] containing the given head and body. @@ -210,7 +211,7 @@ impl<'a, Message, Theme, Renderer> Widget for Card<'a, Message, Theme, Renderer> where Message: 'a + Clone, - Renderer: 'a + core::Renderer + core::text::Renderer, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet, { fn children(&self) -> Vec { @@ -584,7 +585,7 @@ where layout: Layout<'_>, renderer: &Renderer, translation: Vector, - ) -> Option> { + ) -> Option> { let mut children = vec![&mut self.head, &mut self.body]; if let Some(foot) = &mut self.foot { children.push(foot); @@ -602,7 +603,8 @@ where }) .collect::>(); - (!children.is_empty()).then(|| core::overlay::Group::with_children(children).overlay()) + (!children.is_empty()) + .then(|| iced::advanced::overlay::Group::with_children(children).overlay()) } } @@ -619,7 +621,7 @@ fn head_node( tree: &mut Tree, ) -> Node where - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, { let header_size = head.as_widget().size(); @@ -677,7 +679,7 @@ fn body_node( tree: &mut Tree, ) -> Node where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { let body_size = body.as_widget().size(); @@ -711,7 +713,7 @@ fn foot_node( tree: &mut Tree, ) -> Node where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { let foot_size = foot.as_widget().size(); @@ -748,7 +750,7 @@ fn draw_head( style: &::Style, close_size: Option, ) where - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet, { let mut head_children = layout.children(); @@ -808,7 +810,7 @@ fn draw_head( let is_mouse_over_close = close_bounds.contains(cursor.position().unwrap_or_default()); renderer.fill_text( - core::text::Text { + iced::advanced::text::Text { content: &icon_to_string(BootstrapIcon::X), bounds: Size::new(close_bounds.width, close_bounds.height), size: Pixels( @@ -819,7 +821,7 @@ fn draw_head( horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, line_height: LineHeight::Relative(1.3), - shaping: iced_widget::text::Shaping::Advanced, + shaping: iced::advanced::text::Shaping::Advanced, }, Point::new(close_bounds.center_x(), close_bounds.center_y()), style_sheet.close_color, @@ -840,7 +842,7 @@ fn draw_body( theme: &Theme, style: &::Style, ) where - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet, { let mut body_children = layout.children(); @@ -887,7 +889,7 @@ fn draw_foot( theme: &Theme, style: &::Style, ) where - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet, { let mut foot_children = layout.children(); @@ -927,7 +929,7 @@ fn draw_foot( impl<'a, Message, Theme, Renderer> From> for Element<'a, Message, Theme, Renderer> where - Renderer: 'a + core::Renderer + core::text::Renderer, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: 'a + StyleSheet, Message: Clone + 'a, { diff --git a/src/native/color_picker.rs b/src/native/color_picker.rs index b9736eb7..d41343eb 100644 --- a/src/native/color_picker.rs +++ b/src/native/color_picker.rs @@ -6,20 +6,28 @@ use super::overlay::color_picker::{ self, ColorBarDragged, ColorPickerOverlay, ColorPickerOverlayButtons, }; -use iced_widget::{ - button, - core::{ - event, +use iced::{ + self, + advanced::{ layout::{Limits, Node}, - mouse::{self, Cursor}, overlay, renderer, widget::{ self, tree::{self, Tag, Tree}, }, - Clipboard, Color, Element, Event, Layout, Length, Point, Rectangle, Shell, Vector, Widget, + Clipboard, Layout, Shell, Widget, }, - renderer::Renderer, + event, + mouse::{self, Cursor}, + widget::button, + Color, + Element, + Event, + Length, + Point, + Rectangle, + Renderer, // the actual type + Vector, }; pub use crate::style::color_picker::{Appearance, StyleSheet}; @@ -49,7 +57,7 @@ pub use crate::style::color_picker::{Appearance, StyleSheet}; /// ); /// ``` #[allow(missing_debug_implementations)] -pub struct ColorPicker<'a, Message, Theme = iced_widget::style::Theme> +pub struct ColorPicker<'a, Message, Theme = iced::Theme> where Message: Clone, Theme: StyleSheet + button::StyleSheet, @@ -166,7 +174,7 @@ where tree.diff_children(&[&self.underlay, &self.overlay_state]); } - fn size(&self) -> iced_widget::core::Size { + fn size(&self) -> iced::Size { self.underlay.as_widget().size() } diff --git a/src/native/common.rs b/src/native/common.rs index 360ad2d8..142cc66b 100644 --- a/src/native/common.rs +++ b/src/native/common.rs @@ -1,7 +1,7 @@ //! Common types for reuse. //! -use iced_widget::core::{Padding, Rectangle}; +use iced::{Padding, Rectangle}; /// Methods for creating inner bounds #[allow(missing_debug_implementations)] diff --git a/src/native/context_menu.rs b/src/native/context_menu.rs index 59822abf..8fca7911 100644 --- a/src/native/context_menu.rs +++ b/src/native/context_menu.rs @@ -1,12 +1,16 @@ //! A context menu for showing actions on right click. //! -use iced_widget::core::{ - self, event, - layout::{Limits, Node}, +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + overlay, renderer, + widget::{tree, Operation, Tree}, + Clipboard, Layout, Shell, Widget, + }, + event, mouse::{self, Button, Cursor}, - overlay, renderer, - widget::{tree, Operation, Tree}, - Clipboard, Element, Event, Layout, Length, Point, Rectangle, Shell, Vector, Widget, + Element, Event, Length, Point, Rectangle, Vector, }; use crate::native::overlay::ContextMenuOverlay; @@ -33,16 +37,11 @@ pub use crate::style::context_menu::StyleSheet; /// ); /// ``` #[allow(missing_debug_implementations)] -pub struct ContextMenu< - 'a, - Overlay, - Message, - Theme = iced_widget::Theme, - Renderer = iced_widget::Renderer, -> where +pub struct ContextMenu<'a, Overlay, Message, Theme = iced::Theme, Renderer = iced::Renderer> +where Overlay: Fn() -> Element<'a, Message, Theme, Renderer>, Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// The underlying element. @@ -57,7 +56,7 @@ impl<'a, Overlay, Message, Theme, Renderer> ContextMenu<'a, Overlay, Message, Th where Overlay: Fn() -> Element<'a, Message, Theme, Renderer>, Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// Creates a new [`ContextMenu`] @@ -89,10 +88,10 @@ impl<'a, Content, Message, Theme, Renderer> Widget where Content: 'a + Fn() -> Element<'a, Message, Theme, Renderer>, Message: 'a + Clone, - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: StyleSheet, { - fn size(&self) -> core::Size { + fn size(&self) -> iced::Size { self.underlay.as_widget().size() } @@ -252,7 +251,7 @@ impl<'a, Content, Message, Theme, Renderer> From Element<'a, Message, Theme, Renderer>, Message: 'a + Clone, - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: 'a + StyleSheet, { fn from(modal: ContextMenu<'a, Content, Message, Theme, Renderer>) -> Self { diff --git a/src/native/cupertino/cupertino_button.rs b/src/native/cupertino/cupertino_button.rs index 8e9405b0..bd220ce9 100644 --- a/src/native/cupertino/cupertino_button.rs +++ b/src/native/cupertino/cupertino_button.rs @@ -1,20 +1,19 @@ use crate::graphics::SF_UI_ROUNDED; use crate::native::cupertino::cupertino_colors::{secondary_system_fill, system_blue}; -use iced_widget::core::{Border, Shadow}; -use iced_widget::{ - core::{ - self, event, +use iced::{ + self, + advanced::{ layout::{Limits, Node}, - mouse::{self, Cursor}, renderer::{self, Quad}, - touch, widget::Tree, - Background, Clipboard, Color, Element, Event, Font, Layout, Length, Point, Rectangle, - Shell, Size, Widget, + Clipboard, Layout, Shell, Widget, }, - style::application, - text, Text, + application, event, + mouse::{self, Cursor}, + touch, + widget::{text, Text}, + Background, Border, Color, Element, Event, Font, Length, Point, Rectangle, Shadow, Size, }; /** @@ -35,7 +34,7 @@ use iced_widget::{ pub struct CupertinoButton<'a, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: application::StyleSheet, { on_pressed: Option, @@ -52,7 +51,7 @@ where impl<'a, Message, Theme, Renderer> Default for CupertinoButton<'a, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer + core::text::Renderer + 'a, + Renderer: renderer::Renderer + iced::advanced::text::Renderer + 'a, Theme: 'a + application::StyleSheet + text::StyleSheet, { fn default() -> Self { @@ -68,7 +67,7 @@ where impl<'a, Message, Theme, Renderer> CupertinoButton<'a, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer + core::text::Renderer + 'a, + Renderer: renderer::Renderer + iced::advanced::text::Renderer + 'a, Theme: 'a + application::StyleSheet + text::StyleSheet, { /// Creates a new [`CupertinoButton`] widget. @@ -119,7 +118,7 @@ impl<'a, Message, Theme, Renderer> Widget for CupertinoButton<'a, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: application::StyleSheet, { fn size(&self) -> Size { @@ -259,7 +258,7 @@ impl<'a, Message, Theme, Renderer> From where Message: Clone + 'a, - Renderer: core::Renderer + core::text::Renderer + 'a, + Renderer: renderer::Renderer + iced::advanced::text::Renderer + 'a, Theme: 'a + application::StyleSheet, { fn from(alert: CupertinoButton<'a, Message, Theme, Renderer>) -> Self { diff --git a/src/native/cupertino/cupertino_colors.rs b/src/native/cupertino/cupertino_colors.rs index 57d78a40..e82341f4 100644 --- a/src/native/cupertino/cupertino_colors.rs +++ b/src/native/cupertino/cupertino_colors.rs @@ -1,4 +1,4 @@ -use iced_widget::core::Color; +use iced::Color; /// /// diff --git a/src/native/cupertino/cupertino_spinner.rs b/src/native/cupertino/cupertino_spinner.rs index 9889eb43..1d61358c 100644 --- a/src/native/cupertino/cupertino_spinner.rs +++ b/src/native/cupertino/cupertino_spinner.rs @@ -1,16 +1,25 @@ -use iced_widget::{ - canvas::{stroke, Cache, Geometry, LineCap, Path, Stroke}, - core::{ - event, +use iced::{ + self, + advanced::{ + graphics::geometry::Renderer as _, layout::{Limits, Node}, - mouse::Cursor, renderer, widget::tree::{State, Tag, Tree}, - window, Clipboard, Color, Element, Event, Layout, Length, Point, Rectangle, Renderer as _, - Shell, Size, Vector, Widget, + Clipboard, Layout, Renderer as _, Shell, Widget, }, - graphics::geometry::Renderer as _, - renderer::Renderer, + event, + mouse::Cursor, + widget::canvas::{stroke, Cache, Geometry, LineCap, Path, Stroke}, + window, + Color, + Element, + Event, + Length, + Point, + Rectangle, + Renderer, // the actual type + Size, + Vector, }; use std::f32::consts::PI; diff --git a/src/native/cupertino/cupertino_switch.rs b/src/native/cupertino/cupertino_switch.rs index 57d34e98..86414e5c 100644 --- a/src/native/cupertino/cupertino_switch.rs +++ b/src/native/cupertino/cupertino_switch.rs @@ -1,18 +1,28 @@ use crate::native::cupertino::cupertino_colors::{secondary_system_fill, system_green}; -use iced_widget::{ - canvas::{Cache, Fill, Geometry, Path}, - core::{ - event, +use iced::{ + self, + advanced::{ + graphics::geometry::Renderer as _, layout::{self, Limits, Node}, - mouse::{self, Cursor}, - renderer, touch, + renderer, widget::tree::{State, Tag, Tree}, - window, Clipboard, Color, Element, Event, Layout, Length, Point, Rectangle, Renderer as _, - Shell, Size, Vector, Widget, + Clipboard, Layout, Renderer as _, Shell, Widget, }, - graphics::geometry::Renderer as _, - renderer::Renderer, + event, + mouse::{self, Cursor}, + touch, + widget::canvas::{Cache, Fill, Geometry, Path}, + window, + Color, + Element, + Event, + Length, + Point, + Rectangle, + Renderer, // the actual type + Size, + Vector, }; /** diff --git a/src/native/date_picker.rs b/src/native/date_picker.rs index 340413f7..ed07d4a9 100644 --- a/src/native/date_picker.rs +++ b/src/native/date_picker.rs @@ -5,21 +5,28 @@ use super::overlay::date_picker::{self, DatePickerOverlay, DatePickerOverlayButtons}; use chrono::Local; -use iced_widget::{ - button, container, - core::{ - self, event, +use iced::{ + self, + advanced::{ layout::{Limits, Node}, - mouse::{self, Cursor}, renderer, widget::{ self, tree::{Tag, Tree}, }, - Clipboard, Element, Event, Layout, Length, Point, Rectangle, Shell, Vector, Widget, + Clipboard, Layout, Shell, Widget, }, - renderer::Renderer, - text, + event, + mouse::{self, Cursor}, + widget::button, + Element, + Event, + Length, + Point, + Rectangle, + Renderer, // the actual type + Size, + Vector, }; pub use crate::{ @@ -77,7 +84,11 @@ where impl<'a, Message, Theme> DatePicker<'a, Message, Theme> where Message: 'a + Clone, - Theme: 'a + StyleSheet + button::StyleSheet + text::StyleSheet + container::StyleSheet, + Theme: 'a + + StyleSheet + + button::StyleSheet + + iced::widget::text::StyleSheet + + iced::widget::container::StyleSheet, { /// Creates a new [`DatePicker`] wrapping around the given underlay. /// @@ -155,7 +166,10 @@ impl State { impl<'a, Message, Theme> Widget for DatePicker<'a, Message, Theme> where Message: 'static + Clone, - Theme: StyleSheet + button::StyleSheet + text::StyleSheet + container::StyleSheet, + Theme: StyleSheet + + button::StyleSheet + + iced::widget::text::StyleSheet + + iced::widget::container::StyleSheet, { fn tag(&self) -> Tag { Tag::of::() @@ -173,7 +187,7 @@ where tree.diff_children(&[&self.underlay, &self.overlay_state]); } - fn size(&self) -> core::Size { + fn size(&self) -> Size { self.underlay.as_widget().size() } @@ -250,7 +264,7 @@ where layout: Layout<'_>, renderer: &Renderer, translation: Vector, - ) -> Option> { + ) -> Option> { let picker_state: &mut State = state.state.downcast_mut(); if !self.show_picker { @@ -283,7 +297,11 @@ impl<'a, Message, Theme> From> for Element<'a, Message, Theme, Renderer> where Message: 'static + Clone, - Theme: 'a + StyleSheet + button::StyleSheet + text::StyleSheet + container::StyleSheet, + Theme: 'a + + StyleSheet + + button::StyleSheet + + iced::widget::text::StyleSheet + + iced::widget::container::StyleSheet, { fn from(date_picker: DatePicker<'a, Message, Theme>) -> Self { Element::new(date_picker) diff --git a/src/native/floating_element.rs b/src/native/floating_element.rs index 4ecedd0a..ca8b7fd2 100644 --- a/src/native/floating_element.rs +++ b/src/native/floating_element.rs @@ -4,13 +4,17 @@ use super::overlay::floating_element::FloatingElementOverlay; -use iced_widget::core::{ - self, event, - layout::{Limits, Node}, +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + overlay, renderer, + widget::{Operation, Tree}, + Clipboard, Layout, Shell, Widget, + }, + event, mouse::{self, Cursor}, - overlay, renderer, - widget::{Operation, Tree}, - Clipboard, Element, Event, Layout, Length, Rectangle, Shell, Vector, Widget, + Element, Event, Length, Rectangle, Size, Vector, }; pub mod anchor; @@ -39,13 +43,9 @@ pub use offset::Offset; /// ); /// ``` #[allow(missing_debug_implementations)] -pub struct FloatingElement< - 'a, - Message, - Theme = iced_widget::Theme, - Renderer = iced_widget::Renderer, -> where - Renderer: core::Renderer, +pub struct FloatingElement<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> +where + Renderer: renderer::Renderer, { /// The anchor of the element. anchor: Anchor, @@ -61,7 +61,7 @@ pub struct FloatingElement< impl<'a, Message, Theme, Renderer> FloatingElement<'a, Message, Theme, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { /// Creates a new [`FloatingElement`] over some content, /// showing the given [`Element`]. @@ -113,7 +113,7 @@ impl<'a, Message, Theme, Renderer> Widget for FloatingElement<'a, Message, Theme, Renderer> where Message: 'a, - Renderer: core::Renderer, + Renderer: renderer::Renderer, { fn children(&self) -> Vec { vec![Tree::new(&self.underlay), Tree::new(&self.element)] @@ -123,7 +123,7 @@ where tree.diff_children(&[&self.underlay, &self.element]); } - fn size(&self) -> core::Size { + fn size(&self) -> Size { self.underlay.as_widget().size() } @@ -245,7 +245,7 @@ impl<'a, Message, Theme, Renderer> From where Message: 'a, - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: 'a, { fn from(floating_element: FloatingElement<'a, Message, Theme, Renderer>) -> Self { diff --git a/src/native/floating_element/offset.rs b/src/native/floating_element/offset.rs index 7cd03449..95edae34 100644 --- a/src/native/floating_element/offset.rs +++ b/src/native/floating_element/offset.rs @@ -2,7 +2,7 @@ //! //! *This API requires the following crate features to be activated: `floating_element`* -use iced_widget::core::Point; +use iced::Point; /// The [`Offset`] for the [`FloatingElement`](super::FloatingElement). #[derive(Copy, Clone, Debug)] diff --git a/src/native/grid/layout.rs b/src/native/grid/layout.rs index 2acd09b7..d190067b 100644 --- a/src/native/grid/layout.rs +++ b/src/native/grid/layout.rs @@ -1,9 +1,12 @@ use std::cmp::Ordering; -use iced_widget::core::{ +use iced::{ + advanced::{ + layout::{Limits, Node}, + renderer, + widget::Tree, + }, alignment::{Horizontal, Vertical}, - layout::{Limits, Node}, - widget::Tree, Length, Padding, Pixels, Point, Size, }; use itertools::{Itertools, Position}; @@ -30,7 +33,7 @@ pub(super) fn layout( row_lengths: &[Length], ) -> Node where - Renderer: iced_widget::core::Renderer, + Renderer: renderer::Renderer, { let mut column_widths = Vec::::with_capacity(column_count); let mut row_heights = Vec::::with_capacity(row_count); @@ -89,7 +92,7 @@ fn minimum_row_column_sizes( row_heights: &mut Vec, rows: &[GridRow<'_, Message, Theme, Renderer>], ) where - Renderer: iced_widget::core::Renderer, + Renderer: renderer::Renderer, { let mut children = tree.children.iter_mut(); for row in rows { @@ -189,7 +192,7 @@ fn create_grid_layout( grid_size: Size, ) -> Node where - Renderer: iced_widget::core::Renderer, + Renderer: renderer::Renderer, { let mut y = padding.top; let mut nodes = Vec::with_capacity(element_count); diff --git a/src/native/grid/types.rs b/src/native/grid/types.rs index ea343a02..5d75f3df 100644 --- a/src/native/grid/types.rs +++ b/src/native/grid/types.rs @@ -1,4 +1,5 @@ -use iced_widget::core::{ +use iced::{ + advanced::renderer, alignment::{Horizontal, Vertical}, Element, Length, Padding, Pixels, }; @@ -7,7 +8,7 @@ use iced_widget::core::{ /// /// The number of columns is determined by the row with the most elements. #[allow(missing_debug_implementations)] -pub struct Grid<'a, Message, Theme = iced_widget::Theme, Renderer = iced_widget::Renderer> { +pub struct Grid<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> { pub(super) rows: Vec>, pub(super) horizontal_alignment: Horizontal, pub(super) vertical_alignment: Vertical, @@ -22,7 +23,7 @@ pub struct Grid<'a, Message, Theme = iced_widget::Theme, Renderer = iced_widget: impl<'a, Message, Theme, Renderer> Default for Grid<'a, Message, Theme, Renderer> where - Renderer: iced_widget::core::Renderer, + Renderer: renderer::Renderer, { fn default() -> Self { Self { @@ -42,7 +43,7 @@ where impl<'a, Message, Theme, Renderer> Grid<'a, Message, Theme, Renderer> where - Renderer: iced_widget::core::Renderer, + Renderer: renderer::Renderer, { /// Creates a new [`Grid`]. #[must_use] @@ -202,13 +203,13 @@ where /// A container that distributes its contents in a row of a [`crate::Grid`]. #[allow(missing_debug_implementations)] -pub struct GridRow<'a, Message, Theme = iced_widget::Theme, Renderer = iced_widget::Renderer> { +pub struct GridRow<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> { pub(crate) elements: Vec>, } impl<'a, Message, Theme, Renderer> Default for GridRow<'a, Message, Theme, Renderer> where - Renderer: iced_widget::core::Renderer, + Renderer: renderer::Renderer, { fn default() -> Self { Self { @@ -219,7 +220,7 @@ where impl<'a, Message, Theme, Renderer> GridRow<'a, Message, Theme, Renderer> where - Renderer: iced_widget::core::Renderer, + Renderer: renderer::Renderer, { /// Creates a new [`GridRow`]. #[must_use] diff --git a/src/native/grid/widget.rs b/src/native/grid/widget.rs index 765cbb3d..5257a7ae 100644 --- a/src/native/grid/widget.rs +++ b/src/native/grid/widget.rs @@ -1,11 +1,13 @@ -use iced_widget::core::{ - event, - layout::{Limits, Node}, - mouse, overlay, - overlay::Group, - renderer::Style, - widget::{Operation, Tree}, - Clipboard, Element, Event, Layout, Length, Rectangle, Shell, Size, Vector, Widget, +use iced::{ + advanced::{ + layout::{Limits, Node}, + overlay::Group, + renderer, + renderer::Style, + widget::{Operation, Tree}, + Clipboard, Layout, Shell, Widget, + }, + event, mouse, overlay, Element, Event, Length, Rectangle, Size, Vector, }; use super::{layout::layout, types::Grid}; @@ -13,7 +15,7 @@ use super::{layout::layout, types::Grid}; impl<'a, Message, Theme, Renderer> Widget for Grid<'a, Message, Theme, Renderer> where - Renderer: iced_widget::core::Renderer, + Renderer: renderer::Renderer, { fn size(&self) -> Size { Size { @@ -179,7 +181,7 @@ where impl<'a, Message, Theme, Renderer> From> for Element<'a, Message, Theme, Renderer> where - Renderer: iced_widget::core::Renderer + 'a, + Renderer: renderer::Renderer + 'a, Message: 'static, Theme: 'a, { diff --git a/src/native/helpers.rs b/src/native/helpers.rs index 32c982f7..7a411a4c 100644 --- a/src/native/helpers.rs +++ b/src/native/helpers.rs @@ -3,7 +3,7 @@ //! #[allow(unused_imports)] -use iced_widget::core::{self, Color, Element}; +use iced::{self, advanced::renderer, Color, Element}; #[allow(unused_imports)] use std::{borrow::Cow, fmt::Display, hash::Hash}; @@ -101,7 +101,7 @@ pub fn menu_bar( menu_roots: Vec>, ) -> crate::menu::menu_bar::MenuBar where - Renderer: core::Renderer, + Renderer: renderer::Renderer, Renderer::Theme: crate::style::menu_bar::StyleSheet, { crate::menu::menu_bar::MenuBar::new(menu_roots) @@ -117,7 +117,7 @@ pub fn menu_tree<'a, Message, Renderer>( children: Vec>>, ) -> crate::menu::menu_tree::MenuTree<'a, Message, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { crate::menu::menu_tree::MenuTree::with_children(item, children) } @@ -130,7 +130,7 @@ pub fn badge<'a, Message, Theme, Renderer>( content: impl Into>, ) -> crate::Badge<'a, Message, Theme, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: crate::style::badge::StyleSheet, { crate::Badge::new(content) @@ -145,7 +145,7 @@ pub fn card<'a, Message, Theme, Renderer>( body: impl Into>, ) -> crate::Card<'a, Message, Theme, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: crate::style::card::StyleSheet, { crate::Card::new(head, body) @@ -158,7 +158,7 @@ where pub fn color_picker<'a, Message, Theme, F>( show_picker: bool, color: Color, - underlay: impl Into>, + underlay: impl Into>, on_cancel: Message, on_submit: F, ) -> crate::ColorPicker<'a, Message, Theme> @@ -166,8 +166,8 @@ where Message: 'a + Clone, Theme: 'a + crate::style::color_picker::StyleSheet - + iced_widget::button::StyleSheet - + iced_widget::text::StyleSheet, + + iced::widget::button::StyleSheet + + iced::widget::text::StyleSheet, F: 'static + Fn(Color) -> Message, { crate::ColorPicker::new(show_picker, color, underlay, on_cancel, on_submit) @@ -180,7 +180,7 @@ where pub fn date_picker<'a, Message, Theme, F>( show_picker: bool, date: impl Into, - underlay: impl Into>, + underlay: impl Into>, on_cancel: Message, on_submit: F, ) -> crate::DatePicker<'a, Message, Theme> @@ -188,9 +188,9 @@ where Message: 'a + Clone, Theme: 'a + crate::style::date_picker::StyleSheet - + iced_widget::button::StyleSheet - + iced_widget::text::StyleSheet - + iced_widget::container::StyleSheet, + + iced::widget::button::StyleSheet + + iced::widget::text::StyleSheet + + iced::widget::container::StyleSheet, F: 'static + Fn(crate::core::date::Date) -> Message, { crate::DatePicker::new(show_picker, date, underlay, on_cancel, on_submit) @@ -211,9 +211,9 @@ where Message: 'a + Clone, Theme: 'a + crate::style::time_picker::StyleSheet - + iced_widget::button::StyleSheet - + iced_widget::text::StyleSheet, - U: Into>, + + iced::widget::button::StyleSheet + + iced::widget::text::StyleSheet, + U: Into>, F: 'static + Fn(crate::core::time::Time) -> Message, { crate::TimePicker::new(show_picker, time, underlay, on_cancel, on_submit) @@ -229,7 +229,7 @@ pub fn floating_element<'a, Message, Theme, Renderer>( ) -> crate::FloatingElement<'a, Message, Theme, Renderer> where Message: 'a + Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, { crate::FloatingElement::new(underlay, element) } @@ -243,7 +243,7 @@ pub fn grid( rows: Vec>, ) -> crate::Grid<'_, Message, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { crate::Grid::with_rows(rows) } @@ -258,7 +258,7 @@ pub fn grid_row<'a, Message, Theme, Renderer>( elements: Vec>>, ) -> crate::GridRow<'a, Message, Theme, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { crate::GridRow::with_elements(elements) } @@ -272,7 +272,7 @@ pub fn wrap_horizontal( children: Vec>, ) -> crate::Wrap where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { crate::Wrap::with_elements(children) } @@ -286,7 +286,7 @@ pub fn wrap_vertical( children: Vec>, ) -> crate::Wrap where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { crate::Wrap::with_elements_vertical(children) } @@ -302,7 +302,7 @@ pub fn modal<'a, Message, Theme, Renderer>( ) -> crate::Modal<'a, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: crate::style::modal::StyleSheet, { crate::Modal::new(underlay, overlay) @@ -320,11 +320,11 @@ pub fn number_input<'a, T, Message, Theme, Renderer, F>( ) -> crate::NumberInput<'a, T, Message, Theme, Renderer> where Message: Clone, - Renderer: core::text::Renderer, + Renderer: iced::advanced::text::Renderer, Theme: crate::style::number_input::StyleSheet - + iced_widget::text_input::StyleSheet - + iced_widget::container::StyleSheet - + iced_widget::text::StyleSheet, + + iced::widget::text_input::StyleSheet + + iced::widget::container::StyleSheet + + iced::widget::text::StyleSheet, F: 'static + Fn(T) -> Message + Copy, T: 'static + num_traits::Num @@ -349,15 +349,15 @@ pub fn selection_list_with<'a, T, Message, Theme, Renderer>( padding: f32, style: ::Style, selected: Option, - font: iced_widget::runtime::Font, + font: iced::Font, ) -> crate::SelectionList<'a, T, Message, Theme, Renderer> where Message: 'a + Clone, - Renderer: 'a + core::Renderer + core::text::Renderer, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: 'a + crate::style::selection_list::StyleSheet - + iced_widget::container::StyleSheet - + iced_widget::scrollable::StyleSheet, + + iced::widget::container::StyleSheet + + iced::widget::scrollable::StyleSheet, T: Clone + Display + Eq + Hash, [T]: ToOwned>, { @@ -383,11 +383,11 @@ pub fn selection_list<'a, T, Message, Theme, Renderer>( ) -> crate::SelectionList<'a, T, Message, Theme, Renderer> where Message: 'a + Clone, - Renderer: 'a + core::Renderer + core::text::Renderer, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: 'a + crate::style::selection_list::StyleSheet - + iced_widget::container::StyleSheet - + iced_widget::scrollable::StyleSheet, + + iced::widget::container::StyleSheet + + iced::widget::scrollable::StyleSheet, T: Clone + Display + Eq + Hash, [T]: ToOwned>, { diff --git a/src/native/modal.rs b/src/native/modal.rs index 887cca3e..e72fbaee 100644 --- a/src/native/modal.rs +++ b/src/native/modal.rs @@ -4,13 +4,17 @@ use super::overlay::modal::ModalOverlay; -use iced_widget::core::{ - self, alignment, event, - layout::{Limits, Node}, +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + overlay, renderer, + widget::{Operation, Tree}, + Clipboard, Layout, Shell, Widget, + }, + alignment, event, mouse::{self, Cursor}, - overlay, renderer, - widget::{Operation, Tree}, - Clipboard, Element, Event, Layout, Length, Rectangle, Shell, Vector, Widget, + Element, Event, Length, Rectangle, Size, Vector, }; pub use crate::style::modal::StyleSheet; @@ -37,10 +41,10 @@ pub use crate::style::modal::StyleSheet; /// .backdrop(Message::CloseModal); /// ``` #[allow(missing_debug_implementations)] -pub struct Modal<'a, Message, Theme = iced_widget::Theme, Renderer = iced_widget::Renderer> +pub struct Modal<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> where Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// The underlying element. @@ -60,7 +64,7 @@ where impl<'a, Message, Theme, Renderer> Modal<'a, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// Creates a new [`Modal`] wrapping the underlying element to show some content as an overlay. @@ -130,7 +134,7 @@ impl<'a, Message, Theme, Renderer> Widget for Modal<'a, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { fn children(&self) -> Vec { @@ -148,7 +152,7 @@ where } } - fn size(&self) -> core::Size { + fn size(&self) -> Size { self.underlay.as_widget().size() } @@ -281,7 +285,7 @@ impl<'a, Message, Theme, Renderer> From> for Element<'a, Message, Theme, Renderer> where Message: 'a + Clone, - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: 'a + StyleSheet, { fn from(modal: Modal<'a, Message, Theme, Renderer>) -> Self { diff --git a/src/native/number_input.rs b/src/native/number_input.rs index 311fef53..6427c063 100644 --- a/src/native/number_input.rs +++ b/src/native/number_input.rs @@ -1,26 +1,28 @@ //! Display fields that can only be filled with numeric type. //! //! A [`NumberInput`] has some local [`State`]. -use iced_widget::{ - container, - core::{ - self, - alignment::{Horizontal, Vertical}, - event, keyboard, +use iced::{ + self, + advanced::{ layout::{Limits, Node}, - mouse::{self, Cursor}, renderer, widget::{ tree::{State, Tag}, Operation, Tree, }, - Alignment, Background, Border, Clipboard, Color, Element, Event, Layout, Length, Padding, - Pixels, Point, Rectangle, Shadow, Shell, Size, Widget, + Clipboard, Layout, Shell, Widget, }, - text, - text::LineHeight, - text_input::{self, cursor, Value}, - Column, Container, Row, Text, TextInput, + alignment::{Horizontal, Vertical}, + event, keyboard, + mouse::{self, Cursor}, + widget::{ + container, text, + text::LineHeight, + text_input::{self, cursor, Value}, + Column, Container, Row, Text, TextInput, + }, + Alignment, Background, Border, Color, Element, Event, Length, Padding, Pixels, Point, + Rectangle, Shadow, Size, }; use num_traits::{Num, NumAssignOps}; use std::{fmt::Display, str::FromStr}; @@ -56,9 +58,9 @@ const DEFAULT_PADDING: f32 = 5.0; /// .step(2); /// ``` #[allow(missing_debug_implementations)] -pub struct NumberInput<'a, T, Message, Theme = iced_widget::Theme, Renderer = iced_widget::Renderer> +pub struct NumberInput<'a, T, Message, Theme = iced::Theme, Renderer = iced::Renderer> where - Renderer: core::text::Renderer, + Renderer: iced::advanced::text::Renderer, Theme: number_input::StyleSheet + text_input::StyleSheet + container::StyleSheet @@ -90,7 +92,7 @@ impl<'a, T, Message, Theme, Renderer> NumberInput<'a, T, Message, Theme, Rendere where T: Num + NumAssignOps + PartialOrd + Display + FromStr + Copy, Message: Clone, - Renderer: core::text::Renderer, + Renderer: iced::advanced::text::Renderer, Theme: number_input::StyleSheet + text_input::StyleSheet + container::StyleSheet @@ -253,7 +255,7 @@ impl<'a, T, Message, Theme, Renderer> Widget where T: Num + NumAssignOps + PartialOrd + Display + FromStr + ToString + Copy, Message: 'a + Clone, - Renderer: 'a + core::text::Renderer, + Renderer: 'a + iced::advanced::text::Renderer, Theme: number_input::StyleSheet + text_input::StyleSheet + container::StyleSheet @@ -707,7 +709,7 @@ where ); renderer.fill_text( - core::text::Text { + iced::advanced::text::Text { content: &icon_to_string(BootstrapIcon::CaretDownFill), bounds: Size::new(dec_bounds.width, dec_bounds.height), size: icon_size, @@ -715,7 +717,7 @@ where horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, line_height: LineHeight::Relative(1.3), - shaping: iced_widget::text::Shaping::Advanced, + shaping: iced::advanced::text::Shaping::Advanced, }, Point::new(dec_bounds.center_x(), dec_bounds.center_y()), decrease_btn_style.icon_color, @@ -739,7 +741,7 @@ where ); renderer.fill_text( - core::text::Text { + iced::advanced::text::Text { content: &icon_to_string(BootstrapIcon::CaretUpFill), bounds: Size::new(inc_bounds.width, inc_bounds.height), size: icon_size, @@ -747,7 +749,7 @@ where horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, line_height: LineHeight::Relative(1.3), - shaping: iced_widget::text::Shaping::Advanced, + shaping: iced::advanced::text::Shaping::Advanced, }, Point::new(inc_bounds.center_x(), inc_bounds.center_y()), increase_btn_style.icon_color, @@ -770,7 +772,7 @@ impl<'a, T, Message, Theme, Renderer> From, + Renderer: 'a + iced::advanced::text::Renderer, Theme: 'a + number_input::StyleSheet + text_input::StyleSheet diff --git a/src/native/overlay/color_picker.rs b/src/native/overlay/color_picker.rs index b19bc8b6..bd234507 100644 --- a/src/native/overlay/color_picker.rs +++ b/src/native/overlay/color_picker.rs @@ -15,24 +15,39 @@ use crate::{ }, }; -use iced_widget::{ - button, - canvas::{self, LineCap, Path, Stroke, Style}, - core::{ - alignment::{self, Horizontal, Vertical}, - event, keyboard, +use iced::{ + self, + advanced::{ + graphics::geometry::Renderer as _, layout::{Limits, Node}, - mouse::{self, Cursor}, - overlay, renderer, text, + overlay, renderer, text::Renderer as _, - touch, widget::{self, tree::Tree}, - Alignment, Border, Clipboard, Color, Element, Event, Layout, Length, Overlay, Padding, - Point, Rectangle, Renderer as _, Shadow, Shell, Size, Text, Vector, Widget, + Clipboard, Layout, Overlay, Renderer as _, Shell, Text, Widget, + }, + alignment::{self, Horizontal, Vertical}, + event, + keyboard, + mouse::{self, Cursor}, + touch, + widget::{ + button, + canvas::{self, LineCap, Path, Stroke, Style}, + text, Button, Column, Row, }, - graphics::geometry::Renderer as _, - renderer::Renderer, - Button, Column, Row, + Alignment, + Border, + Color, + Element, + Event, + Length, + Padding, + Point, + Rectangle, + Renderer, // the actual type + Shadow, + Size, + Vector, }; use std::collections::HashMap; @@ -93,7 +108,7 @@ where ColorPickerOverlay { state: overlay_state, cancel_button: Button::new( - iced_widget::Text::new(icon_to_string(BootstrapIcon::X)) + iced::widget::Text::new(icon_to_string(BootstrapIcon::X)) .horizontal_alignment(alignment::Horizontal::Center) .width(Length::Fill) .font(crate::BOOTSTRAP_FONT), @@ -101,7 +116,7 @@ where .width(Length::Fill) .on_press(on_cancel.clone()), submit_button: Button::new( - iced_widget::Text::new(icon_to_string(BootstrapIcon::Check)) + iced::widget::Text::new(icon_to_string(BootstrapIcon::Check)) .horizontal_alignment(alignment::Horizontal::Center) .width(Length::Fill) .font(crate::BOOTSTRAP_FONT), @@ -1492,8 +1507,8 @@ fn rgba_color( font: renderer.default_font(), horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, - line_height: iced_widget::text::LineHeight::Relative(1.3), - shaping: iced_widget::text::Shaping::Advanced, + line_height: iced::widget::text::LineHeight::Relative(1.3), + shaping: iced::widget::text::Shaping::Advanced, }, Point::new( value_layout.bounds().center_x(), @@ -1629,8 +1644,8 @@ fn hex_text( font: renderer.default_font(), horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, - line_height: iced_widget::text::LineHeight::Relative(1.3), - shaping: iced_widget::text::Shaping::Basic, + line_height: text::LineHeight::Relative(1.3), + shaping: text::Shaping::Basic, }, Point::new(layout.bounds().center_x(), layout.bounds().center_y()), Color { @@ -1737,7 +1752,7 @@ where tree.diff_children(&[&self.cancel_button, &self.submit_button]); } - fn size(&self) -> iced_widget::core::Size { + fn size(&self) -> Size { unimplemented!("This should never be reached!") } diff --git a/src/native/overlay/context_menu.rs b/src/native/overlay/context_menu.rs index a8937540..1fd8b13f 100644 --- a/src/native/overlay/context_menu.rs +++ b/src/native/overlay/context_menu.rs @@ -4,28 +4,26 @@ use crate::context_menu; use crate::style::context_menu::StyleSheet; -use iced_widget::core::{ +use iced::{ self, + advanced::{ + layout::{Limits, Node}, + overlay, renderer, + widget::Tree, + Clipboard, Layout, Shell, + }, event::Status, keyboard, - layout::{Limits, Node}, mouse::{self, Cursor}, - overlay, renderer, touch, - widget::tree::Tree, - window, Border, Clipboard, Color, Element, Event, Layout, Point, Rectangle, Shadow, Shell, - Size, + touch, window, Border, Color, Element, Event, Point, Rectangle, Shadow, Size, }; /// The overlay of the [`ContextMenu`](crate::native::ContextMenu). #[allow(missing_debug_implementations)] -pub struct ContextMenuOverlay< - 'a, - Message, - Theme = iced_widget::Theme, - Renderer = iced_widget::Renderer, -> where +pub struct ContextMenuOverlay<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> +where Message: 'a + Clone, - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: StyleSheet, { // The position of the element @@ -43,7 +41,7 @@ pub struct ContextMenuOverlay< impl<'a, Message, Theme, Renderer> ContextMenuOverlay<'a, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: 'a + StyleSheet, { /// Creates a new [`ContextMenuOverlay`]. @@ -76,7 +74,7 @@ impl<'a, Message, Theme, Renderer> overlay::Overlay for ContextMenuOverlay<'a, Message, Theme, Renderer> where Message: 'a + Clone, - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: StyleSheet, { fn layout(&mut self, renderer: &Renderer, bounds: Size) -> Node { diff --git a/src/native/overlay/date_picker.rs b/src/native/overlay/date_picker.rs index dbc673fb..3b8ba20c 100644 --- a/src/native/overlay/date_picker.rs +++ b/src/native/overlay/date_picker.rs @@ -16,23 +16,34 @@ use crate::{ }; use chrono::{Datelike, Local, NaiveDate}; -use iced_widget::{ - button, container, - core::{ - self, - alignment::{Horizontal, Vertical}, - event, keyboard, +use iced::{ + self, + advanced::{ layout::{Limits, Node}, - mouse::{self, Cursor}, overlay, renderer, text::Renderer as _, - touch, widget::tree::Tree, - Alignment, Border, Clipboard, Color, Element, Event, Layout, Length, Overlay, Padding, - Point, Rectangle, Renderer as _, Shadow, Shell, Size, Widget, + Clipboard, Layout, Overlay, Renderer as _, Shell, Widget, }, - renderer::Renderer, - text, Button, Column, Container, Row, Text, + alignment::{Horizontal, Vertical}, + event, + keyboard, + mouse::{self, Cursor}, + touch, + widget::{button, container, text, Button, Column, Container, Row, Text}, + Alignment, + Border, + Color, + Element, + Event, + Length, + Padding, + Pixels, + Point, + Rectangle, + Renderer, // the actual type + Shadow, + Size, }; use std::collections::HashMap; @@ -1123,10 +1134,10 @@ fn month_year( // Left caret renderer.fill_text( - core::text::Text { + iced::advanced::Text { content: &icon_to_string(BootstrapIcon::CaretLeftFill), bounds: Size::new(left_bounds.width, left_bounds.height), - size: core::Pixels( + size: Pixels( renderer.default_size().0 + if left_arrow_hovered { 1.0 } else { 0.0 }, ), font: BOOTSTRAP_FONT, @@ -1145,7 +1156,7 @@ fn month_year( // Text renderer.fill_text( - core::text::Text { + iced::advanced::Text { content: text, bounds: Size::new(center_bounds.width, center_bounds.height), size: renderer.default_size(), @@ -1165,10 +1176,10 @@ fn month_year( // Right caret renderer.fill_text( - core::text::Text { + iced::advanced::Text { content: &icon_to_string(BootstrapIcon::CaretRightFill), bounds: Size::new(right_bounds.width, right_bounds.height), - size: core::Pixels( + size: Pixels( renderer.default_size().0 + if right_arrow_hovered { 1.0 } else { 0.0 }, ), font: BOOTSTRAP_FONT, @@ -1224,7 +1235,7 @@ fn day_labels( let bounds = label.bounds(); renderer.fill_text( - core::text::Text { + iced::advanced::Text { content: &crate::core::date::WEEKDAY_LABELS[i], bounds: Size::new(bounds.width, bounds.height), size: renderer.default_size(), @@ -1313,7 +1324,7 @@ fn day_table( } renderer.fill_text( - core::text::Text { + iced::advanced::Text { content: &format!("{number:02}"), // Todo: is there some way of static format as this has a fixed size? bounds: Size::new(bounds.width, bounds.height), size: renderer.default_size(), diff --git a/src/native/overlay/floating_element.rs b/src/native/overlay/floating_element.rs index ba8c3280..fd64ef35 100644 --- a/src/native/overlay/floating_element.rs +++ b/src/native/overlay/floating_element.rs @@ -4,24 +4,23 @@ use crate::native::floating_element::{Anchor, Offset}; -use iced_widget::core::{ - self, event, layout, +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + overlay, renderer, + widget::Tree, + Clipboard, Layout, Overlay, Shell, + }, + event, mouse::{self, Cursor}, - overlay, renderer, - widget::Tree, - Clipboard, Element, Event, Layout, Length, Point, Rectangle, Shell, Size, Vector, + Element, Event, Length, Point, Rectangle, Size, Vector, }; /// The internal overlay of a [`FloatingElement`](crate::FloatingElement) for /// rendering a [`Element`](iced_widget::core::Element) as an overlay. #[allow(missing_debug_implementations)] -pub struct FloatingElementOverlay< - 'a, - 'b, - Message, - Theme = iced_widget::Theme, - Renderer = iced_widget::Renderer, -> { +pub struct FloatingElementOverlay<'a, 'b, Message, Theme = iced::Theme, Renderer = iced::Renderer> { // The position of the element position: Point, /// The state of the element. @@ -38,7 +37,7 @@ pub struct FloatingElementOverlay< impl<'a, 'b, Message, Theme, Renderer> FloatingElementOverlay<'a, 'b, Message, Theme, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { /// Creates a new [`FloatingElementOverlay`] containing the given /// [`Element`](iced_widget::core::Element). @@ -61,14 +60,14 @@ where } } -impl<'a, 'b, Message, Theme, Renderer> core::Overlay +impl<'a, 'b, Message, Theme, Renderer> Overlay for FloatingElementOverlay<'a, 'b, Message, Theme, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { - fn layout(&mut self, renderer: &Renderer, _bounds: Size) -> layout::Node { + fn layout(&mut self, renderer: &Renderer, _bounds: Size) -> Node { // Constrain overlay to fit inside the underlay's bounds - let limits = layout::Limits::new(Size::ZERO, self.underlay_bounds.size()) + let limits = Limits::new(Size::ZERO, self.underlay_bounds.size()) .width(Length::Fill) .height(Length::Fill); let node = self diff --git a/src/native/overlay/modal.rs b/src/native/overlay/modal.rs index b554d072..d0484281 100644 --- a/src/native/overlay/modal.rs +++ b/src/native/overlay/modal.rs @@ -1,23 +1,26 @@ //! A modal for showing elements as an overlay on top of another. //! //! *This API requires the following crate features to be activated: modal* -use iced_widget::core::{ - self, alignment, event, keyboard, layout, +use crate::style::modal::StyleSheet; +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + renderer, + widget::Tree, + Clipboard, Layout, Overlay, Shell, + }, + alignment, event, keyboard, mouse::{self, Cursor}, - renderer, touch, - widget::Tree, - Alignment, Border, Clipboard, Color, Element, Event, Layout, Overlay, Rectangle, Shadow, Shell, - Size, + touch, Alignment, Border, Color, Element, Event, Rectangle, Shadow, Size, }; -use crate::style::modal::StyleSheet; - /// The overlay of the modal. #[allow(missing_debug_implementations)] pub struct ModalOverlay<'a, 'b, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// The state of the [`ModalOverlay`](ModalOverlay). @@ -37,7 +40,7 @@ where impl<'a, 'b, Message, Theme, Renderer> ModalOverlay<'a, 'b, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// Creates a new [`ModalOverlay`](ModalOverlay). @@ -66,11 +69,11 @@ impl<'a, 'b, Message, Theme, Renderer> Overlay for ModalOverlay<'a, 'b, Message, Theme, Renderer> where Message: Clone, - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { - fn layout(&mut self, renderer: &Renderer, bounds: Size) -> layout::Node { - let limits = layout::Limits::new(Size::ZERO, bounds); + fn layout(&mut self, renderer: &Renderer, bounds: Size) -> Node { + let limits = Limits::new(Size::ZERO, bounds); let mut content = self .content .as_widget() @@ -83,7 +86,7 @@ where max_size, ); - layout::Node::with_children(max_size, vec![content]) + Node::with_children(max_size, vec![content]) } fn on_event( diff --git a/src/native/overlay/time_picker.rs b/src/native/overlay/time_picker.rs index 214c544b..7d532819 100644 --- a/src/native/overlay/time_picker.rs +++ b/src/native/overlay/time_picker.rs @@ -18,26 +18,40 @@ use crate::{ }; use chrono::{Duration, Local, NaiveTime, Timelike}; -use iced_widget::{ - button, - canvas::{self, LineCap, Path, Stroke, Style, Text}, - container, - core::{ - self, - alignment::{Horizontal, Vertical}, - event, keyboard, +use iced::{ + self, + advanced::{ + graphics::geometry::Renderer as _, layout::{Limits, Node}, - mouse::{self, Cursor}, overlay, renderer, text::Renderer as _, - touch, widget::tree::Tree, - Alignment, Border, Clipboard, Color, Element, Event, Layout, Length, Overlay, Padding, - Point, Rectangle, Renderer as _, Shadow, Shell, Size, Vector, Widget, + Clipboard, Layout, Overlay, Renderer as _, Shell, Text, Widget, }, - graphics::geometry::Renderer as _, - renderer::Renderer, - text, Button, Column, Container, Row, + alignment::{Horizontal, Vertical}, + event, + keyboard, + mouse::{self, Cursor}, + touch, + widget::{ + button, + canvas::{self, LineCap, Path, Stroke, Style, Text as CanvasText}, + container, text, Button, Column, Container, Row, + }, + Alignment, + Border, + Color, + Element, + Event, + Length, + Padding, + Pixels, + Point, + Rectangle, + Renderer, // the actual type + Shadow, + Size, + Vector, }; use std::collections::HashMap; @@ -1218,14 +1232,14 @@ fn draw_clock( NearestRadius::None => {} } - let period_text = Text { + let period_text = CanvasText { content: format!("{period}"), position: center, color: style .get(&clock_style_state) .expect("Style Sheet not found.") .clock_number_color, - size: core::Pixels(period_size), + size: Pixels(period_size), font: renderer.default_font(), horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, @@ -1254,7 +1268,7 @@ fn draw_clock( style_state = style_state.max(StyleState::Selected); } - let text = Text { + let text = CanvasText { content: format!( "{}", if pm && time_picker.state.use_24h { @@ -1270,7 +1284,7 @@ fn draw_clock( .get(&style_state) .expect("Style Sheet not found.") .clock_number_color, - size: core::Pixels(number_size), + size: Pixels(number_size), font: renderer.default_font(), horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, @@ -1298,14 +1312,14 @@ fn draw_clock( } if i % 5 == 0 { - let text = Text { + let text = CanvasText { content: format!("{i:02}"), position: *p, color: style .get(&style_state) .expect("Style Sheet not found.") .clock_number_color, - size: core::Pixels(number_size), + size: Pixels(number_size), font: renderer.default_font(), horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, @@ -1344,14 +1358,14 @@ fn draw_clock( } if i % 10 == 0 { - let text = Text { + let text = CanvasText { content: format!("{i:02}"), position: *p, color: style .get(&style_state) .expect("Style Sheet not found.") .clock_number_color, - size: core::Pixels(number_size), + size: Pixels(number_size), font: renderer.default_font(), horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, @@ -1457,12 +1471,10 @@ fn draw_digital_clock( // Caret up renderer.fill_text( - core::Text { + Text { content: char::from(BootstrapIcon::CaretUpFill).encode_utf8(&mut buffer), bounds: Size::new(up_bounds.width, up_bounds.height), - size: core::Pixels( - renderer.default_size().0 + if up_arrow_hovered { 1.0 } else { 0.0 }, - ), + size: Pixels(renderer.default_size().0 + if up_arrow_hovered { 1.0 } else { 0.0 }), font: crate::graphics::icons::BOOTSTRAP_FONT, horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, @@ -1479,7 +1491,7 @@ fn draw_digital_clock( // Text renderer.fill_text( - core::Text { + Text { content: &text, bounds: Size::new(center_bounds.width, center_bounds.height), size: renderer.default_size(), @@ -1499,10 +1511,10 @@ fn draw_digital_clock( // Down caret renderer.fill_text( - core::Text { + Text { content: char::from(BootstrapIcon::CaretDownFill).encode_utf8(&mut buffer), bounds: Size::new(down_bounds.width, down_bounds.height), - size: core::Pixels( + size: Pixels( renderer.default_size().0 + if down_arrow_hovered { 1.0 } else { 0.0 }, ), font: crate::graphics::icons::BOOTSTRAP_FONT, @@ -1549,7 +1561,7 @@ fn draw_digital_clock( .expect("Graphics: Layout should have a hour/minute separator layout"); renderer.fill_text( - core::Text { + Text { content: ":", bounds: Size::new( hour_minute_separator.bounds().width, @@ -1587,7 +1599,7 @@ fn draw_digital_clock( .next() .expect("Graphics: Layout should have a minute/second separator layout"); renderer.fill_text( - core::Text { + Text { content: ":", bounds: Size::new( minute_second_separator.bounds().width, @@ -1626,7 +1638,7 @@ fn draw_digital_clock( .next() .expect("Graphics: Layout should have a period layout"); renderer.fill_text( - core::Text { + Text { content: if time_picker.state.time.hour12().0 { "PM" } else { diff --git a/src/native/quad.rs b/src/native/quad.rs index 9ad06794..34a5af1d 100644 --- a/src/native/quad.rs +++ b/src/native/quad.rs @@ -2,16 +2,19 @@ //! //! *This API requires the following crate features to be activated: `quad`* -use iced_widget::core::{ - layout::{Limits, Node}, +use crate::native::InnerBounds; +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + renderer, + widget::Tree, + Layout, Widget, + }, mouse::Cursor, - renderer, - widget::Tree, - Border, Color, Element, Layout, Length, Rectangle, Shadow, Size, Widget, + Border, Color, Element, Length, Rectangle, Shadow, Size, }; -use crate::native::InnerBounds; - /// A dummy widget that draws a quad #[allow(missing_debug_implementations)] pub struct Quad { diff --git a/src/native/segmented_button.rs b/src/native/segmented_button.rs index 748d666e..80c0129d 100644 --- a/src/native/segmented_button.rs +++ b/src/native/segmented_button.rs @@ -1,12 +1,16 @@ //! Create choices using `segnmented_button` buttons. -use iced_widget::core::{ +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + renderer, + widget::Tree, + Clipboard, Layout, Shell, Widget, + }, event, - layout::{Limits, Node}, mouse::{self, Cursor}, - renderer, touch, - widget::Tree, - Alignment, Background, Border, Clipboard, Color, Element, Event, Layout, Length, Padding, - Point, Rectangle, Shadow, Shell, Widget, + touch, Alignment, Background, Border, Color, Element, Event, Length, Padding, Point, Rectangle, + Shadow, Size, }; pub use crate::style::segmented_button::StyleSheet; @@ -27,7 +31,7 @@ pub use crate::style::segmented_button::StyleSheet; #[allow(missing_debug_implementations)] pub struct SegmentedButton<'a, Message, Theme, Renderer> where - Renderer: iced_widget::core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { is_selected: bool, @@ -50,7 +54,7 @@ where impl<'a, Message, Theme, Renderer> SegmentedButton<'a, Message, Theme, Renderer> where - Renderer: iced_widget::core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// Creates a new [`SegmentedButton`](SegmentedButton) with the given content. @@ -123,7 +127,7 @@ impl<'a, Message, Theme, Renderer> Widget for SegmentedButton<'a, Message, Theme, Renderer> where Message: 'a + Clone, - Renderer: 'a + iced_widget::core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: StyleSheet, { fn children(&self) -> Vec { @@ -134,8 +138,8 @@ where tree.diff_children(std::slice::from_ref(&self.content)); } - fn size(&self) -> iced_widget::core::Size { - iced_widget::core::Size::new(self.width, self.height) + fn size(&self) -> Size { + Size::new(self.width, self.height) } fn layout(&self, tree: &mut Tree, renderer: &Renderer, limits: &Limits) -> Node { @@ -290,7 +294,7 @@ impl<'a, Message, Theme, Renderer> From where Message: 'a + Clone, - Renderer: 'a + iced_widget::core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: 'a + StyleSheet, { fn from(segmented_button: SegmentedButton<'a, Message, Theme, Renderer>) -> Self { diff --git a/src/native/selection_list.rs b/src/native/selection_list.rs index 875d21c1..a55c7fb4 100644 --- a/src/native/selection_list.rs +++ b/src/native/selection_list.rs @@ -2,25 +2,21 @@ pub mod list; use crate::style::selection_list::StyleSheet; -use iced_widget::{ - container, - core::{ - self, - alignment::{Horizontal, Vertical}, - event, +use iced::{ + self, + advanced::{ + graphics, layout::{Limits, Node}, - mouse::{self, Cursor}, renderer, text::{Paragraph, Text}, widget::{tree, Tree}, - Border, Clipboard, Element, Event, Layout, Length, Pixels, Rectangle, Shadow, Shell, Size, - Widget, + Clipboard, Layout, Shell, Widget, }, - graphics, - runtime::Font, - scrollable, text, - text::LineHeight, - Container, Scrollable, + alignment::{Horizontal, Vertical}, + event, + mouse::{self, Cursor}, + widget::{container, scrollable, text, text::LineHeight, Container, Scrollable}, + Border, Element, Event, Font, Length, Pixels, Rectangle, Shadow, Size, }; use std::{fmt::Display, hash::Hash, marker::PhantomData}; @@ -29,16 +25,11 @@ pub use list::List; /// A widget for selecting a single value from a dynamic scrollable list of options. #[allow(missing_debug_implementations)] #[allow(clippy::type_repetition_in_bounds)] -pub struct SelectionList< - 'a, - T, - Message, - Theme = iced_widget::Theme, - Renderer = iced_widget::Renderer, -> where +pub struct SelectionList<'a, T, Message, Theme = iced::Theme, Renderer = iced::Renderer> +where T: Clone + ToString + Eq + Hash, [T]: ToOwned>, - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet + container::StyleSheet, { /// Container for Rendering List. @@ -63,7 +54,7 @@ pub struct SelectionList< impl<'a, T, Message, Theme, Renderer> SelectionList<'a, T, Message, Theme, Renderer> where Message: 'a + Clone, - Renderer: 'a + core::Renderer + core::text::Renderer, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: 'a + StyleSheet + container::StyleSheet + scrollable::StyleSheet, T: Clone + Display + Eq + Hash, [T]: ToOwned>, @@ -160,7 +151,7 @@ impl<'a, T, Message, Theme, Renderer> Widget where T: 'a + Clone + ToString + Eq + Hash + Display, Message: 'static, - Renderer: core::Renderer + core::text::Renderer + 'a, + Renderer: renderer::Renderer + iced::advanced::text::Renderer + 'a, Theme: StyleSheet + container::StyleSheet, { fn children(&self) -> Vec { @@ -312,7 +303,7 @@ impl<'a, T, Message, Theme, Renderer> From, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: 'a + StyleSheet + container::StyleSheet, { fn from(selection_list: SelectionList<'a, T, Message, Theme, Renderer>) -> Self { diff --git a/src/native/selection_list/list.rs b/src/native/selection_list/list.rs index c2810004..da22285a 100644 --- a/src/native/selection_list/list.rs +++ b/src/native/selection_list/list.rs @@ -2,21 +2,23 @@ use crate::selection_list::StyleSheet; -use iced_widget::{ - core::{ - self, - alignment::{Horizontal, Vertical}, - event, layout, - mouse::{self, Cursor}, - renderer, touch, +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + renderer, widget::{ tree::{State, Tag}, Tree, }, - Border, Clipboard, Color, Element, Event, Layout, Length, Pixels, Point, Rectangle, Shadow, - Shell, Size, Widget, + Clipboard, Layout, Shell, Widget, }, - text::LineHeight, + alignment::{Horizontal, Vertical}, + event, + mouse::{self, Cursor}, + touch, + widget::text::LineHeight, + Border, Color, Element, Event, Length, Pixels, Point, Rectangle, Shadow, Size, }; use std::{ collections::hash_map::DefaultHasher, @@ -31,7 +33,7 @@ pub struct List<'a, T: 'a, Message, Theme, Renderer> where T: Clone + Display + Eq + Hash, [T]: ToOwned>, - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet, { /// Options pointer to hold all rendered strings @@ -68,7 +70,7 @@ impl<'a, T, Message, Theme, Renderer> Widget for List<'a, T, Message, Theme, Renderer> where T: Clone + Display + Eq + Hash, - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet, { fn tag(&self) -> Tag { @@ -114,12 +116,7 @@ where Size::new(Length::Fill, Length::Shrink) } - fn layout( - &self, - _tree: &mut Tree, - _renderer: &Renderer, - limits: &layout::Limits, - ) -> layout::Node { + fn layout(&self, _tree: &mut Tree, _renderer: &Renderer, limits: &Limits) -> Node { use std::f32; let limits = limits.height(Length::Fill).width(Length::Fill); @@ -129,7 +126,7 @@ where (self.text_size + self.padding * 2.0) * self.options.len() as f32, ); - layout::Node::new(intrinsic) + Node::new(intrinsic) } fn on_event( @@ -266,7 +263,7 @@ where }; renderer.fill_text( - core::text::Text { + iced::advanced::text::Text { content: &list_state.options[i], bounds: Size::new(f32::INFINITY, bounds.height), size: Pixels(self.text_size), @@ -274,7 +271,7 @@ where horizontal_alignment: Horizontal::Left, vertical_alignment: Vertical::Center, line_height: LineHeight::default(), - shaping: iced_widget::text::Shaping::Advanced, + shaping: iced::widget::text::Shaping::Advanced, }, Point::new(bounds.x, bounds.center_y()), text_color, @@ -289,7 +286,7 @@ impl<'a, T, Message, Theme, Renderer> From where T: Clone + Display + Eq + Hash, Message: 'a, - Renderer: 'a + core::Renderer + core::text::Renderer, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: 'a + StyleSheet, { fn from(list: List<'a, T, Message, Theme, Renderer>) -> Element<'a, Message, Theme, Renderer> { diff --git a/src/native/slide_bar.rs b/src/native/slide_bar.rs index 19dbec5e..f43b1efe 100644 --- a/src/native/slide_bar.rs +++ b/src/native/slide_bar.rs @@ -2,14 +2,17 @@ //! //! *This API requires the following crate features to be activated: `quad`* -use iced_widget::core::{ +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + renderer, + widget::tree::{self, Tree}, + Clipboard, Layout, Shell, Widget, + }, event, - layout::{Limits, Node}, mouse::{self, Cursor}, - renderer, touch, - widget::{tree, Tree}, - Border, Clipboard, Color, Element, Event, Layout, Length, Point, Rectangle, Shadow, Shell, - Size, Widget, + touch, Border, Color, Element, Event, Length, Point, Rectangle, Shadow, Size, }; use std::ops::RangeInclusive; diff --git a/src/native/spinner.rs b/src/native/spinner.rs index 4908bacd..43288aa2 100644 --- a/src/native/spinner.rs +++ b/src/native/spinner.rs @@ -2,18 +2,20 @@ use crate::style::spinner::StyleSheet; -use iced_widget::core::{ +use iced::{ self, + advanced::{ + layout::{Limits, Node}, + renderer, + widget::{ + tree::{State, Tag}, + Tree, + }, + Clipboard, Layout, Shell, Widget, + }, event::Status, - layout::{Limits, Node}, mouse::Cursor, - renderer, - widget::{ - tree::{State, Tag}, - Tree, - }, - window, Border, Clipboard, Color, Element, Event, Layout, Length, Rectangle, Shadow, Shell, - Size, Vector, Widget, + window, Border, Color, Element, Event, Length, Rectangle, Shadow, Size, Vector, }; use std::time::{Duration, Instant}; @@ -79,7 +81,12 @@ fn is_visible(bounds: &Rectangle) -> bool { bounds.width > 0.0 && bounds.height > 0.0 } -fn fill_circle(renderer: &mut impl core::Renderer, position: Vector, radius: f32, color: Color) { +fn fill_circle( + renderer: &mut impl renderer::Renderer, + position: Vector, + radius: f32, + color: Color, +) { renderer.fill_quad( renderer::Quad { bounds: Rectangle { @@ -101,7 +108,7 @@ fn fill_circle(renderer: &mut impl core::Renderer, position: Vector, radius: f32 impl Widget for Spinner where - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { fn size(&self) -> Size { @@ -206,7 +213,7 @@ where impl<'a, Message, Theme, Renderer> From for Element<'a, Message, Theme, Renderer> where - Renderer: core::Renderer + 'a, + Renderer: renderer::Renderer + 'a, Theme: 'a + StyleSheet, { fn from(spinner: Spinner) -> Self { diff --git a/src/native/split.rs b/src/native/split.rs index 3cecd24d..d096a4b7 100644 --- a/src/native/split.rs +++ b/src/native/split.rs @@ -2,21 +2,22 @@ //! //! *This API requires the following crate features to be activated: split* -use iced_widget::{ - container, - core::{ - self, event, +use iced::{ + self, + advanced::{ layout::{Limits, Node}, - mouse::{self, Cursor}, - renderer, touch, + overlay, renderer, widget::{ tree::{State, Tag}, Operation, Tree, }, - Border, Clipboard, Color, Element, Event, Layout, Length, Padding, Point, Rectangle, - Shadow, Shell, Size, Vector, Widget, + Clipboard, Layout, Shell, Widget, }, - Container, Row, + event, + mouse::{self, Cursor}, + touch, + widget::{container, Container, Row}, + Border, Color, Element, Event, Length, Padding, Point, Rectangle, Shadow, Size, Vector, }; pub use crate::style::split::{Appearance, StyleSheet}; @@ -42,7 +43,7 @@ pub use crate::style::split::{Appearance, StyleSheet}; #[allow(missing_debug_implementations)] pub struct Split<'a, Message, Theme, Renderer> where - Renderer: core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, { /// The first element of the [`Split`]. @@ -75,7 +76,7 @@ where impl<'a, Message, Theme, Renderer> Split<'a, Message, Theme, Renderer> where Message: 'a, - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: 'a + StyleSheet + container::StyleSheet, { /// Creates a new [`Split`]. @@ -174,7 +175,7 @@ where impl<'a, Message, Theme, Renderer> Widget for Split<'a, Message, Theme, Renderer> where - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: StyleSheet, { fn tag(&self) -> Tag { @@ -499,7 +500,7 @@ where layout: Layout<'_>, renderer: &Renderer, translation: Vector, - ) -> Option> { + ) -> Option> { let mut children = layout.children(); let first_layout = children.next()?; let _divider_layout = children.next()?; @@ -535,7 +536,7 @@ fn horizontal_split<'a, Message, Theme, Renderer>( space: &Node, ) -> Node where - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: StyleSheet, { if space.bounds().height @@ -614,7 +615,7 @@ fn vertical_split<'a, Message, Theme, Renderer>( space: &Node, ) -> Node where - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: StyleSheet, { if space.bounds().width @@ -688,7 +689,7 @@ impl<'a, Message, Theme, Renderer> From> for Element<'a, Message, Theme, Renderer> where Message: 'a, - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Theme: 'a + StyleSheet, { fn from(split_pane: Split<'a, Message, Theme, Renderer>) -> Self { diff --git a/src/native/tab_bar.rs b/src/native/tab_bar.rs index 5eebf23a..b4bde00f 100644 --- a/src/native/tab_bar.rs +++ b/src/native/tab_bar.rs @@ -8,21 +8,23 @@ pub mod tab_label; use crate::graphics::icons::{icon_to_string, BootstrapIcon, BOOTSTRAP_FONT}; -use iced_widget::{ - core::{ - self, - alignment::{self, Horizontal, Vertical}, - event, layout, - mouse::{self, Cursor}, - renderer, touch, +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + renderer, widget::Tree, - Alignment, Border, Clipboard, Color, Element, Event, Layout, Length, Point, Rectangle, - Shadow, Shell, Size, Widget, + Clipboard, Layout, Shell, Widget, }, - runtime::Font, - text::{self, LineHeight}, - Column, Row, Text, + alignment::{self, Horizontal, Vertical}, + event, + mouse::{self, Cursor}, + touch, + widget::{text, text::LineHeight, Column, Row, Text}, + Alignment, Background, Border, Color, Element, Event, Font, Length, Pixels, Point, Rectangle, + Shadow, Size, }; + use std::marker::PhantomData; pub use crate::style::tab_bar::{Appearance, StyleSheet}; @@ -66,9 +68,9 @@ const DEFAULT_SPACING: f32 = 0.0; /// .set_active_tab(&TabId::One); /// ``` #[allow(missing_debug_implementations)] -pub struct TabBar +pub struct TabBar where - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet, TabId: Eq + Clone, { @@ -128,7 +130,7 @@ pub enum Position { impl TabBar where - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet, TabId: Eq + Clone, { @@ -340,7 +342,7 @@ where impl Widget for TabBar where - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet + text::StyleSheet, TabId: Eq + Clone, { @@ -348,28 +350,23 @@ where Size::new(self.width, self.height) } - fn layout( - &self, - tree: &mut Tree, - renderer: &Renderer, - limits: &layout::Limits, - ) -> layout::Node { + fn layout(&self, tree: &mut Tree, renderer: &Renderer, limits: &Limits) -> Node { fn layout_icon( icon: &char, size: f32, font: Option, ) -> Text<'_, Theme, Renderer> where - Renderer: iced_widget::core::text::Renderer, + Renderer: iced::advanced::text::Renderer, Renderer::Font: From, - Theme: iced_widget::text::StyleSheet, + Theme: iced::widget::text::StyleSheet, { Text::::new(icon.to_string()) .size(size) .font(font.unwrap_or_default()) .horizontal_alignment(alignment::Horizontal::Center) .vertical_alignment(alignment::Vertical::Center) - .shaping(text::Shaping::Advanced) + .shaping(iced::advanced::text::Shaping::Advanced) .width(Length::Shrink) } @@ -379,9 +376,9 @@ where font: Option, ) -> Text<'_, Theme, Renderer> where - Renderer: iced_widget::core::text::Renderer, + Renderer: iced::advanced::text::Renderer, Renderer::Font: From, - Theme: iced_widget::text::StyleSheet, + Theme: iced::widget::text::StyleSheet, { Text::::new(text) .size(size) @@ -664,7 +661,7 @@ fn draw_tab( text_data: (Font, f32), close_size: f32, ) where - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet + text::StyleSheet, { fn icon_bound_rectangle(item: Option>) -> Rectangle { @@ -710,15 +707,15 @@ fn draw_tab( let icon_bounds = icon_bound_rectangle(label_layout_children.next()); renderer.fill_text( - core::text::Text { + iced::advanced::text::Text { content: &icon.to_string(), bounds: Size::new(icon_bounds.width, icon_bounds.height), - size: core::Pixels(icon_data.1), + size: Pixels(icon_data.1), font: icon_data.0, horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, line_height: LineHeight::Relative(1.3), - shaping: iced_widget::text::Shaping::Advanced, + shaping: iced::advanced::text::Shaping::Advanced, }, Point::new(icon_bounds.center_x(), icon_bounds.center_y()), style.icon_color, @@ -730,15 +727,15 @@ fn draw_tab( let text_bounds = text_bound_rectangle(label_layout_children.next()); renderer.fill_text( - core::text::Text { + iced::advanced::text::Text { content: &text[..], bounds: Size::new(text_bounds.width, text_bounds.height), - size: core::Pixels(text_data.1), + size: Pixels(text_data.1), font: text_data.0, horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, line_height: LineHeight::Relative(1.3), - shaping: iced_widget::text::Shaping::Advanced, + shaping: iced::advanced::text::Shaping::Advanced, }, Point::new(text_bounds.center_x(), text_bounds.center_y()), style.text_color, @@ -777,15 +774,15 @@ fn draw_tab( } renderer.fill_text( - core::text::Text { + iced::advanced::text::Text { content: &icon.to_string(), bounds: Size::new(icon_bounds.width, icon_bounds.height), - size: core::Pixels(icon_data.1), + size: Pixels(icon_data.1), font: icon_data.0, horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, line_height: LineHeight::Relative(1.3), - shaping: iced_widget::text::Shaping::Advanced, + shaping: iced::advanced::text::Shaping::Advanced, }, Point::new(icon_bounds.center_x(), icon_bounds.center_y()), style.icon_color, @@ -793,15 +790,15 @@ fn draw_tab( ); renderer.fill_text( - core::text::Text { + iced::advanced::text::Text { content: &text[..], bounds: Size::new(text_bounds.width, text_bounds.height), - size: core::Pixels(text_data.1), + size: Pixels(text_data.1), font: text_data.0, horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, line_height: LineHeight::Relative(1.3), - shaping: iced_widget::text::Shaping::Advanced, + shaping: iced::advanced::text::Shaping::Advanced, }, Point::new(text_bounds.center_x(), text_bounds.center_y()), style.text_color, @@ -815,15 +812,15 @@ fn draw_tab( let is_mouse_over_cross = cursor.is_over(cross_bounds); renderer.fill_text( - core::text::Text { + iced::advanced::text::Text { content: &icon_to_string(BootstrapIcon::X), bounds: Size::new(cross_bounds.width, cross_bounds.height), - size: core::Pixels(close_size + if is_mouse_over_cross { 1.0 } else { 0.0 }), + size: Pixels(close_size + if is_mouse_over_cross { 1.0 } else { 0.0 }), font: BOOTSTRAP_FONT, horizontal_alignment: Horizontal::Center, vertical_alignment: Vertical::Center, line_height: LineHeight::Relative(1.3), - shaping: iced_widget::text::Shaping::Basic, + shaping: iced::advanced::text::Shaping::Basic, }, Point::new(cross_bounds.center_x(), cross_bounds.center_y()), style.text_color, @@ -843,7 +840,7 @@ fn draw_tab( }, style .icon_background - .unwrap_or(core::Background::Color(Color::TRANSPARENT)), + .unwrap_or(Background::Color(Color::TRANSPARENT)), ); } }; @@ -852,7 +849,7 @@ fn draw_tab( impl<'a, Message, TabId, Theme, Renderer> From> for Element<'a, Message, Theme, Renderer> where - Renderer: 'a + core::Renderer + core::text::Renderer, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: 'a + StyleSheet + text::StyleSheet, Message: 'a, TabId: 'a + Eq + Clone, diff --git a/src/native/tabs.rs b/src/native/tabs.rs index 0317c098..b8b65914 100644 --- a/src/native/tabs.rs +++ b/src/native/tabs.rs @@ -10,20 +10,21 @@ pub mod tab_bar_position; pub use crate::tab_bar::Position; use crate::{native::tab_bar::TabBar, style::tab_bar::StyleSheet, TabLabel}; -use iced_widget::{ - core::{ - self, event, +use iced::{ + self, + advanced::{ layout::{Limits, Node}, - mouse::{self, Cursor}, - renderer, + overlay, renderer, widget::{ tree::{State, Tag}, Operation, Tree, }, - Clipboard, Element, Event, Layout, Length, Point, Rectangle, Shell, Size, Vector, Widget, + Clipboard, Layout, Shell, Widget, }, - runtime::Font, - text, Row, + event, + mouse::{self, Cursor}, + widget::{text, Row}, + Element, Event, Font, Length, Point, Rectangle, Size, Vector, }; pub use tab_bar_position::TabBarPosition; @@ -56,9 +57,9 @@ pub use tab_bar_position::TabBarPosition; /// ``` /// #[allow(missing_debug_implementations)] -pub struct Tabs<'a, Message, TabId, Theme = iced_widget::Theme, Renderer = iced_widget::Renderer> +pub struct Tabs<'a, Message, TabId, Theme = iced::Theme, Renderer = iced::Renderer> where - Renderer: 'a + core::Renderer + core::text::Renderer, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet, TabId: Eq + Clone, { @@ -80,7 +81,7 @@ where impl<'a, Message, TabId, Theme, Renderer> Tabs<'a, Message, TabId, Theme, Renderer> where - Renderer: 'a + core::Renderer + core::text::Renderer, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet + text::StyleSheet, TabId: Eq + Clone, { @@ -291,7 +292,7 @@ where impl<'a, Message, TabId, Theme, Renderer> Widget for Tabs<'a, Message, TabId, Theme, Renderer> where - Renderer: core::Renderer + core::text::Renderer, + Renderer: renderer::Renderer + iced::advanced::text::Renderer, Theme: StyleSheet + text::StyleSheet, TabId: Eq + Clone, { @@ -559,7 +560,7 @@ where layout: Layout<'_>, renderer: &Renderer, translation: Vector, - ) -> Option> { + ) -> Option> { let layout = match self.tab_bar_position { TabBarPosition::Top => layout.children().nth(1), TabBarPosition::Bottom => layout.children().next(), @@ -606,7 +607,7 @@ where impl<'a, Message, TabId, Theme, Renderer> From> for Element<'a, Message, Theme, Renderer> where - Renderer: 'a + core::Renderer + core::text::Renderer, + Renderer: 'a + renderer::Renderer + iced::advanced::text::Renderer, Theme: 'a + StyleSheet + text::StyleSheet, Message: 'a, TabId: 'a + Eq + Clone, diff --git a/src/native/time_picker.rs b/src/native/time_picker.rs index 889ba2c3..d3143086 100644 --- a/src/native/time_picker.rs +++ b/src/native/time_picker.rs @@ -5,18 +5,25 @@ use super::overlay::time_picker::{self, TimePickerOverlay, TimePickerOverlayButtons}; use chrono::Local; -use iced_widget::{ - button, container, - core::{ - event, +use iced::{ + self, + advanced::{ layout::{Limits, Node}, - mouse::{self, Cursor}, overlay, renderer, widget::tree::{self, Tag, Tree}, - Clipboard, Element, Event, Layout, Length, Point, Rectangle, Shell, Vector, Widget, + Clipboard, Layout, Shell, Widget, }, - renderer::Renderer, - text, + event, + mouse::{self, Cursor}, + widget::{button, container, text}, + Element, + Event, + Length, + Point, + Rectangle, + Renderer, // the actual type + Size, + Vector, }; pub use crate::{ @@ -187,7 +194,7 @@ where tree.diff_children(&[&self.underlay, &self.overlay_state]); } - fn size(&self) -> iced_widget::core::Size { + fn size(&self) -> Size { self.underlay.as_widget().size() } diff --git a/src/native/wrap.rs b/src/native/wrap.rs index 332b8ed6..86d2a6b5 100644 --- a/src/native/wrap.rs +++ b/src/native/wrap.rs @@ -1,26 +1,23 @@ //! A widget that displays its children in multiple horizontal or vertical runs. //! //! *This API requires the following crate features to be activated: `wrap`* -use iced_widget::core::{ - self, event, - layout::{Limits, Node}, +use iced::{ + self, + advanced::{ + layout::{Limits, Node}, + overlay, renderer, + widget::{Operation, Tree}, + Clipboard, Layout, Shell, Widget, + }, + event, mouse::{self, Cursor}, - renderer, - widget::{Operation, Tree}, - Alignment, Clipboard, Element, Event, Layout, Length, Padding, Point, Rectangle, Shell, Size, - Vector, Widget, + Alignment, Element, Event, Length, Padding, Point, Rectangle, Size, Vector, }; use std::marker::PhantomData; /// A container that distributes its contents horizontally. #[allow(missing_debug_implementations)] -pub struct Wrap< - 'a, - Message, - Direction, - Theme = iced_widget::Theme, - Renderer = iced_widget::Renderer, -> { +pub struct Wrap<'a, Message, Direction, Theme = iced::Theme, Renderer = iced::Renderer> { /// The elements to distribute. pub elements: Vec>, /// The alignment of the [`Wrap`]. @@ -164,7 +161,7 @@ impl<'a, Message, Renderer, Direction, Theme> Widget for Wrap<'a, Message, Direction, Theme, Renderer> where Self: WrapLayout, - Renderer: core::Renderer, + Renderer: renderer::Renderer, { fn children(&self) -> Vec { self.elements.iter().map(Tree::new).collect() @@ -218,7 +215,7 @@ where layout: Layout<'_>, renderer: &Renderer, translation: Vector, - ) -> Option> { + ) -> Option> { self.elements .iter_mut() .zip(&mut state.children) @@ -296,7 +293,7 @@ where impl<'a, Message, Theme, Renderer> From> for Element<'a, Message, Theme, Renderer> where - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Message: 'a, Theme: 'a, { @@ -310,7 +307,7 @@ where impl<'a, Message, Theme, Renderer> From> for Element<'a, Message, Theme, Renderer> where - Renderer: 'a + core::Renderer, + Renderer: 'a + renderer::Renderer, Message: 'a, Theme: 'a, { @@ -343,7 +340,7 @@ impl<'a, Message, Renderer, Direction, Theme> Default /// A inner layout of the [`Wrap`]. pub trait WrapLayout where - Renderer: core::Renderer, + Renderer: renderer::Renderer, { /// A inner layout of the [`Wrap`]. fn inner_layout(&self, tree: &mut Tree, renderer: &Renderer, limits: &Limits) -> Node; @@ -352,7 +349,7 @@ where impl<'a, Message, Theme, Renderer> WrapLayout for Wrap<'a, Message, direction::Horizontal, Theme, Renderer> where - Renderer: core::Renderer + 'a, + Renderer: renderer::Renderer + 'a, { #[allow(clippy::inline_always)] #[inline(always)] @@ -439,7 +436,7 @@ where impl<'a, Message, Theme, Renderer> WrapLayout for Wrap<'a, Message, direction::Vertical, Theme, Renderer> where - Renderer: core::Renderer + 'a, + Renderer: renderer::Renderer + 'a, { #[allow(clippy::inline_always)] #[inline(always)] diff --git a/src/style/badge.rs b/src/style/badge.rs index 09ad6646..a430f41d 100644 --- a/src/style/badge.rs +++ b/src/style/badge.rs @@ -3,10 +3,8 @@ //! *This API requires the following crate features to be activated: badge* use super::colors; -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; + /// The appearance of a [`Badge`](crate::native::badge::Badge). #[derive(Clone, Copy, Debug)] pub struct Appearance { diff --git a/src/style/card.rs b/src/style/card.rs index b595476e..39c26ba1 100644 --- a/src/style/card.rs +++ b/src/style/card.rs @@ -3,10 +3,7 @@ //! *This API requires the following crate features to be activated: card* use super::colors; -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; /// The appearance of a [`Card`](crate::native::card::Card). #[derive(Clone, Copy, Debug)] diff --git a/src/style/color_picker.rs b/src/style/color_picker.rs index 8f886d6b..fbdf0140 100644 --- a/src/style/color_picker.rs +++ b/src/style/color_picker.rs @@ -4,10 +4,7 @@ use std::rc::Rc; -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; /// The appearance of a [`ColorPicker`](crate::native::ColorPicker). #[derive(Clone, Copy, Debug)] diff --git a/src/style/colors.rs b/src/style/colors.rs index 7b245ee0..bee3729b 100644 --- a/src/style/colors.rs +++ b/src/style/colors.rs @@ -5,7 +5,7 @@ //! * [W3 Schools](https://www.w3schools.com/cssref/css_colors.asp) //! * [Corecoding](https://corecoding.com/utilities/rgb-or-hex-to-float.php) -use iced_widget::core::Color; +use iced::Color; /// Primary Color. pub const PRIMARY: Color = DODGER_BLUE; diff --git a/src/style/context_menu.rs b/src/style/context_menu.rs index f2e49153..af9c3dd2 100644 --- a/src/style/context_menu.rs +++ b/src/style/context_menu.rs @@ -3,10 +3,7 @@ //! *This API requires the following crate features to be activated: badge* use std::rc::Rc; -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; /// The appearance of a [`ContextMenu`](crate::native::ContextMenu). #[derive(Clone, Copy, Debug)] diff --git a/src/style/date_picker.rs b/src/style/date_picker.rs index 83a24bce..1b71d28f 100644 --- a/src/style/date_picker.rs +++ b/src/style/date_picker.rs @@ -4,10 +4,7 @@ use std::rc::Rc; -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; /// The appearance of a [`DatePicker`](crate::native::DatePicker). #[derive(Clone, Copy, Debug)] diff --git a/src/style/modal.rs b/src/style/modal.rs index 0e046420..94355be9 100644 --- a/src/style/modal.rs +++ b/src/style/modal.rs @@ -3,10 +3,7 @@ //! *This API requires the following crate features to be activated: badge* use std::rc::Rc; -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; /// The appearance of a [`Modal`](crate::native::Modal). #[derive(Clone, Copy, Debug)] diff --git a/src/style/number_input.rs b/src/style/number_input.rs index fcdae0a8..faab7d81 100644 --- a/src/style/number_input.rs +++ b/src/style/number_input.rs @@ -2,10 +2,7 @@ //! //! *This API requires the following crate features to be activated: `number_input`* -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; /// The appearance of a [`NumberInput`](crate::native::number_input::NumberInput). #[derive(Clone, Copy, Debug)] diff --git a/src/style/segmented_button.rs b/src/style/segmented_button.rs index 093144a3..8937cbc3 100644 --- a/src/style/segmented_button.rs +++ b/src/style/segmented_button.rs @@ -1,9 +1,7 @@ //! Use a `segmented_button` as an alternative to radio button. -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; + /// The appearance of a [`SegmentedButton`] #[derive(Clone, Copy, Debug)] pub struct Appearance { diff --git a/src/style/selection_list.rs b/src/style/selection_list.rs index 09969b6a..c473c029 100644 --- a/src/style/selection_list.rs +++ b/src/style/selection_list.rs @@ -4,10 +4,7 @@ use std::rc::Rc; -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; /// The appearance of a menu. #[derive(Debug, Clone, Copy)] diff --git a/src/style/spinner.rs b/src/style/spinner.rs index 389457e1..1b9c1892 100644 --- a/src/style/spinner.rs +++ b/src/style/spinner.rs @@ -2,7 +2,7 @@ //! //! *This API requires the following crate features to be activated: spinner* -use iced_widget::style::Theme; +use iced::Theme; /// The style of a [`Spinner`](crate::native::spinner::Spinner). #[derive(Default)] diff --git a/src/style/split.rs b/src/style/split.rs index 638ee8e0..3fd0f2b6 100644 --- a/src/style/split.rs +++ b/src/style/split.rs @@ -2,10 +2,7 @@ //! //! *This API requires the following crate features to be activated: split* -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; /// The appearance of a [`Split`](crate::native::split::Split). #[derive(Clone, Copy, Debug)] diff --git a/src/style/tab_bar.rs b/src/style/tab_bar.rs index 2a8ba4ad..1cb31aac 100644 --- a/src/style/tab_bar.rs +++ b/src/style/tab_bar.rs @@ -8,10 +8,7 @@ use std::rc::Rc; -use iced_widget::{ - core::{border::Radius, Background, Color}, - style::Theme, -}; +use iced::{border::Radius, Background, Color, Theme}; /// The appearance of a [`TabBar`](crate::native::tab_bar::TabBar). #[derive(Clone, Copy, Debug)] diff --git a/src/style/time_picker.rs b/src/style/time_picker.rs index 41b53109..4e43d51f 100644 --- a/src/style/time_picker.rs +++ b/src/style/time_picker.rs @@ -3,10 +3,7 @@ //! *This API requires the following crate features to be activated: `time_picker`* use std::rc::Rc; -use iced_widget::{ - core::{Background, Color}, - style::Theme, -}; +use iced::{Background, Color, Theme}; /// The appearance of a [`TimePicker`](crate::native::TimePicker). #[derive(Clone, Copy, Debug)]