Skip to content

Commit

Permalink
Merge pull request #204 from rizzen-yazston/to_0_12_0
Browse files Browse the repository at this point in the history
Core updated to iced 0.12.0. Most examples compile.
  • Loading branch information
Andrew Wheeler(Genusis) authored Feb 16, 2024
2 parents 80f6ced + a640d80 commit 9f80b30
Show file tree
Hide file tree
Showing 60 changed files with 700 additions and 613 deletions.
24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ 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
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 = []
Expand Down Expand Up @@ -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
Expand All @@ -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",
Expand All @@ -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 = "./"
Expand Down
6 changes: 4 additions & 2 deletions examples/multiple_modals/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
33 changes: 23 additions & 10 deletions examples/split_scroller/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
]
Expand All @@ -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(),
]
Expand All @@ -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(),
]
Expand Down
2 changes: 1 addition & 1 deletion examples/tabs/src/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Tab for LoginTab {
.on_input(LoginMessage::PasswordChanged)
.padding(10)
.size(32)
.password(),
.secure(true),
)
.push(
Row::new()
Expand Down
4 changes: 2 additions & 2 deletions src/core/clock.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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};

Expand Down
4 changes: 2 additions & 2 deletions src/core/color.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down Expand Up @@ -99,7 +99,7 @@ impl From<Hsv> for Color {

#[cfg(test)]
mod tests {
use iced_widget::core::Color;
use iced::Color;

use super::Hsv;

Expand Down
2 changes: 1 addition & 1 deletion src/core/overlay.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/core/renderer.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/icons.rs
Original file line number Diff line number Diff line change
@@ -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")] {
Expand Down
3 changes: 1 addition & 2 deletions src/graphics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
28 changes: 16 additions & 12 deletions src/native/badge.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -30,9 +34,9 @@ const BORDER_RADIUS_RATIO: f32 = 34.0 / 15.0;
/// let badge = Badge::<Message>::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`].
Expand All @@ -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.
Expand Down Expand Up @@ -122,7 +126,7 @@ impl<'a, Message, Theme, Renderer> Widget<Message, Theme, Renderer>
for Badge<'a, Message, Theme, Renderer>
where
Message: 'a + Clone,
Renderer: 'a + core::Renderer,
Renderer: 'a + renderer::Renderer,
Theme: StyleSheet,
{
fn children(&self) -> Vec<Tree> {
Expand Down Expand Up @@ -263,7 +267,7 @@ impl<'a, Message, Theme, Renderer> From<Badge<'a, Message, Theme, Renderer>>
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 {
Expand Down
Loading

0 comments on commit 9f80b30

Please sign in to comment.