iced-yoda/style/src/slider.rs

40 lines
1.1 KiB
Rust
Raw Normal View History

2020-01-07 00:28:08 +01:00
//! Display an interactive selector of a single value from a range of values.
use iced_core::Color;
/// The appearance of a slider.
#[derive(Debug, Clone, Copy)]
pub struct Appearance {
2020-01-07 00:28:08 +01:00
pub rail_colors: (Color, Color),
pub handle: Handle,
}
/// The appearance of the handle of a slider.
#[derive(Debug, Clone, Copy)]
pub struct Handle {
pub shape: HandleShape,
pub color: Color,
pub border_width: f32,
2020-01-07 00:28:08 +01:00
pub border_color: Color,
}
/// The shape of the handle of a slider.
#[derive(Debug, Clone, Copy)]
pub enum HandleShape {
Circle { radius: f32 },
Rectangle { width: u16, border_radius: f32 },
2020-01-07 00:28:08 +01:00
}
/// A set of rules that dictate the style of a slider.
pub trait StyleSheet {
type Style: Default + Copy;
2022-05-26 00:40:27 +02:00
2020-01-07 00:28:08 +01:00
/// Produces the style of an active slider.
fn active(&self, style: Self::Style) -> Appearance;
2020-01-07 00:28:08 +01:00
/// Produces the style of an hovered slider.
fn hovered(&self, style: Self::Style) -> Appearance;
2020-01-07 00:28:08 +01:00
/// Produces the style of a slider that is being dragged.
fn dragging(&self, style: Self::Style) -> Appearance;
2020-01-07 00:28:08 +01:00
}