objc2_av_foundation/generated/
AVCaptureIndexPicker.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 from a set of mutually exclusive values by index.
14    ///
15    ///
16    /// `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:]`.
17    ///
18    /// `AVCaptureIndexPicker` uses zero-based indexing.
19    ///
20    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureindexpicker?language=objc)
21    #[unsafe(super(AVCaptureControl, NSObject))]
22    #[derive(Debug, PartialEq, Eq, Hash)]
23    #[cfg(feature = "AVCaptureControl")]
24    pub struct AVCaptureIndexPicker;
25);
26
27#[cfg(feature = "AVCaptureControl")]
28extern_conformance!(
29    unsafe impl NSObjectProtocol for AVCaptureIndexPicker {}
30);
31
32#[cfg(feature = "AVCaptureControl")]
33impl AVCaptureIndexPicker {
34    extern_methods!(
35        /// Initializes an `AVCaptureIndexPicker` to pick between `numberOfIndexes` values.
36        ///
37        ///
38        /// Parameter `localizedTitle`: A localized string that describes the picker's `action`.
39        ///
40        /// Parameter `symbolName`: The name of a symbol to represent the picker.
41        ///
42        /// Parameter `numberOfIndexes`: The number of indexes to pick between. `numberOfIndexes` must be greater than 0, otherwise an `NSInvalidArgumentException` is thrown.
43        ///
44        /// Returns: An `AVCaptureIndexPicker` instance that picks between `numberOfIndexes` values.
45        ///
46        ///
47        /// Suitable when your picked values don't need titles.
48        #[unsafe(method(initWithLocalizedTitle:symbolName:numberOfIndexes:))]
49        #[unsafe(method_family = init)]
50        pub unsafe fn initWithLocalizedTitle_symbolName_numberOfIndexes(
51            this: Allocated<Self>,
52            localized_title: &NSString,
53            symbol_name: &NSString,
54            number_of_indexes: NSInteger,
55        ) -> Retained<Self>;
56
57        #[cfg(feature = "block2")]
58        /// Initializes an `AVCaptureIndexPicker` to pick between `numberOfIndexes` values.
59        ///
60        ///
61        /// Parameter `localizedTitle`: A localized string that describes the picker's `action`.
62        ///
63        /// Parameter `symbolName`: The name of a symbol to represent the picker.
64        ///
65        /// Parameter `numberOfIndexes`: The number of indexes to pick between. `numberOfIndexes` must be greater than 0, otherwise an `NSInvalidArgumentException` is thrown.
66        ///
67        /// Parameter `localizedTitleTransform`: A transformation from index to localized title.
68        ///
69        /// Returns: An `AVCaptureIndexPicker` instance that picks between `numberOfIndexes` values with a transformation from index to localized title.
70        ///
71        ///
72        /// Suitable when you want to provide a title for each picked value lazily.
73        #[unsafe(method(initWithLocalizedTitle:symbolName:numberOfIndexes:localizedTitleTransform:))]
74        #[unsafe(method_family = init)]
75        pub unsafe fn initWithLocalizedTitle_symbolName_numberOfIndexes_localizedTitleTransform(
76            this: Allocated<Self>,
77            localized_title: &NSString,
78            symbol_name: &NSString,
79            number_of_indexes: NSInteger,
80            localized_title_transform: &block2::DynBlock<
81                dyn Fn(NSInteger) -> NonNull<NSString> + '_,
82            >,
83        ) -> Retained<Self>;
84
85        /// Initializes an `AVCaptureIndexPicker` to pick between `localizedIndexTitles.count` values.
86        ///
87        ///
88        /// Parameter `localizedTitle`: A localized string that describes the picker's `action`.
89        ///
90        /// Parameter `symbolName`: The name of a symbol to represent the picker.
91        ///
92        /// Parameter `localizedIndexTitles`: The titles to use for each index. `localizedIndexTitles` must be greater than 0, otherwise an `NSInvalidArgumentException` is thrown.
93        ///
94        /// Returns: An `AVCaptureIndexPicker` instance that picks between `localizedIndexTitles.count` values.
95        ///
96        ///
97        /// Suitable when you already have an array containing a title for each picked value.
98        #[unsafe(method(initWithLocalizedTitle:symbolName:localizedIndexTitles:))]
99        #[unsafe(method_family = init)]
100        pub unsafe fn initWithLocalizedTitle_symbolName_localizedIndexTitles(
101            this: Allocated<Self>,
102            localized_title: &NSString,
103            symbol_name: &NSString,
104            localized_index_titles: &NSArray<NSString>,
105        ) -> Retained<Self>;
106
107        /// The currently selected index.
108        ///
109        ///
110        /// Because the camera system may be independent from the main thread or `
111        /// 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.
112        #[unsafe(method(selectedIndex))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn selectedIndex(&self) -> NSInteger;
115
116        /// Setter for [`selectedIndex`][Self::selectedIndex].
117        #[unsafe(method(setSelectedIndex:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setSelectedIndex(&self, selected_index: NSInteger);
120
121        /// A localized string that describes the picker's `action`.
122        #[unsafe(method(localizedTitle))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn localizedTitle(&self) -> Retained<NSString>;
125
126        /// The name of a symbol to represent the picker.
127        #[unsafe(method(symbolName))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn symbolName(&self) -> Retained<NSString>;
130
131        /// The number of indexes to pick between.
132        #[unsafe(method(numberOfIndexes))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn numberOfIndexes(&self) -> NSInteger;
135
136        /// The titles used for each index.
137        #[unsafe(method(localizedIndexTitles))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn localizedIndexTitles(&self) -> Retained<NSArray<NSString>>;
140
141        /// A string that identifies the picker.
142        #[unsafe(method(accessibilityIdentifier))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn accessibilityIdentifier(&self) -> Option<Retained<NSString>>;
145
146        /// Setter for [`accessibilityIdentifier`][Self::accessibilityIdentifier].
147        #[unsafe(method(setAccessibilityIdentifier:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn setAccessibilityIdentifier(
150            &self,
151            accessibility_identifier: Option<&NSString>,
152        );
153
154        #[cfg(all(feature = "block2", feature = "dispatch2"))]
155        /// Configures the picker's `action` which is called on `actionQueue` whenever the index of the picker is changed.
156        ///
157        ///
158        /// Parameter `actionQueue`: A queue for the `action` to be called.
159        ///
160        /// Parameter `action`: An action called on `actionQueue` whenever the selected index of the picker is changed.
161        ///
162        ///
163        /// Because the camera system may be independent from the main thread or `
164        /// MainThreadOnly`, `action` is always called on an internal `DispatchSerialQueue` targeted at `actionQueue`.
165        ///
166        /// If `action` modifies a property of the camera system, `actionQueue` must represent the same exclusive execution context as the camera system (see `isSameExclusiveExecutionContext`).
167        #[unsafe(method(setActionQueue:action:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn setActionQueue_action(
170            &self,
171            action_queue: &DispatchQueue,
172            action: &block2::DynBlock<dyn Fn(NSInteger)>,
173        );
174    );
175}
176
177/// Methods declared on superclass `AVCaptureControl`.
178#[cfg(feature = "AVCaptureControl")]
179impl AVCaptureIndexPicker {
180    extern_methods!(
181        #[unsafe(method(init))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
184
185        #[unsafe(method(new))]
186        #[unsafe(method_family = new)]
187        pub unsafe fn new() -> Retained<Self>;
188    );
189}