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
use crate::{AttrType, Color};
use glib::translate::*;
define_attribute_struct!(
AttrColor,
ffi::PangoAttrColor,
&[
AttrType::Foreground,
AttrType::Background,
AttrType::UnderlineColor,
AttrType::StrikethroughColor,
AttrType::OverlineColor
]
);
impl AttrColor {
#[doc(alias = "pango_attr_background_new")]
pub fn new_background(red: u16, green: u16, blue: u16) -> Self {
unsafe { from_glib_full(ffi::pango_attr_background_new(red, green, blue)) }
}
#[doc(alias = "pango_attr_foreground_new")]
pub fn new_foreground(red: u16, green: u16, blue: u16) -> Self {
unsafe { from_glib_full(ffi::pango_attr_foreground_new(red, green, blue)) }
}
#[cfg(any(feature = "v1_46", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_46")))]
#[doc(alias = "pango_attr_overline_color_new")]
pub fn new_overline_color(red: u16, green: u16, blue: u16) -> Self {
unsafe { from_glib_full(ffi::pango_attr_overline_color_new(red, green, blue)) }
}
#[doc(alias = "pango_attr_strikethrough_color_new")]
pub fn new_strikethrough_color(red: u16, green: u16, blue: u16) -> Self {
unsafe { from_glib_full(ffi::pango_attr_strikethrough_color_new(red, green, blue)) }
}
#[doc(alias = "pango_attr_underline_color_new")]
pub fn new_underline_color(red: u16, green: u16, blue: u16) -> Self {
unsafe { from_glib_full(ffi::pango_attr_underline_color_new(red, green, blue)) }
}
pub fn color(&self) -> Color {
unsafe { from_glib_none((&self.inner.color) as *const ffi::PangoColor) }
}
}