1use glib::translate::*;
6use glib::value::FromValue;
7use glib::value::FromValueOptional;
8use glib::value::SetValue;
9use glib::value::Value;
10use glib::StaticType;
11use glib::Type;
12use gobject_sys;
13use pango_sys;
14
15bitflags! {
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)]
29impl ToGlib for FontMask {
30 type GlibType = pango_sys::PangoFontMask;
31
32 fn to_glib(&self) -> pango_sys::PangoFontMask {
33 self.bits()
34 }
35}
36
37#[doc(hidden)]
38impl FromGlib<pango_sys::PangoFontMask> for FontMask {
39 fn from_glib(value: pango_sys::PangoFontMask) -> FontMask {
40 FontMask::from_bits_truncate(value)
41 }
42}
43
44impl StaticType for FontMask {
45 fn static_type() -> Type {
46 unsafe { from_glib(pango_sys::pango_font_mask_get_type()) }
47 }
48}
49
50impl<'a> FromValueOptional<'a> for FontMask {
51 unsafe fn from_value_optional(value: &Value) -> Option<Self> {
52 Some(FromValue::from_value(value))
53 }
54}
55
56impl<'a> FromValue<'a> for FontMask {
57 unsafe fn from_value(value: &Value) -> Self {
58 from_glib(gobject_sys::g_value_get_flags(value.to_glib_none().0))
59 }
60}
61
62impl SetValue for FontMask {
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}