#[derive(Clone, Copy, Debug)]
pub struct BorderStroke {
pub width: f64,
pub opacity: f64,
}
impl Default for BorderStroke {
fn default() -> Self {
Self { width: 1.0, opacity: 1.0 }
}
}
#[derive(Clone, Copy, Debug, Default)]
pub struct BorderConfig {
pub top: Option<BorderStroke>,
pub right: Option<BorderStroke>,
pub bottom: Option<BorderStroke>,
pub left: Option<BorderStroke>,
}
impl BorderConfig {
pub fn none() -> Self { Self::default() }
pub fn all() -> Self {
let s = Some(BorderStroke::default());
Self { top: s, right: s, bottom: s, left: s }
}
}
#[derive(Clone, Copy, Debug, Default)]
pub struct EdgeHandlesConfig {
pub top: bool,
pub right: bool,
pub bottom: bool,
pub left: bool,
}
impl EdgeHandlesConfig {
pub fn none() -> Self { Self::default() }
pub fn all() -> Self {
Self { top: true, right: true, bottom: true, left: true }
}
}
#[derive(Debug, Clone)]
pub enum BackgroundFill {
Solid,
Glass {
blur_radius: f64,
},
}
pub trait PanelStyle {
fn header_height(&self) -> f64;
fn column_header_height(&self) -> f64;
fn row_height(&self) -> f64;
fn footer_height(&self) -> f64;
fn padding(&self) -> f64;
fn border_width(&self) -> f64;
fn scrollbar_width(&self) -> f64;
fn background_fill(&self) -> BackgroundFill {
BackgroundFill::Solid
}
fn borders(&self) -> BorderConfig {
BorderConfig::none()
}
fn edge_handles(&self) -> EdgeHandlesConfig {
EdgeHandlesConfig::none()
}
fn edge_handle_width(&self) -> f64 { 8.0 }
}
#[derive(Default)]
pub struct DefaultPanelStyle;
impl PanelStyle for DefaultPanelStyle {
fn header_height(&self) -> f64 { 22.0 }
fn column_header_height(&self) -> f64 { 18.0 }
fn row_height(&self) -> f64 { 20.0 }
fn footer_height(&self) -> f64 { 20.0 }
fn padding(&self) -> f64 { 6.0 }
fn border_width(&self) -> f64 { 1.0 }
fn scrollbar_width(&self) -> f64 { 8.0 }
}