// 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 glib::{bitflags::bitflags, prelude::*, translate::*};
use std::fmt;

bitflags! {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    #[doc(alias = "AtkHyperlinkStateFlags")]
    pub struct HyperlinkStateFlags: u32 {
        #[doc(alias = "ATK_HYPERLINK_IS_INLINE")]
        const INLINE = ffi::ATK_HYPERLINK_IS_INLINE as _;
    }
}

impl fmt::Display for HyperlinkStateFlags {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        <Self as fmt::Debug>::fmt(self, f)
    }
}

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

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

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

impl StaticType for HyperlinkStateFlags {
    #[inline]
    fn static_type() -> glib::Type {
        unsafe { from_glib(ffi::atk_hyperlink_state_flags_get_type()) }
    }
}

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

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

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

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