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