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
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use StateFlags;
use StyleProvider;
use ffi;
use glib;
use glib::object::IsA;
use glib::translate::*;
use std::fmt;

glib_wrapper! {
    pub struct StyleProperties(Object<ffi::GtkStyleProperties, ffi::GtkStylePropertiesClass, StylePropertiesClass>) @implements StyleProvider;

    match fn {
        get_type => || ffi::gtk_style_properties_get_type(),
    }
}

impl StyleProperties {
    #[cfg_attr(feature = "v3_16", deprecated)]
    pub fn new() -> StyleProperties {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::gtk_style_properties_new())
        }
    }
}

#[cfg_attr(feature = "v3_16", deprecated)]
impl Default for StyleProperties {
    fn default() -> Self {
        Self::new()
    }
}

pub const NONE_STYLE_PROPERTIES: Option<&StyleProperties> = None;

pub trait StylePropertiesExt: 'static {
    #[cfg_attr(feature = "v3_16", deprecated)]
    fn clear(&self);

    //#[cfg_attr(feature = "v3_16", deprecated)]
    //fn get(&self, state: StateFlags, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);

    #[cfg_attr(feature = "v3_16", deprecated)]
    fn get_property(&self, property: &str, state: StateFlags) -> Option<glib::Value>;

    //#[cfg_attr(feature = "v3_16", deprecated)]
    //fn get_valist(&self, state: StateFlags, args: /*Unknown conversion*//*Unimplemented*/Unsupported);

    #[cfg_attr(feature = "v3_16", deprecated)]
    fn merge<P: IsA<StyleProperties>>(&self, props_to_merge: &P, replace: bool);

    //#[cfg_attr(feature = "v3_16", deprecated)]
    //fn set(&self, state: StateFlags, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);

    #[cfg_attr(feature = "v3_16", deprecated)]
    fn set_property(&self, property: &str, state: StateFlags, value: &glib::Value);

    //#[cfg_attr(feature = "v3_16", deprecated)]
    //fn set_valist(&self, state: StateFlags, args: /*Unknown conversion*//*Unimplemented*/Unsupported);

    #[cfg_attr(feature = "v3_16", deprecated)]
    fn unset_property(&self, property: &str, state: StateFlags);
}

impl<O: IsA<StyleProperties>> StylePropertiesExt for O {
    fn clear(&self) {
        unsafe {
            ffi::gtk_style_properties_clear(self.as_ref().to_glib_none().0);
        }
    }

    //fn get(&self, state: StateFlags, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
    //    unsafe { TODO: call ffi::gtk_style_properties_get() }
    //}

    fn get_property(&self, property: &str, state: StateFlags) -> Option<glib::Value> {
        unsafe {
            let mut value = glib::Value::uninitialized();
            let ret = from_glib(ffi::gtk_style_properties_get_property(self.as_ref().to_glib_none().0, property.to_glib_none().0, state.to_glib(), value.to_glib_none_mut().0));
            if ret { Some(value) } else { None }
        }
    }

    //fn get_valist(&self, state: StateFlags, args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
    //    unsafe { TODO: call ffi::gtk_style_properties_get_valist() }
    //}

    fn merge<P: IsA<StyleProperties>>(&self, props_to_merge: &P, replace: bool) {
        unsafe {
            ffi::gtk_style_properties_merge(self.as_ref().to_glib_none().0, props_to_merge.as_ref().to_glib_none().0, replace.to_glib());
        }
    }

    //fn set(&self, state: StateFlags, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
    //    unsafe { TODO: call ffi::gtk_style_properties_set() }
    //}

    fn set_property(&self, property: &str, state: StateFlags, value: &glib::Value) {
        unsafe {
            ffi::gtk_style_properties_set_property(self.as_ref().to_glib_none().0, property.to_glib_none().0, state.to_glib(), value.to_glib_none().0);
        }
    }

    //fn set_valist(&self, state: StateFlags, args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
    //    unsafe { TODO: call ffi::gtk_style_properties_set_valist() }
    //}

    fn unset_property(&self, property: &str, state: StateFlags) {
        unsafe {
            ffi::gtk_style_properties_unset_property(self.as_ref().to_glib_none().0, property.to_glib_none().0, state.to_glib());
        }
    }
}

impl fmt::Display for StyleProperties {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "StyleProperties")
    }
}