sequoia_style/
split_panel_style.rs1use sequoia_core::Color;
2
3#[derive(Clone, Copy, Debug, Default, PartialEq)]
4pub struct SplitPanelStyle {
5 pub handle: Option<Color>,
6 pub handle_active: Option<Color>,
7 pub handle_width: Option<f32>,
8}
9
10impl SplitPanelStyle {
11 pub const fn new() -> Self {
12 Self {
13 handle: None,
14 handle_active: None,
15 handle_width: None,
16 }
17 }
18
19 pub const fn handle(mut self, color: Color) -> Self {
20 self.handle = Some(color);
21 self
22 }
23
24 pub const fn handle_active(mut self, color: Color) -> Self {
25 self.handle_active = Some(color);
26 self
27 }
28
29 pub const fn handle_width(mut self, width: f32) -> Self {
30 self.handle_width = Some(width);
31 self
32 }
33}
34
35#[cfg(test)]
36mod tests {
37 use super::*;
38
39 #[test]
40 fn const_composition_keeps_base() {
41 const CUSTOM: SplitPanelStyle = SplitPanelStyle::new().handle_width(9.0);
42 assert_eq!(CUSTOM.handle_width, Some(9.0));
43 assert_eq!(CUSTOM.handle, None);
44 }
45}