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

use ffi;
use glib::StaticType;
use glib::Type;
use glib::translate::*;
use glib::value::FromValue;
use glib::value::FromValueOptional;
use glib::value::SetValue;
use glib::value::Value;
use gobject_ffi;

bitflags! {
    pub struct FontMask: u32 {
        const FAMILY = 1;
        const STYLE = 2;
        const VARIANT = 4;
        const WEIGHT = 8;
        const STRETCH = 16;
        const SIZE = 32;
        const GRAVITY = 64;
    }
}

#[doc(hidden)]
impl ToGlib for FontMask {
    type GlibType = ffi::PangoFontMask;

    fn to_glib(&self) -> ffi::PangoFontMask {
        ffi::PangoFontMask::from_bits_truncate(self.bits())
    }
}

#[doc(hidden)]
impl FromGlib<ffi::PangoFontMask> for FontMask {
    fn from_glib(value: ffi::PangoFontMask) -> FontMask {
        FontMask::from_bits_truncate(value.bits())
    }
}

impl StaticType for FontMask {
    fn static_type() -> Type {
        unsafe { from_glib(ffi::pango_font_mask_get_type()) }
    }
}

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

impl<'a> FromValue<'a> for FontMask {
    unsafe fn from_value(value: &Value) -> Self {
        from_glib(ffi::PangoFontMask::from_bits_truncate(gobject_ffi::g_value_get_flags(value.to_glib_none().0)))
    }
}

impl SetValue for FontMask {
    unsafe fn set_value(value: &mut Value, this: &Self) {
        gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib().bits())
    }
}

