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

use crate::ffi;
use glib::{bitflags::bitflags, prelude::*, translate::*};

bitflags! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "PpsAnnotationEditingState")]
    pub struct AnnotationEditingState: u32 {
        #[doc(alias = "PPS_ANNOTATION_EDITING_STATE_NONE")]
        const NONE = ffi::PPS_ANNOTATION_EDITING_STATE_NONE as _;
        #[doc(alias = "PPS_ANNOTATION_EDITING_STATE_INK")]
        const INK = ffi::PPS_ANNOTATION_EDITING_STATE_INK as _;
        #[doc(alias = "PPS_ANNOTATION_EDITING_STATE_TEXT")]
        const TEXT = ffi::PPS_ANNOTATION_EDITING_STATE_TEXT as _;
    }
}

#[doc(hidden)]
impl IntoGlib for AnnotationEditingState {
    type GlibType = ffi::PpsAnnotationEditingState;

    #[inline]
    fn into_glib(self) -> ffi::PpsAnnotationEditingState {
        self.bits()
    }
}

#[doc(hidden)]
impl FromGlib<ffi::PpsAnnotationEditingState> for AnnotationEditingState {
    #[inline]
    unsafe fn from_glib(value: ffi::PpsAnnotationEditingState) -> Self {
        skip_assert_initialized!();
        Self::from_bits_truncate(value)
    }
}

impl StaticType for AnnotationEditingState {
    #[inline]
    #[doc(alias = "pps_annotation_editing_state_get_type")]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::pps_annotation_editing_state_get_type()) }
    }
}

impl glib::HasParamSpec for AnnotationEditingState {
    type ParamSpec = glib::ParamSpecFlags;
    type SetValue = Self;
    type BuilderFn = fn(&str) -> glib::ParamSpecFlagsBuilder<Self>;

    fn param_spec_builder() -> Self::BuilderFn {
        Self::ParamSpec::builder
    }
}

impl glib::value::ValueType for AnnotationEditingState {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AnnotationEditingState {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
    }
}

impl ToValue for AnnotationEditingState {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<AnnotationEditingState> for glib::Value {
    #[inline]
    fn from(v: AnnotationEditingState) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}
