use crate::sys;
pub(crate) const IMPLOT_AUTO: i32 = -1;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u32)]
pub enum YAxisChoice {
First = 0,
Second = 1,
Third = 2,
}
pub(crate) fn y_axis_choice_option_to_i32(y_axis_choice: Option<YAxisChoice>) -> i32 {
match y_axis_choice {
Some(choice) => choice as i32,
None => IMPLOT_AUTO,
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(i32)]
pub enum XAxis {
X1 = 0,
X2 = 1,
X3 = 2,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(i32)]
pub enum YAxis {
Y1 = 3,
Y2 = 4,
Y3 = 5,
}
impl YAxis {
pub(crate) fn to_index(self) -> i32 {
(self as i32) - 3
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(i32)]
pub enum Axis {
X1 = 0,
X2 = 1,
X3 = 2,
Y1 = 3,
Y2 = 4,
Y3 = 5,
}
impl Axis {
pub(crate) fn to_sys(self) -> sys::ImAxis {
self as sys::ImAxis
}
}
impl From<XAxis> for Axis {
fn from(axis: XAxis) -> Self {
match axis {
XAxis::X1 => Self::X1,
XAxis::X2 => Self::X2,
XAxis::X3 => Self::X3,
}
}
}
impl From<YAxis> for Axis {
fn from(axis: YAxis) -> Self {
match axis {
YAxis::Y1 => Self::Y1,
YAxis::Y2 => Self::Y2,
YAxis::Y3 => Self::Y3,
}
}
}