added function focused and focused_horizontal to theme.rs

This commit is contained in:
Giuliano Bellini s294739 2023-01-23 17:56:39 +01:00
parent eaa2238600
commit 49e9a9a537
2 changed files with 19 additions and 2 deletions

View file

@ -859,7 +859,7 @@ pub fn draw<Renderer>(
} else if mouse_over_scrollable { } else if mouse_over_scrollable {
theme.focused(style) theme.focused(style)
} else { } else {
theme.focused(style) theme.active(style)
}; };
draw_scrollbar(renderer, style, &scrollbar); draw_scrollbar(renderer, style, &scrollbar);
@ -874,7 +874,7 @@ pub fn draw<Renderer>(
} else if mouse_over_scrollable { } else if mouse_over_scrollable {
theme.focused_horizontal(style) theme.focused_horizontal(style)
} else { } else {
theme.focused_horizontal(style) theme.active_horizontal(style)
}; };
draw_scrollbar(renderer, style, &scrollbar); draw_scrollbar(renderer, style, &scrollbar);

View file

@ -935,6 +935,13 @@ impl scrollable::StyleSheet for Theme {
} }
} }
fn focused(&self, style: &Self::Style) -> scrollable::Scrollbar {
match style {
Scrollable::Default => self.active(style),
Scrollable::Custom(custom) => custom.focused(self),
}
}
fn active_horizontal(&self, style: &Self::Style) -> scrollable::Scrollbar { fn active_horizontal(&self, style: &Self::Style) -> scrollable::Scrollbar {
match style { match style {
Scrollable::Default => self.active(style), Scrollable::Default => self.active(style),
@ -958,6 +965,16 @@ impl scrollable::StyleSheet for Theme {
Scrollable::Custom(custom) => custom.dragging_horizontal(self), Scrollable::Custom(custom) => custom.dragging_horizontal(self),
} }
} }
fn focused_horizontal(
&self,
style: &Self::Style,
) -> scrollable::Scrollbar {
match style {
Scrollable::Default => self.active_horizontal(style),
Scrollable::Custom(custom) => custom.focused_horizontal(self),
}
}
} }
/// The style of text. /// The style of text.