summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Giuliano Bellini s294739 <s294739@studenti.polito.it>2023-01-23 16:57:24 +0100
committerLibravatar Giuliano Bellini s294739 <s294739@studenti.polito.it>2023-01-23 16:57:24 +0100
commit7d2d813343baae10c2667590463385d50abb784c (patch)
treedd52002abbc0fe0df683a0413616892e79ea0676
parenteb4fcba05fb54741289a28ec9b921c90c9acc7fd (diff)
downloadiced-7d2d813343baae10c2667590463385d50abb784c.tar.gz
iced-7d2d813343baae10c2667590463385d50abb784c.tar.bz2
iced-7d2d813343baae10c2667590463385d50abb784c.zip
added new style for scrollable, to be applied when mouse is over the scrollable area
-rw-r--r--native/src/widget/scrollable.rs4
-rw-r--r--style/src/scrollable.rs10
2 files changed, 14 insertions, 0 deletions
diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs
index 82286036..de6eacb5 100644
--- a/native/src/widget/scrollable.rs
+++ b/native/src/widget/scrollable.rs
@@ -856,6 +856,8 @@ pub fn draw<Renderer>(
theme.dragging(style)
} else if mouse_over_y_scrollbar {
theme.hovered(style)
+ } else if mouse_over_scrollable {
+ theme.focused(style)
} else {
theme.active(style)
};
@@ -869,6 +871,8 @@ pub fn draw<Renderer>(
theme.dragging_horizontal(style)
} else if mouse_over_x_scrollbar {
theme.hovered_horizontal(style)
+ } else if mouse_over_scrollable {
+ theme.focused_horizontal(style)
} else {
theme.active_horizontal(style)
};
diff --git a/style/src/scrollable.rs b/style/src/scrollable.rs
index 64ed8462..a3f3db20 100644
--- a/style/src/scrollable.rs
+++ b/style/src/scrollable.rs
@@ -45,6 +45,11 @@ pub trait StyleSheet {
self.hovered(style)
}
+ /// Produces the style of a scrollbar when mouse is over the scrollable area.
+ fn focused(&self, style: &Self::Style) -> Scrollbar {
+ self.active(style)
+ }
+
/// Produces the style of an active horizontal scrollbar.
fn active_horizontal(&self, style: &Self::Style) -> Scrollbar {
self.active(style)
@@ -59,4 +64,9 @@ pub trait StyleSheet {
fn dragging_horizontal(&self, style: &Self::Style) -> Scrollbar {
self.hovered_horizontal(style)
}
+
+ /// Produces the style of a horizontal scrollbar when mouse is over the scrollable area.
+ fn focused_horizontal(&self, style: &Self::Style) -> Scrollbar {
+ self.active_horizontal(style)
+ }
}