objc2_car_play/generated/CPMessageListItem.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-ui-kit")]
10use objc2_ui_kit::*;
11
12use crate::*;
13
14extern "C" {
15 /// Maximum size of an image or accessory image in a
16 /// `CPMessageListItem.`
17 ///
18 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmaximummessageitemimagesize?language=objc)
19 #[cfg(feature = "objc2-core-foundation")]
20 pub static CPMaximumMessageItemImageSize: CGSize;
21}
22
23extern "C" {
24 /// Maximum size of an image for the detailed text leading image.
25 ///
26 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmaximummessageitemleadingdetailtextimagesize?language=objc)
27 #[cfg(feature = "objc2-core-foundation")]
28 pub static CPMaximumMessageItemLeadingDetailTextImageSize: CGSize;
29}
30
31/// Types of glyphs that may appear in the leading region of a message cell.
32///
33/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessageleadingitem?language=objc)
34// NS_ENUM
35#[repr(transparent)]
36#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
37pub struct CPMessageLeadingItem(pub NSInteger);
38impl CPMessageLeadingItem {
39 /// The list item will render without a leading glyph.
40 #[doc(alias = "CPMessageLeadingItemNone")]
41 pub const None: Self = Self(0);
42 /// The list item will render with a pin glyph on the leading side.
43 #[doc(alias = "CPMessageLeadingItemPin")]
44 pub const Pin: Self = Self(1);
45 /// The list item will render with a star glyph on the leading side.
46 #[doc(alias = "CPMessageLeadingItemStar")]
47 pub const Star: Self = Self(2);
48}
49
50unsafe impl Encode for CPMessageLeadingItem {
51 const ENCODING: Encoding = NSInteger::ENCODING;
52}
53
54unsafe impl RefEncode for CPMessageLeadingItem {
55 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
56}
57
58/// Types of glyphs that may appear in the trailing region of a message cell.
59///
60/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessagetrailingitem?language=objc)
61// NS_ENUM
62#[repr(transparent)]
63#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
64pub struct CPMessageTrailingItem(pub NSInteger);
65impl CPMessageTrailingItem {
66 /// The list item will render without a trailing glyph.
67 #[doc(alias = "CPMessageTrailingItemNone")]
68 pub const None: Self = Self(0);
69 /// The list item will render with a mute glyph on the trailing side.
70 #[doc(alias = "CPMessageTrailingItemMute")]
71 pub const Mute: Self = Self(1);
72}
73
74unsafe impl Encode for CPMessageTrailingItem {
75 const ENCODING: Encoding = NSInteger::ENCODING;
76}
77
78unsafe impl RefEncode for CPMessageTrailingItem {
79 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
80}
81
82extern_class!(
83 /// `CPMessageListItemLeadingConfiguration`encapsulates the configuration options for
84 /// the leading side of your message list cell.
85 ///
86 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessagelistitemleadingconfiguration?language=objc)
87 #[unsafe(super(NSObject))]
88 #[derive(Debug, PartialEq, Eq, Hash)]
89 pub struct CPMessageListItemLeadingConfiguration;
90);
91
92extern_conformance!(
93 unsafe impl NSObjectProtocol for CPMessageListItemLeadingConfiguration {}
94);
95
96impl CPMessageListItemLeadingConfiguration {
97 extern_methods!(
98 #[unsafe(method(isUnread))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn isUnread(&self) -> bool;
101
102 #[unsafe(method(leadingItem))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn leadingItem(&self) -> CPMessageLeadingItem;
105
106 #[cfg(feature = "objc2-ui-kit")]
107 #[unsafe(method(leadingImage))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn leadingImage(&self) -> Option<Retained<UIImage>>;
110
111 #[cfg(feature = "objc2-ui-kit")]
112 /// Parameter `leadingItem`: An optional glyph displayed on the leading side of the cell.
113 ///
114 /// Parameter `leadingImage`: An optional image displayed on the leading side of the cell.
115 ///
116 /// Parameter `unread`: Whether this conversation is unread. If unread, the list item
117 /// will render with an unread indicator and tapping this item will read the conversation. If read,
118 /// no unread indicator will be displayed and tapping this item will compose a new message.
119 ///
120 /// When providing an image, your app should provide a
121 /// `UIImage`that is display-ready. If necessary for the image, provide
122 /// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
123 /// or by using
124 /// `UIImageAsset`to combine two
125 /// `UIImage`instances into a single image with
126 /// both styles.
127 ///
128 /// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
129 ///
130 ///
131 /// To properly size your list images, your app should size them to the display scale of the car screen.
132 /// See -[CPInterfaceController carTraitCollection].
133 #[unsafe(method(initWithLeadingItem:leadingImage:unread:))]
134 #[unsafe(method_family = init)]
135 pub unsafe fn initWithLeadingItem_leadingImage_unread(
136 this: Allocated<Self>,
137 leading_item: CPMessageLeadingItem,
138 leading_image: Option<&UIImage>,
139 unread: bool,
140 ) -> Retained<Self>;
141 );
142}
143
144/// Methods declared on superclass `NSObject`.
145impl CPMessageListItemLeadingConfiguration {
146 extern_methods!(
147 #[unsafe(method(init))]
148 #[unsafe(method_family = init)]
149 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
150
151 #[unsafe(method(new))]
152 #[unsafe(method_family = new)]
153 pub unsafe fn new() -> Retained<Self>;
154 );
155}
156
157extern_class!(
158 /// `CPMessageListItemTrailingConfiguration`encapsulates the configuration options for
159 /// the trailing side of your message list cell.
160 ///
161 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessagelistitemtrailingconfiguration?language=objc)
162 #[unsafe(super(NSObject))]
163 #[derive(Debug, PartialEq, Eq, Hash)]
164 pub struct CPMessageListItemTrailingConfiguration;
165);
166
167extern_conformance!(
168 unsafe impl NSObjectProtocol for CPMessageListItemTrailingConfiguration {}
169);
170
171impl CPMessageListItemTrailingConfiguration {
172 extern_methods!(
173 #[unsafe(method(trailingItem))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn trailingItem(&self) -> CPMessageTrailingItem;
176
177 #[cfg(feature = "objc2-ui-kit")]
178 #[unsafe(method(trailingImage))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn trailingImage(&self) -> Option<Retained<UIImage>>;
181
182 #[cfg(feature = "objc2-ui-kit")]
183 /// Parameter `trailingItem`: An optional glyph displayed on the trailing side of the cell.
184 ///
185 /// Parameter `trailingImage`: An optional image displayed on the trailing side of the cell.
186 ///
187 /// When providing an image, your app should provide a
188 /// `UIImage`that is display-ready. If necessary for the image, provide
189 /// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
190 /// or by using
191 /// `UIImageAsset`to combine two
192 /// `UIImage`instances into a single image with
193 /// both styles.
194 ///
195 /// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
196 ///
197 ///
198 /// To properly size your list images, your app should size them to the display scale of the car screen.
199 /// See -[CPInterfaceController carTraitCollection].
200 #[unsafe(method(initWithTrailingItem:trailingImage:))]
201 #[unsafe(method_family = init)]
202 pub unsafe fn initWithTrailingItem_trailingImage(
203 this: Allocated<Self>,
204 trailing_item: CPMessageTrailingItem,
205 trailing_image: Option<&UIImage>,
206 ) -> Retained<Self>;
207 );
208}
209
210/// Methods declared on superclass `NSObject`.
211impl CPMessageListItemTrailingConfiguration {
212 extern_methods!(
213 #[unsafe(method(init))]
214 #[unsafe(method_family = init)]
215 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
216
217 #[unsafe(method(new))]
218 #[unsafe(method_family = new)]
219 pub unsafe fn new() -> Retained<Self>;
220 );
221}
222
223extern_class!(
224 /// `CPMessageListItem`is a special variant of a list item for use in a
225 /// `CPListTemplate.`Unlike
226 /// `CPListItem,`your application will not receive a callback when the user
227 /// selects a
228 /// `CPMessageListItem`in your list template. Instead, Siri will be invoked
229 /// using the parameters you specify in your message item and the user will continue a
230 /// message compose, read, or reply flow through Siri.
231 ///
232 /// There are two modes of operation for
233 /// `CPMessageListItem:`To represent an existing conversation with one or more recipients, use the
234 /// `CPMessageListItem`initializer that accepts a conversation identifier. This identifier is not directly displayed
235 /// to the user; rather, it should be a value meaningful to your app to identify the conversation.
236 ///
237 /// To represent a contact or person entity, use the
238 /// `CPMessageListItem`initializer that
239 /// accepts a full name and phone/email. When the user selects this item, Siri will perform
240 /// a message compose flow.
241 ///
242 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessagelistitem?language=objc)
243 #[unsafe(super(NSObject))]
244 #[derive(Debug, PartialEq, Eq, Hash)]
245 pub struct CPMessageListItem;
246);
247
248#[cfg(feature = "CPListItemTypes")]
249extern_conformance!(
250 unsafe impl CPListTemplateItem for CPMessageListItem {}
251);
252
253extern_conformance!(
254 unsafe impl NSObjectProtocol for CPMessageListItem {}
255);
256
257impl CPMessageListItem {
258 extern_methods!(
259 /// Initialize a
260 /// `CPMessageListItem`for use in a
261 /// `CPListTemplate.`
262 ///
263 /// Parameter `conversationIdentifier`: A value meaningful to your app to identify this conversation.
264 /// This identifier is not directly displayed to the user; rather, when the user selects this list item,
265 /// SiriKit will pass this identifier back to your app for your own use.
266 ///
267 /// Parameter `text`: This is the main text label displayed to the user as well as spoken by
268 /// Siri when the user selects this list item.
269 ///
270 /// Parameter `leadingConfiguration`: A set of configuration options for the leading side of the list item.
271 ///
272 /// Parameter `trailingConfiguration`: A set of configuration options for the trailing side of the list item.
273 ///
274 /// Parameter `detailText`: Any additional text displayed underneath the
275 /// `conversationName.`
276 /// Parameter `trailingText`: Any additional text displayed along the trailing side of the cell.
277 ///
278 ///
279 /// Note: The maximum image size is CPMaximumMessageItemImageSize. If you supply a larger image,
280 /// it will be scaled down to this size.
281 #[unsafe(method(initWithConversationIdentifier:text:leadingConfiguration:trailingConfiguration:detailText:trailingText:))]
282 #[unsafe(method_family = init)]
283 pub unsafe fn initWithConversationIdentifier_text_leadingConfiguration_trailingConfiguration_detailText_trailingText(
284 this: Allocated<Self>,
285 conversation_identifier: &NSString,
286 text: &NSString,
287 leading_configuration: &CPMessageListItemLeadingConfiguration,
288 trailing_configuration: Option<&CPMessageListItemTrailingConfiguration>,
289 detail_text: Option<&NSString>,
290 trailing_text: Option<&NSString>,
291 ) -> Retained<Self>;
292
293 /// Initialize a
294 /// `CPMessageListItem`for use in a
295 /// `CPListTemplate.`
296 ///
297 /// Parameter `fullName`: The full name of the contact entity represented by this list item. This text
298 /// will be displayed as the main text label in the cell and will be spoken by Siri.
299 ///
300 /// Parameter `phoneOrEmailAddress`: A phone or email address for this contact entity that can be used
301 /// to compose a message.
302 ///
303 /// Parameter `leadingConfiguration`: A set of configuration options for the leading side of the list item.
304 ///
305 /// Parameter `trailingConfiguration`: A set of configuration options for the trailing side of the list item.
306 ///
307 /// Parameter `detailText`: Any additional text displayed underneath the
308 /// `conversationName.`
309 /// Parameter `trailingText`: Any additional text displayed along the trailing side of the cell.
310 ///
311 ///
312 /// Note: The maximum image size is CPMaximumMessageItemImageSize. If you supply a larger image,
313 /// it will be scaled down to this size.
314 #[unsafe(method(initWithFullName:phoneOrEmailAddress:leadingConfiguration:trailingConfiguration:detailText:trailingText:))]
315 #[unsafe(method_family = init)]
316 pub unsafe fn initWithFullName_phoneOrEmailAddress_leadingConfiguration_trailingConfiguration_detailText_trailingText(
317 this: Allocated<Self>,
318 full_name: &NSString,
319 phone_or_email_address: &NSString,
320 leading_configuration: &CPMessageListItemLeadingConfiguration,
321 trailing_configuration: Option<&CPMessageListItemTrailingConfiguration>,
322 detail_text: Option<&NSString>,
323 trailing_text: Option<&NSString>,
324 ) -> Retained<Self>;
325
326 /// To update the
327 /// `CPMessageListItem,`assign to any of these properties. If displayed in a
328 /// list template, the list item will be automatically reloaded.
329 #[unsafe(method(text))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn text(&self) -> Option<Retained<NSString>>;
332
333 /// Setter for [`text`][Self::text].
334 ///
335 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
336 #[unsafe(method(setText:))]
337 #[unsafe(method_family = none)]
338 pub unsafe fn setText(&self, text: Option<&NSString>);
339
340 #[unsafe(method(conversationIdentifier))]
341 #[unsafe(method_family = none)]
342 pub unsafe fn conversationIdentifier(&self) -> Option<Retained<NSString>>;
343
344 /// Setter for [`conversationIdentifier`][Self::conversationIdentifier].
345 ///
346 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
347 #[unsafe(method(setConversationIdentifier:))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn setConversationIdentifier(&self, conversation_identifier: Option<&NSString>);
350
351 #[unsafe(method(phoneOrEmailAddress))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn phoneOrEmailAddress(&self) -> Option<Retained<NSString>>;
354
355 /// Setter for [`phoneOrEmailAddress`][Self::phoneOrEmailAddress].
356 ///
357 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
358 #[unsafe(method(setPhoneOrEmailAddress:))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn setPhoneOrEmailAddress(&self, phone_or_email_address: Option<&NSString>);
361
362 #[unsafe(method(leadingConfiguration))]
363 #[unsafe(method_family = none)]
364 pub unsafe fn leadingConfiguration(
365 &self,
366 ) -> Retained<CPMessageListItemLeadingConfiguration>;
367
368 /// Setter for [`leadingConfiguration`][Self::leadingConfiguration].
369 #[unsafe(method(setLeadingConfiguration:))]
370 #[unsafe(method_family = none)]
371 pub unsafe fn setLeadingConfiguration(
372 &self,
373 leading_configuration: &CPMessageListItemLeadingConfiguration,
374 );
375
376 #[unsafe(method(trailingConfiguration))]
377 #[unsafe(method_family = none)]
378 pub unsafe fn trailingConfiguration(
379 &self,
380 ) -> Option<Retained<CPMessageListItemTrailingConfiguration>>;
381
382 /// Setter for [`trailingConfiguration`][Self::trailingConfiguration].
383 #[unsafe(method(setTrailingConfiguration:))]
384 #[unsafe(method_family = none)]
385 pub unsafe fn setTrailingConfiguration(
386 &self,
387 trailing_configuration: Option<&CPMessageListItemTrailingConfiguration>,
388 );
389
390 #[unsafe(method(detailText))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn detailText(&self) -> Option<Retained<NSString>>;
393
394 /// Setter for [`detailText`][Self::detailText].
395 ///
396 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
397 #[unsafe(method(setDetailText:))]
398 #[unsafe(method_family = none)]
399 pub unsafe fn setDetailText(&self, detail_text: Option<&NSString>);
400
401 #[unsafe(method(trailingText))]
402 #[unsafe(method_family = none)]
403 pub unsafe fn trailingText(&self) -> Option<Retained<NSString>>;
404
405 /// Setter for [`trailingText`][Self::trailingText].
406 ///
407 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
408 #[unsafe(method(setTrailingText:))]
409 #[unsafe(method_family = none)]
410 pub unsafe fn setTrailingText(&self, trailing_text: Option<&NSString>);
411
412 /// A Boolean value indicating whether the list item is enabled.
413 ///
414 ///
415 /// Set the value of this property to
416 /// `YES`to enable the list item or
417 /// `NO`to disable it. The default value of this property is
418 /// `YES.`
419 #[unsafe(method(isEnabled))]
420 #[unsafe(method_family = none)]
421 pub unsafe fn isEnabled(&self) -> bool;
422
423 /// Setter for [`isEnabled`][Self::isEnabled].
424 #[unsafe(method(setEnabled:))]
425 #[unsafe(method_family = none)]
426 pub unsafe fn setEnabled(&self, enabled: bool);
427
428 /// Any custom user info related to this item.
429 #[unsafe(method(userInfo))]
430 #[unsafe(method_family = none)]
431 pub unsafe fn userInfo(&self) -> Option<Retained<AnyObject>>;
432
433 /// Setter for [`userInfo`][Self::userInfo].
434 ///
435 /// # Safety
436 ///
437 /// `user_info` should be of the correct type.
438 #[unsafe(method(setUserInfo:))]
439 #[unsafe(method_family = none)]
440 pub unsafe fn setUserInfo(&self, user_info: Option<&AnyObject>);
441
442 #[cfg(feature = "objc2-ui-kit")]
443 /// Image shown on the leading edge of the detail text.
444 #[unsafe(method(leadingDetailTextImage))]
445 #[unsafe(method_family = none)]
446 pub unsafe fn leadingDetailTextImage(&self) -> Option<Retained<UIImage>>;
447
448 #[cfg(feature = "objc2-ui-kit")]
449 /// Setter for [`leadingDetailTextImage`][Self::leadingDetailTextImage].
450 ///
451 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
452 #[unsafe(method(setLeadingDetailTextImage:))]
453 #[unsafe(method_family = none)]
454 pub unsafe fn setLeadingDetailTextImage(&self, leading_detail_text_image: Option<&UIImage>);
455 );
456}
457
458/// Methods declared on superclass `NSObject`.
459impl CPMessageListItem {
460 extern_methods!(
461 #[unsafe(method(init))]
462 #[unsafe(method_family = init)]
463 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
464
465 #[unsafe(method(new))]
466 #[unsafe(method_family = new)]
467 pub unsafe fn new() -> Retained<Self>;
468 );
469}