Merge pull request #1550 from bungoboingo/feat/multidirectional-scrolling
[Feature] Multidirectional scrolling
This commit is contained in:
commit
7ccd87c36b
12 changed files with 1039 additions and 517 deletions
|
|
@ -37,11 +37,26 @@ pub trait StyleSheet {
|
|||
/// Produces the style of an active scrollbar.
|
||||
fn active(&self, style: &Self::Style) -> Scrollbar;
|
||||
|
||||
/// Produces the style of an hovered scrollbar.
|
||||
/// Produces the style of a hovered scrollbar.
|
||||
fn hovered(&self, style: &Self::Style) -> Scrollbar;
|
||||
|
||||
/// Produces the style of a scrollbar that is being dragged.
|
||||
fn dragging(&self, style: &Self::Style) -> Scrollbar {
|
||||
self.hovered(style)
|
||||
}
|
||||
|
||||
/// Produces the style of an active horizontal scrollbar.
|
||||
fn active_horizontal(&self, style: &Self::Style) -> Scrollbar {
|
||||
self.active(style)
|
||||
}
|
||||
|
||||
/// Produces the style of a hovered horizontal scrollbar.
|
||||
fn hovered_horizontal(&self, style: &Self::Style) -> Scrollbar {
|
||||
self.hovered(style)
|
||||
}
|
||||
|
||||
/// Produces the style of a horizontal scrollbar that is being dragged.
|
||||
fn dragging_horizontal(&self, style: &Self::Style) -> Scrollbar {
|
||||
self.hovered_horizontal(style)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -872,6 +872,15 @@ pub enum Scrollable {
|
|||
Custom(Box<dyn scrollable::StyleSheet<Style = Theme>>),
|
||||
}
|
||||
|
||||
impl Scrollable {
|
||||
/// Creates a custom [`Scrollable`] theme.
|
||||
pub fn custom<T: scrollable::StyleSheet<Style = Theme> + 'static>(
|
||||
style: T,
|
||||
) -> Self {
|
||||
Self::Custom(Box::new(style))
|
||||
}
|
||||
}
|
||||
|
||||
impl scrollable::StyleSheet for Theme {
|
||||
type Style = Scrollable;
|
||||
|
||||
|
|
@ -925,6 +934,30 @@ impl scrollable::StyleSheet for Theme {
|
|||
Scrollable::Custom(custom) => custom.dragging(self),
|
||||
}
|
||||
}
|
||||
|
||||
fn active_horizontal(&self, style: &Self::Style) -> scrollable::Scrollbar {
|
||||
match style {
|
||||
Scrollable::Default => self.active(style),
|
||||
Scrollable::Custom(custom) => custom.active_horizontal(self),
|
||||
}
|
||||
}
|
||||
|
||||
fn hovered_horizontal(&self, style: &Self::Style) -> scrollable::Scrollbar {
|
||||
match style {
|
||||
Scrollable::Default => self.hovered(style),
|
||||
Scrollable::Custom(custom) => custom.hovered_horizontal(self),
|
||||
}
|
||||
}
|
||||
|
||||
fn dragging_horizontal(
|
||||
&self,
|
||||
style: &Self::Style,
|
||||
) -> scrollable::Scrollbar {
|
||||
match style {
|
||||
Scrollable::Default => self.hovered_horizontal(style),
|
||||
Scrollable::Custom(custom) => custom.dragging_horizontal(self),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The style of text.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue