[go: up one dir, main page]

gtk4/auto/
style_provider.rs

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
5use crate::ffi;
6use glib::{
7    object::ObjectType as _,
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "GtkStyleProvider")]
16    pub struct StyleProvider(Interface<ffi::GtkStyleProvider>);
17
18    match fn {
19        type_ => || ffi::gtk_style_provider_get_type(),
20    }
21}
22
23impl StyleProvider {
24    pub const NONE: Option<&'static StyleProvider> = None;
25}
26
27pub trait StyleProviderExt: IsA<StyleProvider> + 'static {
28    #[doc(alias = "gtk-private-changed")]
29    fn connect_gtk_private_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
30        unsafe extern "C" fn gtk_private_changed_trampoline<
31            P: IsA<StyleProvider>,
32            F: Fn(&P) + 'static,
33        >(
34            this: *mut ffi::GtkStyleProvider,
35            f: glib::ffi::gpointer,
36        ) {
37            let f: &F = &*(f as *const F);
38            f(StyleProvider::from_glib_borrow(this).unsafe_cast_ref())
39        }
40        unsafe {
41            let f: Box_<F> = Box_::new(f);
42            connect_raw(
43                self.as_ptr() as *mut _,
44                c"gtk-private-changed".as_ptr() as *const _,
45                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
46                    gtk_private_changed_trampoline::<Self, F> as *const (),
47                )),
48                Box_::into_raw(f),
49            )
50        }
51    }
52}
53
54impl<O: IsA<StyleProvider>> StyleProviderExt for O {}