// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use ges_sys;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use glib::StaticType;
use glib::Type;
use gobject_sys;

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum Edge {
    Start,
    End,
    None,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for Edge {
    type GlibType = ges_sys::GESEdge;

    fn to_glib(&self) -> ges_sys::GESEdge {
        match *self {
            Edge::Start => ges_sys::GES_EDGE_START,
            Edge::End => ges_sys::GES_EDGE_END,
            Edge::None => ges_sys::GES_EDGE_NONE,
            Edge::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ges_sys::GESEdge> for Edge {
    fn from_glib(value: ges_sys::GESEdge) -> Self {
        skip_assert_initialized!();
        match value {
            0 => Edge::Start,
            1 => Edge::End,
            2 => Edge::None,
            value => Edge::__Unknown(value),
        }
    }
}

impl StaticType for Edge {
    fn static_type() -> Type {
        unsafe { from_glib(ges_sys::ges_edge_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for Edge {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for Edge {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for Edge {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
pub enum EditMode {
    Normal,
    Ripple,
    Roll,
    Trim,
    Slide,
    #[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl ToGlib for EditMode {
    type GlibType = ges_sys::GESEditMode;

    fn to_glib(&self) -> ges_sys::GESEditMode {
        match *self {
            EditMode::Normal => ges_sys::GES_EDIT_MODE_NORMAL,
            EditMode::Ripple => ges_sys::GES_EDIT_MODE_RIPPLE,
            EditMode::Roll => ges_sys::GES_EDIT_MODE_ROLL,
            EditMode::Trim => ges_sys::GES_EDIT_MODE_TRIM,
            EditMode::Slide => ges_sys::GES_EDIT_MODE_SLIDE,
            EditMode::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ges_sys::GESEditMode> for EditMode {
    fn from_glib(value: ges_sys::GESEditMode) -> Self {
        skip_assert_initialized!();
        match value {
            0 => EditMode::Normal,
            1 => EditMode::Ripple,
            2 => EditMode::Roll,
            3 => EditMode::Trim,
            4 => EditMode::Slide,
            value => EditMode::__Unknown(value),
        }
    }
}

impl StaticType for EditMode {
    fn static_type() -> Type {
        unsafe { from_glib(ges_sys::ges_edit_mode_get_type()) }
    }
}

impl<'a> FromValueOptional<'a> for EditMode {
    unsafe fn from_value_optional(value: &Value) -> Option<Self> {
        Some(FromValue::from_value(value))
    }
}

impl<'a> FromValue<'a> for EditMode {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(gobject_sys::g_value_get_enum(value.to_glib_none().0))
    }
}

impl SetValue for EditMode {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_sys::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib())
    }
}
