diff --git a/Gir.toml b/Gir.toml index 2da939c..39c4ec1 100644 --- a/Gir.toml +++ b/Gir.toml @@ -68,6 +68,10 @@ status = "generate" name = "log2vis_get_embedding_levels" #out param ignore = true + [[object.function]] + pattern = "attr_.+" + #moved to Attribute + ignore = true [[object]] name = "Pango.AttrList" diff --git a/src/attribute.rs b/src/attribute.rs index 0f7f9b0..a6a7ae0 100644 --- a/src/attribute.rs +++ b/src/attribute.rs @@ -4,9 +4,133 @@ use Attribute; use AttrClass; +use Gravity; +use GravityHint; +use Stretch; +use Style; +use Underline; +use Variant; +use Weight; +use ffi; use glib::translate::*; impl Attribute { + #[cfg(feature = "v1_38")] + pub fn new_background_alpha(alpha: u16) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_background_alpha_new(alpha)) + } + } + + pub fn new_background(red: u16, green: u16, blue: u16) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_background_new(red, green, blue)) + } + } + + pub fn new_fallback(enable_fallback: bool) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_fallback_new(enable_fallback.to_glib())) + } + } + + pub fn new_family(family: &str) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_family_new(family.to_glib_none().0)) + } + } + + #[cfg(feature = "v1_38")] + pub fn new_foreground_alpha(alpha: u16) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_foreground_alpha_new(alpha)) + } + } + + pub fn new_foreground(red: u16, green: u16, blue: u16) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_foreground_new(red, green, blue)) + } + } + + pub fn new_gravity_hint(hint: GravityHint) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_gravity_hint_new(hint.to_glib())) + } + } + + pub fn new_gravity(gravity: Gravity) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_gravity_new(gravity.to_glib())) + } + } + + pub fn new_letter_spacing(letter_spacing: i32) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_letter_spacing_new(letter_spacing)) + } + } + + pub fn new_rise(rise: i32) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_rise_new(rise)) + } + } + + pub fn new_scale(scale_factor: f64) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_scale_new(scale_factor)) + } + } + + pub fn new_stretch(stretch: Stretch) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_stretch_new(stretch.to_glib())) + } + } + + pub fn new_strikethrough_color(red: u16, green: u16, blue: u16) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_strikethrough_color_new(red, green, blue)) + } + } + + pub fn new_strikethrough(strikethrough: bool) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_strikethrough_new(strikethrough.to_glib())) + } + } + + pub fn new_style(style: Style) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_style_new(style.to_glib())) + } + } + + pub fn new_underline_color(red: u16, green: u16, blue: u16) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_underline_color_new(red, green, blue)) + } + } + + pub fn new_underline(underline: Underline) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_underline_new(underline.to_glib())) + } + } + + pub fn new_variant(variant: Variant) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_variant_new(variant.to_glib())) + } + } + + pub fn new_weight(weight: Weight) -> Option { + unsafe { + from_glib_full(ffi::pango_attr_weight_new(weight.to_glib())) + } + } + pub fn get_attr_class(&self) -> AttrClass { unsafe { from_glib_full((*self.to_glib_none().0).klass) diff --git a/src/auto/functions.rs b/src/auto/functions.rs index e20fa40..e8bd7ea 100644 --- a/src/auto/functions.rs +++ b/src/auto/functions.rs @@ -1,14 +1,10 @@ // This file was generated by gir (9e3f4cc) from gir-files (0bcaef9) // DO NOT EDIT -use Attribute; use Direction; -use Gravity; -use GravityHint; use Rectangle; use Stretch; use Style; -use Underline; use Variant; use Weight; use ffi; @@ -18,122 +14,6 @@ use std::mem; use std::ptr; -#[cfg(feature = "v1_38")] -pub fn attr_background_alpha_new(alpha: u16) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_background_alpha_new(alpha)) - } -} - -pub fn attr_background_new(red: u16, green: u16, blue: u16) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_background_new(red, green, blue)) - } -} - -pub fn attr_fallback_new(enable_fallback: bool) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_fallback_new(enable_fallback.to_glib())) - } -} - -pub fn attr_family_new(family: &str) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_family_new(family.to_glib_none().0)) - } -} - -#[cfg(feature = "v1_38")] -pub fn attr_foreground_alpha_new(alpha: u16) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_foreground_alpha_new(alpha)) - } -} - -pub fn attr_foreground_new(red: u16, green: u16, blue: u16) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_foreground_new(red, green, blue)) - } -} - -pub fn attr_gravity_hint_new(hint: GravityHint) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_gravity_hint_new(hint.to_glib())) - } -} - -pub fn attr_gravity_new(gravity: Gravity) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_gravity_new(gravity.to_glib())) - } -} - -pub fn attr_letter_spacing_new(letter_spacing: i32) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_letter_spacing_new(letter_spacing)) - } -} - -pub fn attr_rise_new(rise: i32) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_rise_new(rise)) - } -} - -pub fn attr_scale_new(scale_factor: f64) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_scale_new(scale_factor)) - } -} - -pub fn attr_stretch_new(stretch: Stretch) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_stretch_new(stretch.to_glib())) - } -} - -pub fn attr_strikethrough_color_new(red: u16, green: u16, blue: u16) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_strikethrough_color_new(red, green, blue)) - } -} - -pub fn attr_strikethrough_new(strikethrough: bool) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_strikethrough_new(strikethrough.to_glib())) - } -} - -pub fn attr_style_new(style: Style) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_style_new(style.to_glib())) - } -} - -pub fn attr_underline_color_new(red: u16, green: u16, blue: u16) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_underline_color_new(red, green, blue)) - } -} - -pub fn attr_underline_new(underline: Underline) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_underline_new(underline.to_glib())) - } -} - -pub fn attr_variant_new(variant: Variant) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_variant_new(variant.to_glib())) - } -} - -pub fn attr_weight_new(weight: Weight) -> Option { - unsafe { - from_glib_full(ffi::pango_attr_weight_new(weight.to_glib())) - } -} - //pub fn break_(text: &str, length: i32, analysis: /*Ignored*/&mut Analysis, attrs: /*Ignored*/&[&LogAttr]) { // unsafe { TODO: call ffi::pango_break() } //}