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