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
//! 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 from a set of mutually exclusive values by index.
///
///
/// `AVCaptureIndexPicker` is ideal when the set of values is provided by an indexed container like `NSArray`, `Array`, or `Sequence`. Controls may be added to an `AVCaptureSession` using `-[AVCaptureSession addControl:]`.
///
/// `AVCaptureIndexPicker` uses zero-based indexing.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureindexpicker?language=objc)
#[unsafe(super(AVCaptureControl, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "AVCaptureControl")]
pub struct AVCaptureIndexPicker;
);
#[cfg(feature = "AVCaptureControl")]
extern_conformance!(
unsafe impl NSObjectProtocol for AVCaptureIndexPicker {}
);
#[cfg(feature = "AVCaptureControl")]
impl AVCaptureIndexPicker {
extern_methods!(
/// Initializes an `AVCaptureIndexPicker` to pick between `numberOfIndexes` values.
///
///
/// Parameter `localizedTitle`: A localized string that describes the picker's `action`.
///
/// Parameter `symbolName`: The name of a symbol to represent the picker.
///
/// Parameter `numberOfIndexes`: The number of indexes to pick between. `numberOfIndexes` must be greater than 0, otherwise an `NSInvalidArgumentException` is thrown.
///
/// Returns: An `AVCaptureIndexPicker` instance that picks between `numberOfIndexes` values.
///
///
/// Suitable when your picked values don't need titles.
#[unsafe(method(initWithLocalizedTitle:symbolName:numberOfIndexes:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithLocalizedTitle_symbolName_numberOfIndexes(
this: Allocated<Self>,
localized_title: &NSString,
symbol_name: &NSString,
number_of_indexes: NSInteger,
) -> Retained<Self>;
#[cfg(feature = "block2")]
/// Initializes an `AVCaptureIndexPicker` to pick between `numberOfIndexes` values.
///
///
/// Parameter `localizedTitle`: A localized string that describes the picker's `action`.
///
/// Parameter `symbolName`: The name of a symbol to represent the picker.
///
/// Parameter `numberOfIndexes`: The number of indexes to pick between. `numberOfIndexes` must be greater than 0, otherwise an `NSInvalidArgumentException` is thrown.
///
/// Parameter `localizedTitleTransform`: A transformation from index to localized title.
///
/// Returns: An `AVCaptureIndexPicker` instance that picks between `numberOfIndexes` values with a transformation from index to localized title.
///
///
/// Suitable when you want to provide a title for each picked value lazily.
///
/// # Safety
///
/// `localized_title_transform` block's return must be a valid pointer.
#[unsafe(method(initWithLocalizedTitle:symbolName:numberOfIndexes:localizedTitleTransform:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithLocalizedTitle_symbolName_numberOfIndexes_localizedTitleTransform(
this: Allocated<Self>,
localized_title: &NSString,
symbol_name: &NSString,
number_of_indexes: NSInteger,
localized_title_transform: &block2::DynBlock<
dyn Fn(NSInteger) -> NonNull<NSString> + '_,
>,
) -> Retained<Self>;
/// Initializes an `AVCaptureIndexPicker` to pick between `localizedIndexTitles.count` values.
///
///
/// Parameter `localizedTitle`: A localized string that describes the picker's `action`.
///
/// Parameter `symbolName`: The name of a symbol to represent the picker.
///
/// Parameter `localizedIndexTitles`: The titles to use for each index. `localizedIndexTitles` must be greater than 0, otherwise an `NSInvalidArgumentException` is thrown.
///
/// Returns: An `AVCaptureIndexPicker` instance that picks between `localizedIndexTitles.count` values.
///
///
/// Suitable when you already have an array containing a title for each picked value.
#[unsafe(method(initWithLocalizedTitle:symbolName:localizedIndexTitles:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithLocalizedTitle_symbolName_localizedIndexTitles(
this: Allocated<Self>,
localized_title: &NSString,
symbol_name: &NSString,
localized_index_titles: &NSArray<NSString>,
) -> Retained<Self>;
/// The currently selected index.
///
///
/// Because the camera system may be independent from the main thread or `
/// MainThreadOnly`, `selectedIndex` must be changed on `actionQueue` – the queue provided to `setActionQueue:action:`. The default value is 0. An index may only be set if it is greater than 0 or less than `numberOfIndexes`, otherwise an `NSInvalidArgumentException` is thrown.
#[unsafe(method(selectedIndex))]
#[unsafe(method_family = none)]
pub unsafe fn selectedIndex(&self) -> NSInteger;
/// Setter for [`selectedIndex`][Self::selectedIndex].
#[unsafe(method(setSelectedIndex:))]
#[unsafe(method_family = none)]
pub unsafe fn setSelectedIndex(&self, selected_index: NSInteger);
/// A localized string that describes the picker's `action`.
#[unsafe(method(localizedTitle))]
#[unsafe(method_family = none)]
pub unsafe fn localizedTitle(&self) -> Retained<NSString>;
/// The name of a symbol to represent the picker.
#[unsafe(method(symbolName))]
#[unsafe(method_family = none)]
pub unsafe fn symbolName(&self) -> Retained<NSString>;
/// The number of indexes to pick between.
#[unsafe(method(numberOfIndexes))]
#[unsafe(method_family = none)]
pub unsafe fn numberOfIndexes(&self) -> NSInteger;
/// The titles used for each index.
#[unsafe(method(localizedIndexTitles))]
#[unsafe(method_family = none)]
pub unsafe fn localizedIndexTitles(&self) -> Retained<NSArray<NSString>>;
/// A string that identifies the picker.
#[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 picker's `action` which is called on `actionQueue` whenever the index of the picker is changed.
///
///
/// Parameter `actionQueue`: A queue for the `action` to be called.
///
/// Parameter `action`: An action called on `actionQueue` whenever the selected index of the picker 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(NSInteger)>,
);
);
}
/// Methods declared on superclass `AVCaptureControl`.
#[cfg(feature = "AVCaptureControl")]
impl AVCaptureIndexPicker {
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>;
);
}