objc2_av_foundation/generated/AVCaptureSlider.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13 /// An `AVCaptureControl` for selecting a value from a bounded range of values.
14 ///
15 ///
16 /// `AVCaptureSlider` is ideal when your control only needs a single float value. Controls may be added to an `AVCaptureSession` using `-[AVCaptureSession addControl:]`.
17 ///
18 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureslider?language=objc)
19 #[unsafe(super(AVCaptureControl, NSObject))]
20 #[derive(Debug, PartialEq, Eq, Hash)]
21 #[cfg(feature = "AVCaptureControl")]
22 pub struct AVCaptureSlider;
23);
24
25#[cfg(feature = "AVCaptureControl")]
26extern_conformance!(
27 unsafe impl NSObjectProtocol for AVCaptureSlider {}
28);
29
30#[cfg(feature = "AVCaptureControl")]
31impl AVCaptureSlider {
32 extern_methods!(
33 /// Initializes an `AVCaptureSlider` as a continuous slider between `minValue` and `maxValue`.
34 ///
35 ///
36 /// Parameter `localizedTitle`: A localized string that describes the slider's `action`.
37 ///
38 /// Parameter `symbolName`: The name of a symbol to represent the slider.
39 ///
40 /// Parameter `minValue`: The minimum value the slider can have. `minValue` must be less than `maxValue`, otherwise an `NSInvalidArgumentException` is thrown.
41 ///
42 /// Parameter `maxValue`: The maximum value the slider can have. `maxValue` must be greater than `minValue`, otherwise an `NSInvalidArgumentException` is thrown.
43 ///
44 /// Returns: An `AVCaptureSlider` instance as a continuous slider between `minValue` and `maxValue`.
45 ///
46 ///
47 /// Continuous sliders are used when any value in the range `minValue...maxValue` is supported.
48 #[unsafe(method(initWithLocalizedTitle:symbolName:minValue:maxValue:))]
49 #[unsafe(method_family = init)]
50 pub unsafe fn initWithLocalizedTitle_symbolName_minValue_maxValue(
51 this: Allocated<Self>,
52 localized_title: &NSString,
53 symbol_name: &NSString,
54 min_value: c_float,
55 max_value: c_float,
56 ) -> Retained<Self>;
57
58 /// Initializes an `AVCaptureSlider` as a discrete slider where the valid values are between `minValue` and `maxValue` with `step` distance between each value.
59 ///
60 ///
61 /// Parameter `localizedTitle`: A localized string that describes the slider's `action`.
62 ///
63 /// Parameter `symbolName`: The name of a symbol to represent the slider.
64 ///
65 /// Parameter `minValue`: The minimum value the slider can have. `minValue` must be less than `maxValue`, otherwise an `NSInvalidArgumentException` is thrown.
66 ///
67 /// Parameter `maxValue`: The maximum value the slider can have. `maxValue` must be greater than `minValue`, otherwise an `NSInvalidArgumentException` is thrown.
68 ///
69 /// Parameter `step`: The distance between each valid value. `step` must be greater than 0, otherwise an `NSInvalidArgumentException` is thrown.
70 ///
71 /// Returns: An `AVCaptureSlider` instance as a discrete slider where the valid values are between `minValue` and `maxValue` with `step` distance between each value.
72 ///
73 ///
74 /// Discrete sliders are used when only specific values are valid.
75 #[unsafe(method(initWithLocalizedTitle:symbolName:minValue:maxValue:step:))]
76 #[unsafe(method_family = init)]
77 pub unsafe fn initWithLocalizedTitle_symbolName_minValue_maxValue_step(
78 this: Allocated<Self>,
79 localized_title: &NSString,
80 symbol_name: &NSString,
81 min_value: c_float,
82 max_value: c_float,
83 step: c_float,
84 ) -> Retained<Self>;
85
86 /// Initializes an `AVCaptureSlider` as a discrete slider where `values` contains the valid values.
87 ///
88 ///
89 /// Parameter `localizedTitle`: A localized string that describes the slider's `action`.
90 ///
91 /// Parameter `symbolName`: The name of a symbol to represent the slider.
92 ///
93 /// Parameter `values`: The only values the slider can have.
94 ///
95 /// Returns: An `AVCaptureSlider` instance as a discrete slider where `values` contains the valid values.
96 ///
97 ///
98 /// Discrete sliders are used when only specific values are valid.
99 #[unsafe(method(initWithLocalizedTitle:symbolName:values:))]
100 #[unsafe(method_family = init)]
101 pub unsafe fn initWithLocalizedTitle_symbolName_values(
102 this: Allocated<Self>,
103 localized_title: &NSString,
104 symbol_name: &NSString,
105 values: &NSArray<NSNumber>,
106 ) -> Retained<Self>;
107
108 /// The current value of the slider.
109 ///
110 ///
111 /// Because the camera system may be independent from the main thread or `
112 /// MainThreadOnly`, `value` must be changed on `actionQueue` – the queue provided to `setActionQueue:action:`. The default value is the slider's minimum value. A value may only be set if it is within the slider's minimum and maximum values, otherwise an `NSInvalidArgumentException` is thrown.
113 #[unsafe(method(value))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn value(&self) -> c_float;
116
117 /// Setter for [`value`][Self::value].
118 #[unsafe(method(setValue:))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn setValue(&self, value: c_float);
121
122 /// A localized string defining the presentation of the slider's value.
123 ///
124 ///
125 /// To modify the presentation of the slider's value, set `localizedValueFormat` to a format string to display the slider's value with any annotation.
126 ///
127 /// The format string may only contain `%
128 /// @
129 /// ` and no other placeholders like `%d`, `%s`, etc. Invalid format strings will result in the value's default presentation.
130 ///
131 /// Examples of valid format strings are:
132 /// - `%
133 /// %
134 /// %` for "40%"
135 /// - `%
136 /// @
137 /// fps` for "60 fps"
138 /// - `+ %
139 /// @
140 /// ` for "+ 20"
141 #[unsafe(method(localizedValueFormat))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn localizedValueFormat(&self) -> Option<Retained<NSString>>;
144
145 /// Setter for [`localizedValueFormat`][Self::localizedValueFormat].
146 ///
147 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
148 #[unsafe(method(setLocalizedValueFormat:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn setLocalizedValueFormat(&self, localized_value_format: Option<&NSString>);
151
152 /// Values in this array may receive unique visual representations or behaviors.
153 #[unsafe(method(prominentValues))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn prominentValues(&self) -> Retained<NSArray<NSNumber>>;
156
157 /// Setter for [`prominentValues`][Self::prominentValues].
158 ///
159 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
160 #[unsafe(method(setProminentValues:))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn setProminentValues(&self, prominent_values: &NSArray<NSNumber>);
163
164 /// A localized string that describes the slider's `action`.
165 #[unsafe(method(localizedTitle))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn localizedTitle(&self) -> Retained<NSString>;
168
169 /// The name of a symbol to represent the slider.
170 #[unsafe(method(symbolName))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn symbolName(&self) -> Retained<NSString>;
173
174 /// A string that identifies the slider.
175 #[unsafe(method(accessibilityIdentifier))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn accessibilityIdentifier(&self) -> Option<Retained<NSString>>;
178
179 /// Setter for [`accessibilityIdentifier`][Self::accessibilityIdentifier].
180 ///
181 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
182 #[unsafe(method(setAccessibilityIdentifier:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn setAccessibilityIdentifier(
185 &self,
186 accessibility_identifier: Option<&NSString>,
187 );
188
189 #[cfg(all(feature = "block2", feature = "dispatch2"))]
190 /// Configures the slider's `action` which is called on `actionQueue` whenever the value of the slider is changed.
191 ///
192 ///
193 /// Parameter `actionQueue`: A queue for the `action` to be called.
194 ///
195 /// Parameter `action`: An action called on `actionQueue` whenever the value of the slider is changed.
196 ///
197 ///
198 /// Because the camera system may be independent from the main thread or `
199 /// MainThreadOnly`, `action` is always called on an internal `DispatchSerialQueue` targeted at `actionQueue`.
200 ///
201 /// If `action` modifies a property of the camera system, `actionQueue` must represent the same exclusive execution context as the camera system (see `isSameExclusiveExecutionContext`).
202 ///
203 /// # Safety
204 ///
205 /// `action_queue` possibly has additional threading requirements.
206 #[unsafe(method(setActionQueue:action:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn setActionQueue_action(
209 &self,
210 action_queue: &DispatchQueue,
211 action: &block2::DynBlock<dyn Fn(c_float)>,
212 );
213 );
214}
215
216/// Methods declared on superclass `AVCaptureControl`.
217#[cfg(feature = "AVCaptureControl")]
218impl AVCaptureSlider {
219 extern_methods!(
220 #[unsafe(method(init))]
221 #[unsafe(method_family = init)]
222 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
223
224 #[unsafe(method(new))]
225 #[unsafe(method_family = new)]
226 pub unsafe fn new() -> Retained<Self>;
227 );
228}