1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
use crate::samplic::Parameter;
use indexmap::IndexMap;
use serde_derive::{Deserialize, Serialize};

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "snake_case", tag = "type")]
pub enum WidgetDescription {
    TabBook {
        tabs: Vec<Tab>,
        tab_position: TabPosition,
    },
    AlignmentBox {
        orientation: Orientation,
        children: Vec<AlignmentBoxChild>,
    },
    ResultTable {
        filter: IndexMap<String, Parameter>,
    },
    ResultGrid {
        columns: u32,
    },
    StatisticsTable {
        filter: IndexMap<String, Parameter>,
    },
    RatioTable {
        properties:
            (IndexMap<String, Parameter>, IndexMap<String, Parameter>),
    },
    Curve {
        curve_index: usize,
    },
    PropertiesSelector {
        properties: IndexMap<String, Parameter>,
        child: Option<Box<WidgetDescription>>,
    },
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "snake_case")]
pub struct AlignmentBoxChild {
    pub description: WidgetDescription,
    pub expand: bool,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "snake_case")]
pub struct Tab {
    pub label: TabLabel,
    pub child: WidgetDescription,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "snake_case", tag = "type", content = "value")]
pub enum TabLabel {
    ThemeIcon(String),
    Text(String),
}

#[derive(Clone, Copy, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum TabPosition {
    Left,
    Right,
    Top,
    Bottom,
}

#[derive(Clone, Copy, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum Orientation {
    Horizontal,
    Vertical,
}