1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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())
}
}