alsactl 0.8.0

API binding for alsactl library
Documentation
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

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

glib::wrapper! {
    /// An object to express information for integer64 type of element.
    ///
    /// A `GObject::Object` derived object class for integer64 type of element.
    ///
    /// The object wraps `struct snd_ctl_elem_info` in UAPI of Linux sound subsystem.
    ///
    /// ## Properties
    ///
    ///
    /// #### `value-max`
    ///  The maximum value of element in value array for the element.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `value-min`
    ///  The minimum value of element in value array for the element.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `value-step`
    ///  The step value of element in value array for the element.
    ///
    /// Readable | Writeable
    /// <details><summary><h4>ElemInfoCommon</h4></summary>
    ///
    ///
    /// #### `access`
    ///  The access permission for the element with [`ElemAccessFlag`][crate::ElemAccessFlag].
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `elem-id`
    ///  The identifier of element.
    ///
    /// Readable
    ///
    ///
    /// #### `elem-type`
    ///  The type of element, one of [`ElemType`][crate::ElemType].
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `owner`
    ///  The value of PID for process to own the element.
    ///
    /// Readable
    /// </details>
    /// <details><summary><h4>ElemInfoSingleArray</h4></summary>
    ///
    ///
    /// #### `value-count`
    ///  The count of elements in value array of the element.
    ///
    /// Readable | Writeable
    /// </details>
    ///
    /// # Implements
    ///
    /// [`ElemInfoInteger64Ext`][trait@crate::prelude::ElemInfoInteger64Ext], [`ElemInfoCommonExt`][trait@crate::prelude::ElemInfoCommonExt], [`ElemInfoSingleArrayExt`][trait@crate::prelude::ElemInfoSingleArrayExt]
    #[doc(alias = "ALSACtlElemInfoInteger64")]
    pub struct ElemInfoInteger64(Object<ffi::ALSACtlElemInfoInteger64, ffi::ALSACtlElemInfoInteger64Class>) @implements ElemInfoCommon, ElemInfoSingleArray;

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

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

    /// Allocate and return an instance of [`ElemInfoInteger64`][crate::ElemInfoInteger64].
    ///
    /// # Returns
    ///
    /// An instance of [`ElemInfoInteger64`][crate::ElemInfoInteger64].
    #[doc(alias = "alsactl_elem_info_integer64_new")]
    pub fn new() -> ElemInfoInteger64 {
        unsafe { from_glib_full(ffi::alsactl_elem_info_integer64_new()) }
    }
}

impl Default for ElemInfoInteger64 {
    fn default() -> Self {
        Self::new()
    }
}

/// Trait containing all [`struct@ElemInfoInteger64`] methods.
///
/// # Implementors
///
/// [`ElemInfoInteger64`][struct@crate::ElemInfoInteger64]
pub trait ElemInfoInteger64Ext: IsA<ElemInfoInteger64> + 'static {
    /// The maximum value of element in value array for the element.
    #[doc(alias = "value-max")]
    fn value_max(&self) -> i64 {
        ObjectExt::property(self.as_ref(), "value-max")
    }

    /// The maximum value of element in value array for the element.
    #[doc(alias = "value-max")]
    fn set_value_max(&self, value_max: i64) {
        ObjectExt::set_property(self.as_ref(), "value-max", value_max)
    }

    /// The minimum value of element in value array for the element.
    #[doc(alias = "value-min")]
    fn value_min(&self) -> i64 {
        ObjectExt::property(self.as_ref(), "value-min")
    }

    /// The minimum value of element in value array for the element.
    #[doc(alias = "value-min")]
    fn set_value_min(&self, value_min: i64) {
        ObjectExt::set_property(self.as_ref(), "value-min", value_min)
    }

    /// The step value of element in value array for the element.
    #[doc(alias = "value-step")]
    fn value_step(&self) -> i64 {
        ObjectExt::property(self.as_ref(), "value-step")
    }

    /// The step value of element in value array for the element.
    #[doc(alias = "value-step")]
    fn set_value_step(&self, value_step: i64) {
        ObjectExt::set_property(self.as_ref(), "value-step", value_step)
    }

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

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

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

impl<O: IsA<ElemInfoInteger64>> ElemInfoInteger64Ext for O {}