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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;
use crate::*;
extern "C" {
/// Maximum size of an image or accessory image in a
/// `CPMessageListItem.`
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmaximummessageitemimagesize?language=objc)
#[cfg(feature = "objc2-core-foundation")]
pub static CPMaximumMessageItemImageSize: CGSize;
}
extern "C" {
/// Maximum size of an image for the detailed text leading image.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmaximummessageitemleadingdetailtextimagesize?language=objc)
#[cfg(feature = "objc2-core-foundation")]
pub static CPMaximumMessageItemLeadingDetailTextImageSize: CGSize;
}
/// Types of glyphs that may appear in the leading region of a message cell.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessageleadingitem?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CPMessageLeadingItem(pub NSInteger);
impl CPMessageLeadingItem {
/// The list item will render without a leading glyph.
#[doc(alias = "CPMessageLeadingItemNone")]
pub const None: Self = Self(0);
/// The list item will render with a pin glyph on the leading side.
#[doc(alias = "CPMessageLeadingItemPin")]
pub const Pin: Self = Self(1);
/// The list item will render with a star glyph on the leading side.
#[doc(alias = "CPMessageLeadingItemStar")]
pub const Star: Self = Self(2);
}
unsafe impl Encode for CPMessageLeadingItem {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for CPMessageLeadingItem {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// Types of glyphs that may appear in the trailing region of a message cell.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessagetrailingitem?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CPMessageTrailingItem(pub NSInteger);
impl CPMessageTrailingItem {
/// The list item will render without a trailing glyph.
#[doc(alias = "CPMessageTrailingItemNone")]
pub const None: Self = Self(0);
/// The list item will render with a mute glyph on the trailing side.
#[doc(alias = "CPMessageTrailingItemMute")]
pub const Mute: Self = Self(1);
}
unsafe impl Encode for CPMessageTrailingItem {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for CPMessageTrailingItem {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// `CPMessageListItemLeadingConfiguration`encapsulates the configuration options for
/// the leading side of your message list cell.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessagelistitemleadingconfiguration?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPMessageListItemLeadingConfiguration;
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPMessageListItemLeadingConfiguration {}
);
impl CPMessageListItemLeadingConfiguration {
extern_methods!(
#[unsafe(method(isUnread))]
#[unsafe(method_family = none)]
pub unsafe fn isUnread(&self) -> bool;
#[unsafe(method(leadingItem))]
#[unsafe(method_family = none)]
pub unsafe fn leadingItem(&self) -> CPMessageLeadingItem;
#[cfg(feature = "objc2-ui-kit")]
#[unsafe(method(leadingImage))]
#[unsafe(method_family = none)]
pub unsafe fn leadingImage(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "objc2-ui-kit")]
/// Parameter `leadingItem`: An optional glyph displayed on the leading side of the cell.
///
/// Parameter `leadingImage`: An optional image displayed on the leading side of the cell.
///
/// Parameter `unread`: Whether this conversation is unread. If unread, the list item
/// will render with an unread indicator and tapping this item will read the conversation. If read,
/// no unread indicator will be displayed and tapping this item will compose a new message.
///
/// When providing an image, your app should provide a
/// `UIImage`that is display-ready. If necessary for the image, provide
/// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
/// or by using
/// `UIImageAsset`to combine two
/// `UIImage`instances into a single image with
/// both styles.
///
/// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
///
///
/// To properly size your list images, your app should size them to the display scale of the car screen.
/// See -[CPInterfaceController carTraitCollection].
#[unsafe(method(initWithLeadingItem:leadingImage:unread:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithLeadingItem_leadingImage_unread(
this: Allocated<Self>,
leading_item: CPMessageLeadingItem,
leading_image: Option<&UIImage>,
unread: bool,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl CPMessageListItemLeadingConfiguration {
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>;
);
}
extern_class!(
/// `CPMessageListItemTrailingConfiguration`encapsulates the configuration options for
/// the trailing side of your message list cell.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessagelistitemtrailingconfiguration?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPMessageListItemTrailingConfiguration;
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPMessageListItemTrailingConfiguration {}
);
impl CPMessageListItemTrailingConfiguration {
extern_methods!(
#[unsafe(method(trailingItem))]
#[unsafe(method_family = none)]
pub unsafe fn trailingItem(&self) -> CPMessageTrailingItem;
#[cfg(feature = "objc2-ui-kit")]
#[unsafe(method(trailingImage))]
#[unsafe(method_family = none)]
pub unsafe fn trailingImage(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "objc2-ui-kit")]
/// Parameter `trailingItem`: An optional glyph displayed on the trailing side of the cell.
///
/// Parameter `trailingImage`: An optional image displayed on the trailing side of the cell.
///
/// When providing an image, your app should provide a
/// `UIImage`that is display-ready. If necessary for the image, provide
/// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
/// or by using
/// `UIImageAsset`to combine two
/// `UIImage`instances into a single image with
/// both styles.
///
/// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
///
///
/// To properly size your list images, your app should size them to the display scale of the car screen.
/// See -[CPInterfaceController carTraitCollection].
#[unsafe(method(initWithTrailingItem:trailingImage:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTrailingItem_trailingImage(
this: Allocated<Self>,
trailing_item: CPMessageTrailingItem,
trailing_image: Option<&UIImage>,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl CPMessageListItemTrailingConfiguration {
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>;
);
}
extern_class!(
/// `CPMessageListItem`is a special variant of a list item for use in a
/// `CPListTemplate.`Unlike
/// `CPListItem,`your application will not receive a callback when the user
/// selects a
/// `CPMessageListItem`in your list template. Instead, Siri will be invoked
/// using the parameters you specify in your message item and the user will continue a
/// message compose, read, or reply flow through Siri.
///
/// There are two modes of operation for
/// `CPMessageListItem:`To represent an existing conversation with one or more recipients, use the
/// `CPMessageListItem`initializer that accepts a conversation identifier. This identifier is not directly displayed
/// to the user; rather, it should be a value meaningful to your app to identify the conversation.
///
/// To represent a contact or person entity, use the
/// `CPMessageListItem`initializer that
/// accepts a full name and phone/email. When the user selects this item, Siri will perform
/// a message compose flow.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessagelistitem?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPMessageListItem;
);
#[cfg(feature = "CPListItemTypes")]
extern_conformance!(
unsafe impl CPListTemplateItem for CPMessageListItem {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPMessageListItem {}
);
impl CPMessageListItem {
extern_methods!(
/// Initialize a
/// `CPMessageListItem`for use in a
/// `CPListTemplate.`
///
/// Parameter `conversationIdentifier`: A value meaningful to your app to identify this conversation.
/// This identifier is not directly displayed to the user; rather, when the user selects this list item,
/// SiriKit will pass this identifier back to your app for your own use.
///
/// Parameter `text`: This is the main text label displayed to the user as well as spoken by
/// Siri when the user selects this list item.
///
/// Parameter `leadingConfiguration`: A set of configuration options for the leading side of the list item.
///
/// Parameter `trailingConfiguration`: A set of configuration options for the trailing side of the list item.
///
/// Parameter `detailText`: Any additional text displayed underneath the
/// `conversationName.`
/// Parameter `trailingText`: Any additional text displayed along the trailing side of the cell.
///
///
/// Note: The maximum image size is CPMaximumMessageItemImageSize. If you supply a larger image,
/// it will be scaled down to this size.
#[unsafe(method(initWithConversationIdentifier:text:leadingConfiguration:trailingConfiguration:detailText:trailingText:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithConversationIdentifier_text_leadingConfiguration_trailingConfiguration_detailText_trailingText(
this: Allocated<Self>,
conversation_identifier: &NSString,
text: &NSString,
leading_configuration: &CPMessageListItemLeadingConfiguration,
trailing_configuration: Option<&CPMessageListItemTrailingConfiguration>,
detail_text: Option<&NSString>,
trailing_text: Option<&NSString>,
) -> Retained<Self>;
/// Initialize a
/// `CPMessageListItem`for use in a
/// `CPListTemplate.`
///
/// Parameter `fullName`: The full name of the contact entity represented by this list item. This text
/// will be displayed as the main text label in the cell and will be spoken by Siri.
///
/// Parameter `phoneOrEmailAddress`: A phone or email address for this contact entity that can be used
/// to compose a message.
///
/// Parameter `leadingConfiguration`: A set of configuration options for the leading side of the list item.
///
/// Parameter `trailingConfiguration`: A set of configuration options for the trailing side of the list item.
///
/// Parameter `detailText`: Any additional text displayed underneath the
/// `conversationName.`
/// Parameter `trailingText`: Any additional text displayed along the trailing side of the cell.
///
///
/// Note: The maximum image size is CPMaximumMessageItemImageSize. If you supply a larger image,
/// it will be scaled down to this size.
#[unsafe(method(initWithFullName:phoneOrEmailAddress:leadingConfiguration:trailingConfiguration:detailText:trailingText:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithFullName_phoneOrEmailAddress_leadingConfiguration_trailingConfiguration_detailText_trailingText(
this: Allocated<Self>,
full_name: &NSString,
phone_or_email_address: &NSString,
leading_configuration: &CPMessageListItemLeadingConfiguration,
trailing_configuration: Option<&CPMessageListItemTrailingConfiguration>,
detail_text: Option<&NSString>,
trailing_text: Option<&NSString>,
) -> Retained<Self>;
/// To update the
/// `CPMessageListItem,`assign to any of these properties. If displayed in a
/// list template, the list item will be automatically reloaded.
#[unsafe(method(text))]
#[unsafe(method_family = none)]
pub unsafe fn text(&self) -> Option<Retained<NSString>>;
/// Setter for [`text`][Self::text].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setText:))]
#[unsafe(method_family = none)]
pub unsafe fn setText(&self, text: Option<&NSString>);
#[unsafe(method(conversationIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn conversationIdentifier(&self) -> Option<Retained<NSString>>;
/// Setter for [`conversationIdentifier`][Self::conversationIdentifier].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setConversationIdentifier:))]
#[unsafe(method_family = none)]
pub unsafe fn setConversationIdentifier(&self, conversation_identifier: Option<&NSString>);
#[unsafe(method(phoneOrEmailAddress))]
#[unsafe(method_family = none)]
pub unsafe fn phoneOrEmailAddress(&self) -> Option<Retained<NSString>>;
/// Setter for [`phoneOrEmailAddress`][Self::phoneOrEmailAddress].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setPhoneOrEmailAddress:))]
#[unsafe(method_family = none)]
pub unsafe fn setPhoneOrEmailAddress(&self, phone_or_email_address: Option<&NSString>);
#[unsafe(method(leadingConfiguration))]
#[unsafe(method_family = none)]
pub unsafe fn leadingConfiguration(
&self,
) -> Retained<CPMessageListItemLeadingConfiguration>;
/// Setter for [`leadingConfiguration`][Self::leadingConfiguration].
#[unsafe(method(setLeadingConfiguration:))]
#[unsafe(method_family = none)]
pub unsafe fn setLeadingConfiguration(
&self,
leading_configuration: &CPMessageListItemLeadingConfiguration,
);
#[unsafe(method(trailingConfiguration))]
#[unsafe(method_family = none)]
pub unsafe fn trailingConfiguration(
&self,
) -> Option<Retained<CPMessageListItemTrailingConfiguration>>;
/// Setter for [`trailingConfiguration`][Self::trailingConfiguration].
#[unsafe(method(setTrailingConfiguration:))]
#[unsafe(method_family = none)]
pub unsafe fn setTrailingConfiguration(
&self,
trailing_configuration: Option<&CPMessageListItemTrailingConfiguration>,
);
#[unsafe(method(detailText))]
#[unsafe(method_family = none)]
pub unsafe fn detailText(&self) -> Option<Retained<NSString>>;
/// Setter for [`detailText`][Self::detailText].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setDetailText:))]
#[unsafe(method_family = none)]
pub unsafe fn setDetailText(&self, detail_text: Option<&NSString>);
#[unsafe(method(trailingText))]
#[unsafe(method_family = none)]
pub unsafe fn trailingText(&self) -> Option<Retained<NSString>>;
/// Setter for [`trailingText`][Self::trailingText].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setTrailingText:))]
#[unsafe(method_family = none)]
pub unsafe fn setTrailingText(&self, trailing_text: Option<&NSString>);
/// A Boolean value indicating whether the list item is enabled.
///
///
/// Set the value of this property to
/// `YES`to enable the list item or
/// `NO`to disable it. The default value of this property is
/// `YES.`
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isEnabled(&self) -> bool;
/// Setter for [`isEnabled`][Self::isEnabled].
#[unsafe(method(setEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setEnabled(&self, enabled: bool);
/// Any custom user info related to this item.
#[unsafe(method(userInfo))]
#[unsafe(method_family = none)]
pub unsafe fn userInfo(&self) -> Option<Retained<AnyObject>>;
/// Setter for [`userInfo`][Self::userInfo].
///
/// # Safety
///
/// `user_info` should be of the correct type.
#[unsafe(method(setUserInfo:))]
#[unsafe(method_family = none)]
pub unsafe fn setUserInfo(&self, user_info: Option<&AnyObject>);
#[cfg(feature = "objc2-ui-kit")]
/// Image shown on the leading edge of the detail text.
#[unsafe(method(leadingDetailTextImage))]
#[unsafe(method_family = none)]
pub unsafe fn leadingDetailTextImage(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "objc2-ui-kit")]
/// Setter for [`leadingDetailTextImage`][Self::leadingDetailTextImage].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setLeadingDetailTextImage:))]
#[unsafe(method_family = none)]
pub unsafe fn setLeadingDetailTextImage(&self, leading_detail_text_image: Option<&UIImage>);
);
}
/// Methods declared on superclass `NSObject`.
impl CPMessageListItem {
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>;
);
}