objc2-av-foundation 0.3.2

Bindings to the AVFoundation framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// The system's recommended continuous exposure bias control for `-[AVCaptureDevice exposureTargetBias]`.
    ///
    ///
    /// `AVCaptureSystemExposureBiasSlider` uses the range specified by `systemRecommendedExposureBiasRange` on the `activeFormat` from the `AVCaptureDevice` specified during initialization. As the device's `activeFormat` changes, the slider updates its range with the new format's `systemRecommendedExposureBiasRange`.
    ///
    /// Controls may be added to an `AVCaptureSession` using `-[AVCaptureSession addControl:]`.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesystemexposurebiasslider?language=objc)
    #[unsafe(super(AVCaptureControl, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "AVCaptureControl")]
    pub struct AVCaptureSystemExposureBiasSlider;
);

#[cfg(feature = "AVCaptureControl")]
extern_conformance!(
    unsafe impl NSObjectProtocol for AVCaptureSystemExposureBiasSlider {}
);

#[cfg(feature = "AVCaptureControl")]
impl AVCaptureSystemExposureBiasSlider {
    extern_methods!(
        #[cfg(feature = "AVCaptureDevice")]
        /// Initializes an `AVCaptureSystemExposureBiasSlider` for controlling `device`.
        ///
        ///
        /// Parameter `device`: The device to control.
        ///
        ///
        /// `AVCaptureSystemExposureBiasSlider` may only be initialized with `AVCaptureDevice` instances that support setting `exposureTargetBias`, otherwise an `NSInvalidArgumentException` is thrown.
        #[unsafe(method(initWithDevice:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDevice(
            this: Allocated<Self>,
            device: &AVCaptureDevice,
        ) -> Retained<Self>;

        #[cfg(all(feature = "AVCaptureDevice", feature = "block2"))]
        /// Initializes an `AVCaptureSystemExposureBiasSlider` for controlling `device` with a `
        /// MainThreadOnly` `action` for handling `exposureTargetBias` changes.
        ///
        ///
        /// Parameter `device`: The device to control.
        ///
        /// Parameter `action`: An action called on `
        /// MainThreadOnly` to handle `exposureTargetBias` changes by `AVCaptureSystemExposureBiasSlider`.
        ///
        ///
        /// `action` is **only** called when `exposureTargetBias` is changed by this control. Clients should not change `exposureTargetBias` on the device when `action` is called.
        ///
        /// If you need to react to other sources of `exposureTargetBias` changes, you will still need to use key-value observation.
        ///
        /// `AVCaptureSystemExposureBiasSlider` may only be initialized with `AVCaptureDevice` instances that support setting `exposureTargetBias`, otherwise an `NSInvalidArgumentException` is thrown.
        #[unsafe(method(initWithDevice:action:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDevice_action(
            this: Allocated<Self>,
            device: &AVCaptureDevice,
            action: &block2::DynBlock<dyn Fn(c_float)>,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `AVCaptureControl`.
#[cfg(feature = "AVCaptureControl")]
impl AVCaptureSystemExposureBiasSlider {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}