objc2_av_foundation/generated/
AVCaptureSystemZoomSlider.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// The system's recommended continuous zoom control for `-[AVCaptureDevice videoZoomFactor]`.
13    ///
14    ///
15    /// `AVCaptureSystemZoomSlider` uses the range specified by the `systemRecommendedVideoZoomRange` 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 `systemRecommendedVideoZoomRange`.
16    ///
17    /// Controls may be added to an `AVCaptureSession` using `-[AVCaptureSession addControl:]`.
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesystemzoomslider?language=objc)
20    #[unsafe(super(AVCaptureControl, NSObject))]
21    #[derive(Debug, PartialEq, Eq, Hash)]
22    #[cfg(feature = "AVCaptureControl")]
23    pub struct AVCaptureSystemZoomSlider;
24);
25
26#[cfg(feature = "AVCaptureControl")]
27unsafe impl NSObjectProtocol for AVCaptureSystemZoomSlider {}
28
29#[cfg(feature = "AVCaptureControl")]
30impl AVCaptureSystemZoomSlider {
31    extern_methods!(
32        #[cfg(feature = "AVCaptureDevice")]
33        /// Initializes an `AVCaptureSystemZoomSlider` for controlling `device`.
34        ///
35        ///
36        /// Parameter `device`: The device to control.
37        ///
38        ///
39        /// `AVCaptureSystemZoomSlider` may only be initialized with `AVCaptureDevice` instances that support setting `videoZoomFactor`, otherwise an `NSInvalidArgumentException` is thrown.
40        #[unsafe(method(initWithDevice:))]
41        #[unsafe(method_family = init)]
42        pub unsafe fn initWithDevice(
43            this: Allocated<Self>,
44            device: &AVCaptureDevice,
45        ) -> Retained<Self>;
46
47        #[cfg(all(
48            feature = "AVCaptureDevice",
49            feature = "block2",
50            feature = "objc2-core-foundation"
51        ))]
52        /// Initializes an `AVCaptureSystemZoomSlider` for controlling `device` with a `
53        /// MainThreadOnly` `action` for handling `videoZoomFactor` changes.
54        ///
55        ///
56        /// Parameter `device`: The device to control.
57        ///
58        /// Parameter `action`: An action called on `
59        /// MainThreadOnly` to handle `videoZoomFactor` changes by `AVCaptureSystemZoomSlider`.
60        ///
61        ///
62        /// `action` is **only** called when `videoZoomFactor` is changed by this control. Clients should not change `videoZoomFactor` on the device when `action` is called.
63        ///
64        /// If you need to react to other sources of `videoZoomFactor` changes like `rampToVideoZoomFactor:withRate:` you will still need to use key-value observation.
65        ///
66        /// `AVCaptureSystemZoomSlider` may only be initialized with `AVCaptureDevice` instances that support setting `videoZoomFactor`, otherwise an `NSInvalidArgumentException` is thrown.
67        #[unsafe(method(initWithDevice:action:))]
68        #[unsafe(method_family = init)]
69        pub unsafe fn initWithDevice_action(
70            this: Allocated<Self>,
71            device: &AVCaptureDevice,
72            action: &block2::Block<dyn Fn(CGFloat)>,
73        ) -> Retained<Self>;
74    );
75}
76
77/// Methods declared on superclass `AVCaptureControl`.
78#[cfg(feature = "AVCaptureControl")]
79impl AVCaptureSystemZoomSlider {
80    extern_methods!(
81        #[unsafe(method(init))]
82        #[unsafe(method_family = init)]
83        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
84
85        #[unsafe(method(new))]
86        #[unsafe(method_family = new)]
87        pub unsafe fn new() -> Retained<Self>;
88    );
89}