veloren_voxygen/ui/ice/renderer/style/
slider.rs1use super::super::super::widget::image;
2use vek::Rgba;
3
4#[derive(Clone, Copy)]
5pub struct Style {
6 pub cursor: Cursor,
7 pub bar: Bar,
8 pub labels: bool,
9 pub cursor_size: (u16, u16),
10 pub bar_height: u16,
11}
12
13impl Default for Style {
14 fn default() -> Self {
15 Self {
16 cursor: Cursor::Color(Rgba::new(0.5, 0.5, 0.5, 1.0)),
17 bar: Bar::Color(Rgba::new(0.5, 0.5, 0.5, 1.0)),
18 labels: false,
19 cursor_size: (8, 16),
20 bar_height: 6,
21 }
22 }
23}
24
25#[derive(Clone, Copy)]
26pub enum Cursor {
27 Color(Rgba<f32>),
28 Image(image::Handle, Rgba<u8>),
29}
30
31#[derive(Clone, Copy)]
32pub enum Bar {
33 Color(Rgba<f32>),
34 Image(image::Handle, Rgba<u8>, u16),
35}
36
37impl Style {
38 pub fn images(
39 cursor: image::Handle,
40 bar: image::Handle,
41 bar_pad: u16,
42 cursor_size: (u16, u16),
43 bar_height: u16,
44 ) -> Self {
45 Self {
46 cursor: Cursor::Image(cursor, Rgba::white()),
47 bar: Bar::Image(bar, Rgba::white(), bar_pad),
48 labels: false,
49 cursor_size,
50 bar_height,
51 }
52 }
53}