1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use glib::translate::*; 6 use glib::value::FromValue; 7 use glib::value::FromValueOptional; 8 use glib::value::SetValue; 9 use glib::value::Value; 10 use glib::StaticType; 11 use glib::Type; 12 use gobject_sys; 13 use pango_sys; 14 15 bitflags! { 16 pub struct FontMask: u32 { 17 const FAMILY = 1; 18 const STYLE = 2; 19 const VARIANT = 4; 20 const WEIGHT = 8; 21 const STRETCH = 16; 22 const SIZE = 32; 23 const GRAVITY = 64; 24 const VARIATIONS = 128; 25 } 26 } 27 28 #[doc(hidden)] 29 impl ToGlib for FontMask { 30 type GlibType = pango_sys::PangoFontMask; 31 to_glib(&self) -> pango_sys::PangoFontMask32 fn to_glib(&self) -> pango_sys::PangoFontMask { 33 self.bits() 34 } 35 } 36 37 #[doc(hidden)] 38 impl FromGlib<pango_sys::PangoFontMask> for FontMask { from_glib(value: pango_sys::PangoFontMask) -> FontMask39 fn from_glib(value: pango_sys::PangoFontMask) -> FontMask { 40 FontMask::from_bits_truncate(value) 41 } 42 } 43 44 impl StaticType for FontMask { static_type() -> Type45 fn static_type() -> Type { 46 unsafe { from_glib(pango_sys::pango_font_mask_get_type()) } 47 } 48 } 49 50 impl<'a> FromValueOptional<'a> for FontMask { from_value_optional(value: &Value) -> Option<Self>51 unsafe fn from_value_optional(value: &Value) -> Option<Self> { 52 Some(FromValue::from_value(value)) 53 } 54 } 55 56 impl<'a> FromValue<'a> for FontMask { from_value(value: &Value) -> Self57 unsafe fn from_value(value: &Value) -> Self { 58 from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0)) 59 } 60 } 61 62 impl SetValue for FontMask { set_value(value: &mut Value, this: &Self)63 unsafe fn set_value(value: &mut Value, this: &Self) { 64 gobject_sys::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) 65 } 66 } 67