// This file was generated by gir (https://github.com/gtk-rs/gir)
// from 
// from ../gir-files-gstreamer
// from ../gir-files-gtk
// from ../libclapper-rs
// DO NOT EDIT

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

glib::wrapper! {
    #[doc(alias = "ClapperGtkAv")]
    pub struct Av(Object<ffi::ClapperGtkAv, ffi::ClapperGtkAvClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;

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

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

pub trait AvExt: IsA<Av> + 'static {
    #[doc(alias = "clapper_gtk_av_get_auto_inhibit")]
    #[doc(alias = "get_auto_inhibit")]
    #[doc(alias = "auto-inhibit")]
    fn is_auto_inhibit(&self) -> bool {
        unsafe {
            from_glib(ffi::clapper_gtk_av_get_auto_inhibit(self.as_ref().to_glib_none().0))
        }
    }

    #[doc(alias = "clapper_gtk_av_get_inhibited")]
    #[doc(alias = "get_inhibited")]
    #[doc(alias = "inhibited")]
    fn is_inhibited(&self) -> bool {
        unsafe {
            from_glib(ffi::clapper_gtk_av_get_inhibited(self.as_ref().to_glib_none().0))
        }
    }

    #[doc(alias = "clapper_gtk_av_get_player")]
    #[doc(alias = "get_player")]
    fn player(&self) -> Option<clapper::Player> {
        unsafe {
            from_glib_none(ffi::clapper_gtk_av_get_player(self.as_ref().to_glib_none().0))
        }
    }

    #[doc(alias = "clapper_gtk_av_set_auto_inhibit")]
    #[doc(alias = "auto-inhibit")]
    fn set_auto_inhibit(&self, inhibit: bool) {
        unsafe {
            ffi::clapper_gtk_av_set_auto_inhibit(self.as_ref().to_glib_none().0, inhibit.into_glib());
        }
    }

    #[cfg(not(feature = "v0_10"))]
    #[cfg_attr(docsrs, doc(cfg(not(feature = "v0_10"))))]
    #[doc(alias = "auto-inhibit")]
    fn is_auto_inhibit(&self) -> bool {
        ObjectExt::property(self.as_ref(), "auto-inhibit")
    }

    #[cfg(not(feature = "v0_10"))]
    #[cfg_attr(docsrs, doc(cfg(not(feature = "v0_10"))))]
    #[doc(alias = "auto-inhibit")]
    fn set_auto_inhibit(&self, auto_inhibit: bool) {
        ObjectExt::set_property(self.as_ref(),"auto-inhibit", auto_inhibit)
    }

    #[cfg(not(feature = "v0_10"))]
    #[cfg_attr(docsrs, doc(cfg(not(feature = "v0_10"))))]
    fn is_inhibited(&self) -> bool {
        ObjectExt::property(self.as_ref(), "inhibited")
    }

    #[cfg(not(feature = "v0_10"))]
    #[cfg_attr(docsrs, doc(cfg(not(feature = "v0_10"))))]
    fn player(&self) -> Option<clapper::Player> {
        ObjectExt::property(self.as_ref(), "player")
    }

    #[doc(alias = "auto-inhibit")]
    fn connect_auto_inhibit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_auto_inhibit_trampoline<P: IsA<Av>, F: Fn(&P) + 'static>(this: *mut ffi::ClapperGtkAv, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(Av::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::auto-inhibit".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_auto_inhibit_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
        }
    }

    #[doc(alias = "inhibited")]
    fn connect_inhibited_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_inhibited_trampoline<P: IsA<Av>, F: Fn(&P) + 'static>(this: *mut ffi::ClapperGtkAv, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(Av::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::inhibited".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_inhibited_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
        }
    }

    #[doc(alias = "player")]
    fn connect_player_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_player_trampoline<P: IsA<Av>, F: Fn(&P) + 'static>(this: *mut ffi::ClapperGtkAv, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer) {
            let f: &F = &*(f as *const F);
            f(Av::from_glib_borrow(this).unsafe_cast_ref())
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(self.as_ptr() as *mut _, c"notify::player".as_ptr() as *const _,
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(notify_player_trampoline::<Self, F> as *const ())), Box_::into_raw(f))
        }
    }
}

impl<O: IsA<Av>> AvExt for O {}
