Skip to main content

egui_charts/ui/dialogs/drawing_properties/tabs/
mod.rs

1//! Drawing properties tabs.
2
3mod coordinates;
4mod inputs;
5mod style;
6mod text;
7mod visibility;
8
9pub use coordinates::{CoordinatePoint, CoordinatesState, CoordinatesTab};
10pub use style::StyleTab;
11pub use text::TextTab;
12pub use visibility::VisibilityTab;
13
14use crate::ui_kit::tab_bar::TabLabel;
15
16/// Tab selection for drawing properties
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
18pub enum PropertiesTab {
19    #[default]
20    /// Drawing line, fill and color settings.
21    Style,
22    /// Drawing anchor coordinates.
23    Coordinates,
24    /// Tool-specific levels, sizing and calculation settings.
25    Inputs,
26    /// Interval visibility settings.
27    Visibility,
28    /// Drawing text and its appearance.
29    Text,
30}
31
32impl PropertiesTab {
33    /// Display label for this value.
34    pub fn label(&self) -> &'static str {
35        match self {
36            Self::Style => "Style",
37            Self::Coordinates => "Coordinates",
38            Self::Inputs => "Inputs",
39            Self::Visibility => "Visibility",
40            Self::Text => "Text",
41        }
42    }
43
44    /// Values in display order.
45    pub fn all() -> [Self; 5] {
46        [
47            Self::Style,
48            Self::Inputs,
49            Self::Coordinates,
50            Self::Visibility,
51            Self::Text,
52        ]
53    }
54}
55
56impl TabLabel for PropertiesTab {
57    fn tab_label(&self) -> &str {
58        self.label()
59    }
60}
61
62pub(super) use inputs::InputsTab;