summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-20 13:29:25 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-20 13:29:25 +0100
commit25f182f933ea6b7c112c8f9a450a98dc9b9eebdd (patch)
treefdc498d705f033d3c432e6a06b8cd223dfd82633 /examples
parent4d502012b3e3ed9d9ef80f21078d53d182cdaa1b (diff)
downloadiced-25f182f933ea6b7c112c8f9a450a98dc9b9eebdd.tar.gz
iced-25f182f933ea6b7c112c8f9a450a98dc9b9eebdd.tar.bz2
iced-25f182f933ea6b7c112c8f9a450a98dc9b9eebdd.zip
Introduce `Border` struct analogous to `Shadow`
Diffstat (limited to 'examples')
-rw-r--r--examples/custom_quad/src/main.rs14
-rw-r--r--examples/custom_widget/src/main.rs4
-rw-r--r--examples/modal/src/main.rs6
-rw-r--r--examples/pane_grid/src/main.rs16
-rw-r--r--examples/scrollable/src/main.rs16
5 files changed, 30 insertions, 26 deletions
diff --git a/examples/custom_quad/src/main.rs b/examples/custom_quad/src/main.rs
index e3f110bb..14f62caa 100644
--- a/examples/custom_quad/src/main.rs
+++ b/examples/custom_quad/src/main.rs
@@ -3,8 +3,8 @@ mod quad {
use iced::advanced::layout::{self, Layout};
use iced::advanced::renderer;
use iced::advanced::widget::{self, Widget};
- use iced::{mouse, Shadow};
- use iced::{Color, Element, Length, Rectangle, Size};
+ use iced::mouse;
+ use iced::{Border, Color, Element, Length, Rectangle, Shadow, Size};
pub struct CustomQuad {
size: f32,
@@ -62,10 +62,12 @@ mod quad {
renderer.fill_quad(
renderer::Quad {
bounds: layout.bounds(),
- border_radius: self.radius.into(),
- border_width: self.border_width,
- border_color: Color::from_rgb(1.0, 0.0, 0.0),
- shadow: Some(self.shadow),
+ border: Border {
+ radius: self.radius.into(),
+ width: self.border_width,
+ color: Color::from_rgb(1.0, 0.0, 0.0),
+ },
+ shadow: self.shadow,
},
Color::BLACK,
);
diff --git a/examples/custom_widget/src/main.rs b/examples/custom_widget/src/main.rs
index 6578183d..d5ecebaf 100644
--- a/examples/custom_widget/src/main.rs
+++ b/examples/custom_widget/src/main.rs
@@ -13,7 +13,7 @@ mod circle {
use iced::advanced::renderer;
use iced::advanced::widget::{self, Widget};
use iced::mouse;
- use iced::{Color, Element, Length, Rectangle, Size};
+ use iced::{Border, Color, Element, Length, Rectangle, Size};
pub struct Circle {
radius: f32,
@@ -62,7 +62,7 @@ mod circle {
renderer.fill_quad(
renderer::Quad {
bounds: layout.bounds(),
- border_radius: self.radius.into(),
+ border: Border::with_radius(self.radius),
..renderer::Quad::default()
},
Color::BLACK,
diff --git a/examples/modal/src/main.rs b/examples/modal/src/main.rs
index 59287c06..c9d5df29 100644
--- a/examples/modal/src/main.rs
+++ b/examples/modal/src/main.rs
@@ -231,10 +231,7 @@ mod modal {
use iced::alignment::Alignment;
use iced::event;
use iced::mouse;
- use iced::{
- BorderRadius, Color, Element, Event, Length, Point, Rectangle, Size,
- Vector,
- };
+ use iced::{Color, Element, Event, Length, Point, Rectangle, Size, Vector};
/// A widget that centers a modal element over some base element
pub struct Modal<'a, Message, Renderer> {
@@ -474,7 +471,6 @@ mod modal {
renderer.fill_quad(
renderer::Quad {
bounds: layout.bounds(),
- border_radius: BorderRadius::default(),
..renderer::Quad::default()
},
Color {
diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs
index d5e5bcbe..742dc344 100644
--- a/examples/pane_grid/src/main.rs
+++ b/examples/pane_grid/src/main.rs
@@ -348,7 +348,7 @@ fn view_controls<'a>(
mod style {
use iced::widget::container;
- use iced::Theme;
+ use iced::{Border, Theme};
pub fn title_bar_active(theme: &Theme) -> container::Appearance {
let palette = theme.extended_palette();
@@ -375,8 +375,11 @@ mod style {
container::Appearance {
background: Some(palette.background.weak.color.into()),
- border_width: 2.0,
- border_color: palette.background.strong.color,
+ border: Border {
+ width: 2.0,
+ color: palette.background.strong.color,
+ ..Border::default()
+ },
..Default::default()
}
}
@@ -386,8 +389,11 @@ mod style {
container::Appearance {
background: Some(palette.background.weak.color.into()),
- border_width: 2.0,
- border_color: palette.primary.strong.color,
+ border: Border {
+ width: 2.0,
+ color: palette.primary.strong.color,
+ ..Border::default()
+ },
..Default::default()
}
}
diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs
index 4b57a5a4..ff691917 100644
--- a/examples/scrollable/src/main.rs
+++ b/examples/scrollable/src/main.rs
@@ -1,10 +1,14 @@
+use iced::executor;
+use iced::theme;
use iced::widget::scrollable::{Properties, Scrollbar, Scroller};
use iced::widget::{
button, column, container, horizontal_space, progress_bar, radio, row,
scrollable, slider, text, vertical_space,
};
-use iced::{executor, theme, Alignment, Color};
-use iced::{Application, Command, Element, Length, Settings, Theme};
+use iced::{
+ Alignment, Application, Border, Color, Command, Element, Length, Settings,
+ Theme,
+};
use once_cell::sync::Lazy;
@@ -373,14 +377,10 @@ impl scrollable::StyleSheet for ScrollbarCustomStyle {
background: style
.active(&theme::Scrollable::default())
.background,
- border_radius: 2.0.into(),
- border_width: 0.0,
- border_color: Color::default(),
+ border: Border::with_radius(2),
scroller: Scroller {
color: Color::from_rgb8(250, 85, 134),
- border_radius: 2.0.into(),
- border_width: 0.0,
- border_color: Color::default(),
+ border: Border::with_radius(2),
},
}
} else {