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

use glib::bitflags::bitflags;
use glib::prelude::*;
use glib::translate::*;

use crate::ffi;

bitflags! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "GlyMemoryFormatSelection")]
    pub struct MemoryFormatSelection: u32 {
        #[doc(alias = "GLY_MEMORY_SELECTION_B8G8R8A8_PREMULTIPLIED")]
        const B8G8R8A8_PREMULTIPLIED = ffi::GLY_MEMORY_SELECTION_B8G8R8A8_PREMULTIPLIED as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_A8R8G8B8_PREMULTIPLIED")]
        const A8R8G8B8_PREMULTIPLIED = ffi::GLY_MEMORY_SELECTION_A8R8G8B8_PREMULTIPLIED as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R8G8B8A8_PREMULTIPLIED")]
        const R8G8B8A8_PREMULTIPLIED = ffi::GLY_MEMORY_SELECTION_R8G8B8A8_PREMULTIPLIED as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_B8G8R8A8")]
        const B8G8R8A8 = ffi::GLY_MEMORY_SELECTION_B8G8R8A8 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_A8R8G8B8")]
        const A8R8G8B8 = ffi::GLY_MEMORY_SELECTION_A8R8G8B8 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R8G8B8A8")]
        const R8G8B8A8 = ffi::GLY_MEMORY_SELECTION_R8G8B8A8 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_A8B8G8R8")]
        const A8B8G8R8 = ffi::GLY_MEMORY_SELECTION_A8B8G8R8 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R8G8B8")]
        const R8G8B8 = ffi::GLY_MEMORY_SELECTION_R8G8B8 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_B8G8R8")]
        const B8G8R8 = ffi::GLY_MEMORY_SELECTION_B8G8R8 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R16G16B16")]
        const R16G16B16 = ffi::GLY_MEMORY_SELECTION_R16G16B16 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R16G16B16A16_PREMULTIPLIED")]
        const R16G16B16A16_PREMULTIPLIED = ffi::GLY_MEMORY_SELECTION_R16G16B16A16_PREMULTIPLIED as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R16G16B16A16")]
        const R16G16B16A16 = ffi::GLY_MEMORY_SELECTION_R16G16B16A16 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R16G16B16_FLOAT")]
        const R16G16B16_FLOAT = ffi::GLY_MEMORY_SELECTION_R16G16B16_FLOAT as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R16G16B16A16_FLOAT")]
        const R16G16B16A16_FLOAT = ffi::GLY_MEMORY_SELECTION_R16G16B16A16_FLOAT as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R32G32B32_FLOAT")]
        const R32G32B32_FLOAT = ffi::GLY_MEMORY_SELECTION_R32G32B32_FLOAT as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R32G32B32A32_FLOAT_PREMULTIPLIED")]
        const R32G32B32A32_FLOAT_PREMULTIPLIED = ffi::GLY_MEMORY_SELECTION_R32G32B32A32_FLOAT_PREMULTIPLIED as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_R32G32B32A32_FLOAT")]
        const R32G32B32A32_FLOAT = ffi::GLY_MEMORY_SELECTION_R32G32B32A32_FLOAT as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_G8A8_PREMULTIPLIED")]
        const G8A8_PREMULTIPLIED = ffi::GLY_MEMORY_SELECTION_G8A8_PREMULTIPLIED as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_G8A8")]
        const G8A8 = ffi::GLY_MEMORY_SELECTION_G8A8 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_G8")]
        const G8 = ffi::GLY_MEMORY_SELECTION_G8 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_G16A16_PREMULTIPLIED")]
        const G16A16_PREMULTIPLIED = ffi::GLY_MEMORY_SELECTION_G16A16_PREMULTIPLIED as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_G16A16")]
        const G16A16 = ffi::GLY_MEMORY_SELECTION_G16A16 as _;
        #[doc(alias = "GLY_MEMORY_SELECTION_G16")]
        const G16 = ffi::GLY_MEMORY_SELECTION_G16 as _;
    }
}

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

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

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

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

impl glib::HasParamSpec for MemoryFormatSelection {
    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 MemoryFormatSelection {
    type Type = Self;
}

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

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

impl ToValue for MemoryFormatSelection {
    #[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<MemoryFormatSelection> for glib::Value {
    #[inline]
    fn from(v: MemoryFormatSelection) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}
