// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    #[doc(alias = "GstColorBalanceChannel")]
    pub struct ColorBalanceChannel(Object<ffi::GstColorBalanceChannel, ffi::GstColorBalanceChannelClass>);

    match fn {
        type_ => || ffi::gst_color_balance_channel_get_type(),
    }
}

impl ColorBalanceChannel {
    pub const NONE: Option<&'static ColorBalanceChannel> = None;
}

unsafe impl Send for ColorBalanceChannel {}
unsafe impl Sync for ColorBalanceChannel {}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::ColorBalanceChannel>> Sealed for T {}
}

pub trait ColorBalanceChannelExt: IsA<ColorBalanceChannel> + sealed::Sealed + 'static {
    #[doc(alias = "value-changed")]
    fn connect_value_changed<F: Fn(&Self, i32) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn value_changed_trampoline<
            P: IsA<ColorBalanceChannel>,
            F: Fn(&P, i32) + Send + Sync + 'static,
        >(
            this: *mut ffi::GstColorBalanceChannel,
            value: libc::c_int,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(
                ColorBalanceChannel::from_glib_borrow(this).unsafe_cast_ref(),
                value,
            )
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"value-changed\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    value_changed_trampoline::<Self, F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl<O: IsA<ColorBalanceChannel>> ColorBalanceChannelExt for O {}
