use crate::tokens::DESIGN_TOKENS;
use egui::Color32;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct DrawingId(pub usize);
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
pub enum DrawingLineStyle {
#[default]
Solid,
Dashed,
Dotted,
}
impl DrawingLineStyle {
pub fn label(&self) -> &'static str {
match self {
Self::Solid => "Solid",
Self::Dashed => "Dashed",
Self::Dotted => "Dotted",
}
}
pub fn all() -> [Self; 3] {
[Self::Solid, Self::Dashed, Self::Dotted]
}
}
#[derive(Clone, Debug)]
pub struct DrawingProps {
pub color: Color32,
pub line_width: f32,
pub line_style: DrawingLineStyle,
pub fill_color: Option<Color32>,
pub fill_enabled: bool,
pub extend_left: bool,
pub extend_right: bool,
pub show_price: bool,
pub label: String,
pub font_size: f32,
pub visible_all_timeframes: bool,
pub visible_timeframes: Vec<String>,
}
impl Default for DrawingProps {
fn default() -> Self {
Self {
color: DESIGN_TOKENS.semantic.extended.accent,
line_width: 1.0,
line_style: DrawingLineStyle::Solid,
fill_color: None,
fill_enabled: false,
extend_left: false,
extend_right: false,
show_price: false,
label: String::new(),
font_size: 12.0,
visible_all_timeframes: true,
visible_timeframes: Vec::new(),
}
}
}
#[derive(Clone, Debug)]
pub enum DrawingPropertiesAction {
None,
Cancel,
Apply(DrawingId, DrawingProps),
Delete(DrawingId),
Clone(DrawingId),
}