objc2_car_play/generated/CPVoiceControlTemplate.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#[cfg(feature = "objc2-ui-kit")]
8use objc2_ui_kit::*;
9
10use crate::*;
11
12extern_class!(
13 /// `CPVoiceControlState`encapsulates the title variants and image(s) for a single voice control
14 /// state, like listening, loading, or recognized.
15 ///
16 /// Your app may initialize the voice control template with one or more states, and
17 /// you may call
18 /// `activateVoiceControlState:`to switch between states you've defined.
19 ///
20 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpvoicecontrolstate?language=objc)
21 #[unsafe(super(NSObject))]
22 #[derive(Debug, PartialEq, Eq, Hash)]
23 pub struct CPVoiceControlState;
24);
25
26extern_conformance!(
27 unsafe impl NSCoding for CPVoiceControlState {}
28);
29
30extern_conformance!(
31 unsafe impl NSObjectProtocol for CPVoiceControlState {}
32);
33
34extern_conformance!(
35 unsafe impl NSSecureCoding for CPVoiceControlState {}
36);
37
38impl CPVoiceControlState {
39 extern_methods!(
40 #[cfg(feature = "objc2-ui-kit")]
41 /// Initialize a voice control state with a title and image.
42 ///
43 ///
44 /// Parameter `identifier`: A custom identifier you can use to identify this voice control state. You'll also
45 /// switch to this state by specifying this identifier.
46 ///
47 /// Parameter `titleVariants`: An array of title variants. The Voice Control template will select the longest
48 /// variant that fits your specified content.
49 ///
50 /// Parameter `image`: An image to be animated while this template is visible. The system
51 /// enforces a minimum cycle duration of 0.3 seconds and a maximum cycle duration of 5 seconds.
52 /// Voice Control state images may be a maximum of 150 by 150 points.
53 ///
54 /// Parameter `repeats`: For an animated image, YES if the animation should repeat indefinitely, NO
55 /// to run the animation only once.
56 #[unsafe(method(initWithIdentifier:titleVariants:image:repeats:))]
57 #[unsafe(method_family = init)]
58 pub unsafe fn initWithIdentifier_titleVariants_image_repeats(
59 this: Allocated<Self>,
60 identifier: &NSString,
61 title_variants: Option<&NSArray<NSString>>,
62 image: Option<&UIImage>,
63 repeats: bool,
64 ) -> Retained<Self>;
65
66 #[unsafe(method(titleVariants))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn titleVariants(&self) -> Option<Retained<NSArray<NSString>>>;
69
70 #[cfg(feature = "objc2-ui-kit")]
71 #[unsafe(method(image))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
74
75 #[unsafe(method(identifier))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn identifier(&self) -> Retained<NSString>;
78
79 #[unsafe(method(repeats))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn repeats(&self) -> bool;
82 );
83}
84
85/// Methods declared on superclass `NSObject`.
86impl CPVoiceControlState {
87 extern_methods!(
88 #[unsafe(method(init))]
89 #[unsafe(method_family = init)]
90 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
91
92 #[unsafe(method(new))]
93 #[unsafe(method_family = new)]
94 pub unsafe fn new() -> Retained<Self>;
95 );
96}
97
98extern_class!(
99 /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpvoicecontroltemplate?language=objc)
100 #[unsafe(super(CPTemplate, NSObject))]
101 #[derive(Debug, PartialEq, Eq, Hash)]
102 #[cfg(feature = "CPTemplate")]
103 pub struct CPVoiceControlTemplate;
104);
105
106#[cfg(feature = "CPTemplate")]
107extern_conformance!(
108 unsafe impl NSCoding for CPVoiceControlTemplate {}
109);
110
111#[cfg(feature = "CPTemplate")]
112extern_conformance!(
113 unsafe impl NSObjectProtocol for CPVoiceControlTemplate {}
114);
115
116#[cfg(feature = "CPTemplate")]
117extern_conformance!(
118 unsafe impl NSSecureCoding for CPVoiceControlTemplate {}
119);
120
121#[cfg(feature = "CPTemplate")]
122impl CPVoiceControlTemplate {
123 extern_methods!(
124 /// Initialize a voice control template with a list of voice control states.
125 ///
126 ///
127 /// Parameter `voiceControlStates`: An array of voice control states for this template. Your app can switch between these states after the template is presented.
128 ///
129 ///
130 /// Note: By default, the Voice Control template will begin on the first state specified.
131 ///
132 ///
133 /// Warning: You may specify a maximum of 5 voice control states. If you specify more than 5, only the first 5 will be available.
134 #[unsafe(method(initWithVoiceControlStates:))]
135 #[unsafe(method_family = init)]
136 pub unsafe fn initWithVoiceControlStates(
137 this: Allocated<Self>,
138 voice_control_states: &NSArray<CPVoiceControlState>,
139 ) -> Retained<Self>;
140
141 #[unsafe(method(voiceControlStates))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn voiceControlStates(&self) -> Retained<NSArray<CPVoiceControlState>>;
144
145 /// Switch the voice control template to the state corresponding with a particular identifier.
146 ///
147 ///
148 /// Parameter `identifier`: An identifier corresponding to one of the voice control states used to initialize this template.
149 ///
150 ///
151 /// Note: The Voice Control template applies a rate-limit for voice control states; the template will
152 /// ignore voice control state changes that occur too rapidly or frequently in a short period of time.
153 ///
154 ///
155 /// Warning: You must first present this voice control template through your
156 /// `CPInterfaceController`before
157 /// activating a voice control state, otherwise this method will have no effect.
158 /// When the Voice Control template is first presented, the first state you specify in
159 /// `initWithVoiceControlStates:`will be visible.
160 #[unsafe(method(activateVoiceControlStateWithIdentifier:))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn activateVoiceControlStateWithIdentifier(&self, identifier: &NSString);
163
164 /// The currently-active voice control state identifier.
165 #[unsafe(method(activeStateIdentifier))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn activeStateIdentifier(&self) -> Option<Retained<NSString>>;
168 );
169}
170
171/// Methods declared on superclass `NSObject`.
172#[cfg(feature = "CPTemplate")]
173impl CPVoiceControlTemplate {
174 extern_methods!(
175 #[unsafe(method(init))]
176 #[unsafe(method_family = init)]
177 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
178
179 #[unsafe(method(new))]
180 #[unsafe(method_family = new)]
181 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
182 );
183}