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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "dispatch2")]
use dispatch2::*;
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" {
/// The maximum number of images allowed in a
/// `CPListImageRowItem.`The system may display fewer than this number of images, depending on the available width of the car screen.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmaximumnumberofgridimages?language=objc)
pub static CPMaximumNumberOfGridImages: NSUInteger;
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cplistimagerowitem?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPListImageRowItem;
);
#[cfg(feature = "CPListItemTypes")]
extern_conformance!(
unsafe impl CPListTemplateItem for CPListImageRowItem {}
);
#[cfg(feature = "CPListItemTypes")]
extern_conformance!(
unsafe impl CPSelectableListItem for CPListImageRowItem {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPListImageRowItem {}
);
impl CPListImageRowItem {
extern_methods!(
#[cfg(feature = "objc2-ui-kit")]
/// Initialize a list image row item with a text string and an array of
/// `UIImage`for the grid of images.
///
/// 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.
///
///
/// Note: The expected image size is given by +[CPListImageRowItem maximumImageSize]. Images provided will be resized to this size if necessary.
///
///
/// To properly size your images, your app should size them to the display scale of the car screen.
/// See -[CPInterfaceController carTraitCollection].
#[deprecated = "Use initWithText:elements:allowsMultipleLines:"]
#[unsafe(method(initWithText:images:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithText_images(
this: Allocated<Self>,
text: &NSString,
images: &NSArray<UIImage>,
) -> Retained<Self>;
#[cfg(feature = "objc2-ui-kit")]
/// Initialize a list image row item with a text string, an array of
/// `UIImage`for the grid of images, and an array of
/// `NSString`titles, one displayed below each image.
///
/// The number of titles in the
/// `imageTitles`list should be equal to the number of images in the
/// `images`list.
///
/// 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.
///
///
/// Note: The expected image size is given by +[CPListImageRowItem maximumImageSize]. Images provided will be resized to this size if necessary.
///
///
/// To properly size your images, your app should size them to the display scale of the car screen.
/// See -[CPInterfaceController carTraitCollection].
#[deprecated = "Use initWithText:elements:allowsMultipleLines:"]
#[unsafe(method(initWithText:images:imageTitles:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithText_images_imageTitles(
this: Allocated<Self>,
text: &NSString,
images: &NSArray<UIImage>,
image_titles: &NSArray<NSString>,
) -> Retained<Self>;
#[cfg(all(
feature = "CPListImageRowItemElement",
feature = "CPListImageRowItemRowElement"
))]
/// Initialize a list image row item with a text string, an array of
/// `CPListImageRowItemRowElement`and a boolean to allow multiple lines in this row.
///
/// If a nil
/// `text`property is provided the cell will resize accordingly to hide the title.
///
///
/// Parameter `text`: The text visible at the top of the cell.
///
/// Parameter `elements`: The list of
/// `CPListImageRowItemRowElement`elements visible below the text.
///
/// Parameter `allowsMultipleLines`: Determines if the elements could be visible on more than a single line.
#[unsafe(method(initWithText:elements:allowsMultipleLines:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithText_elements_allowsMultipleLines(
this: Allocated<Self>,
text: Option<&NSString>,
elements: &NSArray<CPListImageRowItemRowElement>,
allows_multiple_lines: bool,
) -> Retained<Self>;
#[cfg(all(
feature = "CPListImageRowItemCardElement",
feature = "CPListImageRowItemElement"
))]
/// Initialize a list image row item with a text string, an array of
/// `CPListImageRowItemCardElement`and a boolean to allow multiple lines in this row.
///
/// If a nil
/// `text`property is provided the cell will resize accordingly to hide the title.
///
///
/// Parameter `text`: The text visible at the top of the cell.
///
/// Parameter `cardElements`: The list of
/// `CPListImageRowItemCardElement`elements visible below the text.
///
/// Parameter `allowsMultipleLines`: Determines if the elements could be visible on more than a single line.
#[unsafe(method(initWithText:cardElements:allowsMultipleLines:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithText_cardElements_allowsMultipleLines(
this: Allocated<Self>,
text: Option<&NSString>,
elements: &NSArray<CPListImageRowItemCardElement>,
allows_multiple_lines: bool,
) -> Retained<Self>;
#[cfg(all(
feature = "CPListImageRowItemCondensedElement",
feature = "CPListImageRowItemElement"
))]
/// Initialize a list image row item with a text string, an array of
/// `CPListImageRowItemCondensedElement`and a boolean to allow multiple lines in this row.
///
/// If a nil
/// `text`property is provided the cell will resize accordingly to hide the title.
///
///
/// Parameter `text`: The text visible at the top of the cell.
///
/// Parameter `condensedElements`: The list of
/// `CPListImageRowItemCondensedElement`elements visible below the text.
///
/// Parameter `allowsMultipleLines`: Determines if the elements could be visible on more than a single line.
#[unsafe(method(initWithText:condensedElements:allowsMultipleLines:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithText_condensedElements_allowsMultipleLines(
this: Allocated<Self>,
text: Option<&NSString>,
elements: &NSArray<CPListImageRowItemCondensedElement>,
allows_multiple_lines: bool,
) -> Retained<Self>;
#[cfg(all(
feature = "CPListImageRowItemElement",
feature = "CPListImageRowItemGridElement"
))]
/// Initialize a list image row item with a text string, an array of
/// `CPListImageRowItemGridElement`and a boolean to allow multiple lines in this row.
///
/// If a nil
/// `text`property is provided the cell will resize accordingly to hide the title.
///
///
/// Parameter `text`: The text visible at the top of the cell.
///
/// Parameter `gridElements`: The list of
/// `CPListImageRowItemGridElement`elements visible below the text.
///
/// Parameter `allowsMultipleLines`: Determines if the elements could be visible on more than a single line.
#[unsafe(method(initWithText:gridElements:allowsMultipleLines:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithText_gridElements_allowsMultipleLines(
this: Allocated<Self>,
text: Option<&NSString>,
elements: &NSArray<CPListImageRowItemGridElement>,
allows_multiple_lines: bool,
) -> Retained<Self>;
#[cfg(all(
feature = "CPListImageRowItemElement",
feature = "CPListImageRowItemImageGridElement"
))]
/// Initialize a list image row item with a text string, an array of
/// `CPListImageRowItemImageGridElement`and a boolean to allow multiple lines in this row.
///
/// If a nil
/// `text`property is provided the cell will resize accordingly to hide the title.
///
///
/// Parameter `text`: The text visible at the top of the cell.
///
/// Parameter `imageGridElements`: The list of
/// `CPListImageRowItemImageGridElement`elements visible below the text.
///
/// Parameter `allowsMultipleLines`: Determines if the elements could be visible on more than a single line.
#[unsafe(method(initWithText:imageGridElements:allowsMultipleLines:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithText_imageGridElements_allowsMultipleLines(
this: Allocated<Self>,
text: Option<&NSString>,
elements: &NSArray<CPListImageRowItemImageGridElement>,
allows_multiple_lines: bool,
) -> Retained<Self>;
/// The primary text shown in a cell displaying this list item.
#[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>);
/// 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(all(feature = "CPListItemTypes", feature = "block2", feature = "dispatch2"))]
/// An optional action block, fired when the user selects this item in a list template.
///
/// # Safety
///
/// - The returned block's argument 1 must be a valid pointer.
/// - The returned block's argument 2 must be a valid pointer.
#[unsafe(method(handler))]
#[unsafe(method_family = none)]
pub unsafe fn handler(
&self,
) -> *mut block2::DynBlock<
dyn Fn(NonNull<ProtocolObject<dyn CPSelectableListItem>>, dispatch_block_t),
>;
#[cfg(all(feature = "CPListItemTypes", feature = "block2", feature = "dispatch2"))]
/// Setter for [`handler`][Self::handler].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn setHandler(
&self,
handler: Option<
&block2::DynBlock<
dyn Fn(NonNull<ProtocolObject<dyn CPSelectableListItem>>, dispatch_block_t),
>,
>,
);
/// 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);
#[cfg(feature = "objc2-ui-kit")]
/// Read-only access to the grid images shown in a row in the cell.
///
///
/// Note: The maximum number of images shown is
/// `CPMaximumNumberOfGridImages.`If you supply more images, only the first
/// `CPMaximumNumberOfGridImages`will be used.
#[deprecated = "No longer supported"]
#[unsafe(method(gridImages))]
#[unsafe(method_family = none)]
pub unsafe fn gridImages(&self) -> Retained<NSArray<UIImage>>;
#[cfg(feature = "objc2-ui-kit")]
/// Update the images displayed in this image row item. If this image row
/// item is already displayed in a list template, this image row item will be
/// automatically reloaded.
///
/// 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.
///
///
/// See: To update/reload the title of the image row item, assign to
/// the
/// `text`property of the image row item.
///
/// See: To update/reload the title labels displayed below each image, assign to
/// the
/// `imageTitles`property of the image row item.
#[deprecated = "No longer supported"]
#[unsafe(method(updateImages:))]
#[unsafe(method_family = none)]
pub unsafe fn updateImages(&self, grid_images: &NSArray<UIImage>);
/// The titles displayed for each image in this image row item.
///
///
/// See: To update/reload the title of the image row item, assign to
/// the
/// `text`property of the image row item.
#[deprecated = "No longer supported"]
#[unsafe(method(imageTitles))]
#[unsafe(method_family = none)]
pub unsafe fn imageTitles(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "CPListImageRowItemElement")]
/// The array of elements used to draw visible elements.
#[unsafe(method(elements))]
#[unsafe(method_family = none)]
pub unsafe fn elements(&self) -> Retained<NSArray<CPListImageRowItemElement>>;
#[cfg(feature = "CPListImageRowItemElement")]
/// Setter for [`elements`][Self::elements].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setElements:))]
#[unsafe(method_family = none)]
pub unsafe fn setElements(&self, elements: &NSArray<CPListImageRowItemElement>);
/// A Boolean value indicating whether the elements should be visible in more than a single line.
///
///
/// Set the value of this property to
/// `YES`to allow elements to be visible on multiple lines. Set the value of this property to
/// `NO`to only show a single line of elements.
#[unsafe(method(allowsMultipleLines))]
#[unsafe(method_family = none)]
pub unsafe fn allowsMultipleLines(&self) -> bool;
#[cfg(all(feature = "block2", feature = "dispatch2"))]
/// A block that is called when the user selects one of the images in this image row item.
///
/// The user may also select the cell itself - for that event, specify a
/// `handler.`
///
/// # Safety
///
/// - The returned block's argument 1 must be a valid pointer.
/// - The returned block's argument 3 must be a valid pointer.
#[unsafe(method(listImageRowHandler))]
#[unsafe(method_family = none)]
pub unsafe fn listImageRowHandler(
&self,
) -> *mut block2::DynBlock<dyn Fn(NonNull<CPListImageRowItem>, NSInteger, dispatch_block_t)>;
#[cfg(all(feature = "block2", feature = "dispatch2"))]
/// Setter for [`listImageRowHandler`][Self::listImageRowHandler].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setListImageRowHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn setListImageRowHandler(
&self,
list_image_row_handler: Option<
&block2::DynBlock<dyn Fn(NonNull<CPListImageRowItem>, NSInteger, dispatch_block_t)>,
>,
);
#[cfg(feature = "objc2-core-foundation")]
/// The expected image size for the grid images in your
/// `CPListImageRowItem.`Images provided
/// will be resized to this size.
///
///
/// To properly size your images, your app should size them to the display scale of the car screen.
/// See -[CPInterfaceController carTraitCollection].
#[deprecated = "Use +[CPListImageRowItemElement maximumImageSize] on an appropriate element"]
#[unsafe(method(maximumImageSize))]
#[unsafe(method_family = none)]
pub unsafe fn maximumImageSize(mtm: MainThreadMarker) -> CGSize;
);
}
/// Methods declared on superclass `NSObject`.
impl CPListImageRowItem {
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(mtm: MainThreadMarker) -> Retained<Self>;
);
}