1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use crate::StateFlags; 6 use crate::WidgetPath; 7 use glib::object::IsA; 8 use glib::translate::*; 9 use std::fmt; 10 11 glib::wrapper! { 12 #[doc(alias = "GtkStyleProvider")] 13 pub struct StyleProvider(Interface<ffi::GtkStyleProvider, ffi::GtkStyleProviderIface>); 14 15 match fn { 16 type_ => || ffi::gtk_style_provider_get_type(), 17 } 18 } 19 20 pub const NONE_STYLE_PROVIDER: Option<&StyleProvider> = None; 21 22 pub trait StyleProviderExt: 'static { 23 #[doc(alias = "gtk_style_provider_get_style_property")] 24 #[doc(alias = "get_style_property")] style_property( &self, path: &WidgetPath, state: StateFlags, pspec: &glib::ParamSpec, ) -> Option<glib::Value>25 fn style_property( 26 &self, 27 path: &WidgetPath, 28 state: StateFlags, 29 pspec: &glib::ParamSpec, 30 ) -> Option<glib::Value>; 31 } 32 33 impl<O: IsA<StyleProvider>> StyleProviderExt for O { style_property( &self, path: &WidgetPath, state: StateFlags, pspec: &glib::ParamSpec, ) -> Option<glib::Value>34 fn style_property( 35 &self, 36 path: &WidgetPath, 37 state: StateFlags, 38 pspec: &glib::ParamSpec, 39 ) -> Option<glib::Value> { 40 unsafe { 41 let mut value = glib::Value::uninitialized(); 42 let ret = from_glib(ffi::gtk_style_provider_get_style_property( 43 self.as_ref().to_glib_none().0, 44 path.to_glib_none().0, 45 state.into_glib(), 46 pspec.to_glib_none().0, 47 value.to_glib_none_mut().0, 48 )); 49 if ret { 50 Some(value) 51 } else { 52 None 53 } 54 } 55 } 56 } 57 58 impl fmt::Display for StyleProvider { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result59 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 60 f.write_str("StyleProvider") 61 } 62 } 63