objc2_car_play/generated/
CPListImageRowItem.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10use objc2_foundation::*;
11#[cfg(feature = "objc2-ui-kit")]
12use objc2_ui_kit::*;
13
14use crate::*;
15
16extern "C" {
17    /// The maximum number of images allowed in a
18    /// `CPListImageRowItem.`The system may display fewer than this number of images, depending on the available width of the car screen.
19    ///
20    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmaximumnumberofgridimages?language=objc)
21    pub static CPMaximumNumberOfGridImages: NSUInteger;
22}
23
24extern_class!(
25    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cplistimagerowitem?language=objc)
26    #[unsafe(super(NSObject))]
27    #[thread_kind = MainThreadOnly]
28    #[derive(Debug, PartialEq, Eq, Hash)]
29    pub struct CPListImageRowItem;
30);
31
32#[cfg(feature = "CPListItemTypes")]
33extern_conformance!(
34    unsafe impl CPListTemplateItem for CPListImageRowItem {}
35);
36
37#[cfg(feature = "CPListItemTypes")]
38extern_conformance!(
39    unsafe impl CPSelectableListItem for CPListImageRowItem {}
40);
41
42extern_conformance!(
43    unsafe impl NSObjectProtocol for CPListImageRowItem {}
44);
45
46impl CPListImageRowItem {
47    extern_methods!(
48        #[cfg(feature = "objc2-ui-kit")]
49        /// Initialize a list image row item with a text string and an array of
50        /// `UIImage`for the grid of images.
51        ///
52        /// When providing an image, your app should provide a
53        /// `UIImage`that is display-ready. If necessary for the image, provide
54        /// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
55        /// or by using
56        /// `UIImageAsset`to combine two
57        /// `UIImage`instances into a single image with
58        /// both styles.
59        ///
60        /// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
61        ///
62        ///
63        /// Note: The expected image size is given by +[CPListImageRowItem maximumImageSize]. Images provided will be resized to this size if necessary.
64        ///
65        ///
66        /// To properly size your images, your app should size them to the display scale of the car screen.
67        /// See -[CPInterfaceController carTraitCollection].
68        #[deprecated = "Use initWithText:elements:allowsMultipleLines:"]
69        #[unsafe(method(initWithText:images:))]
70        #[unsafe(method_family = init)]
71        pub unsafe fn initWithText_images(
72            this: Allocated<Self>,
73            text: &NSString,
74            images: &NSArray<UIImage>,
75        ) -> Retained<Self>;
76
77        #[cfg(feature = "objc2-ui-kit")]
78        /// Initialize a list image row item with a text string, an array of
79        /// `UIImage`for the grid of images, and an array of
80        /// `NSString`titles, one displayed below each image.
81        ///
82        /// The number of titles in the
83        /// `imageTitles`list should be equal to the number of images in the
84        /// `images`list.
85        ///
86        /// When providing an image, your app should provide a
87        /// `UIImage`that is display-ready. If necessary for the image, provide
88        /// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
89        /// or by using
90        /// `UIImageAsset`to combine two
91        /// `UIImage`instances into a single image with
92        /// both styles.
93        ///
94        /// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
95        ///
96        ///
97        /// Note: The expected image size is given by +[CPListImageRowItem maximumImageSize]. Images provided will be resized to this size if necessary.
98        ///
99        ///
100        /// To properly size your images, your app should size them to the display scale of the car screen.
101        /// See -[CPInterfaceController carTraitCollection].
102        #[deprecated = "Use initWithText:elements:allowsMultipleLines:"]
103        #[unsafe(method(initWithText:images:imageTitles:))]
104        #[unsafe(method_family = init)]
105        pub unsafe fn initWithText_images_imageTitles(
106            this: Allocated<Self>,
107            text: &NSString,
108            images: &NSArray<UIImage>,
109            image_titles: &NSArray<NSString>,
110        ) -> Retained<Self>;
111
112        #[cfg(all(
113            feature = "CPListImageRowItemElement",
114            feature = "CPListImageRowItemRowElement"
115        ))]
116        /// Initialize a list image row item with a text string, an array of
117        /// `CPListImageRowItemRowElement`and a boolean to allow multiple lines in this row.
118        ///
119        /// If a nil
120        /// `text`property is provided the cell will resize accordingly to hide the title.
121        ///
122        ///
123        /// Parameter `text`: The text visible at the top of the cell.
124        ///
125        /// Parameter `elements`: The list of
126        /// `CPListImageRowItemRowElement`elements visible below the text.
127        ///
128        /// Parameter `allowsMultipleLines`: Determines if the elements could be visible on more than a single line.
129        #[unsafe(method(initWithText:elements:allowsMultipleLines:))]
130        #[unsafe(method_family = init)]
131        pub unsafe fn initWithText_elements_allowsMultipleLines(
132            this: Allocated<Self>,
133            text: Option<&NSString>,
134            elements: &NSArray<CPListImageRowItemRowElement>,
135            allows_multiple_lines: bool,
136        ) -> Retained<Self>;
137
138        #[cfg(all(
139            feature = "CPListImageRowItemCardElement",
140            feature = "CPListImageRowItemElement"
141        ))]
142        /// Initialize a list image row item with a text string, an array of
143        /// `CPListImageRowItemCardElement`and a boolean to allow multiple lines in this row.
144        ///
145        /// If a nil
146        /// `text`property is provided the cell will resize accordingly to hide the title.
147        ///
148        ///
149        /// Parameter `text`: The text visible at the top of the cell.
150        ///
151        /// Parameter `cardElements`: The list of
152        /// `CPListImageRowItemCardElement`elements visible below the text.
153        ///
154        /// Parameter `allowsMultipleLines`: Determines if the elements could be visible on more than a single line.
155        #[unsafe(method(initWithText:cardElements:allowsMultipleLines:))]
156        #[unsafe(method_family = init)]
157        pub unsafe fn initWithText_cardElements_allowsMultipleLines(
158            this: Allocated<Self>,
159            text: Option<&NSString>,
160            elements: &NSArray<CPListImageRowItemCardElement>,
161            allows_multiple_lines: bool,
162        ) -> Retained<Self>;
163
164        #[cfg(all(
165            feature = "CPListImageRowItemCondensedElement",
166            feature = "CPListImageRowItemElement"
167        ))]
168        /// Initialize a list image row item with a text string, an array of
169        /// `CPListImageRowItemCondensedElement`and a boolean to allow multiple lines in this row.
170        ///
171        /// If a nil
172        /// `text`property is provided the cell will resize accordingly to hide the title.
173        ///
174        ///
175        /// Parameter `text`: The text visible at the top of the cell.
176        ///
177        /// Parameter `condensedElements`: The list of
178        /// `CPListImageRowItemCondensedElement`elements visible below the text.
179        ///
180        /// Parameter `allowsMultipleLines`: Determines if the elements could be visible on more than a single line.
181        #[unsafe(method(initWithText:condensedElements:allowsMultipleLines:))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn initWithText_condensedElements_allowsMultipleLines(
184            this: Allocated<Self>,
185            text: Option<&NSString>,
186            elements: &NSArray<CPListImageRowItemCondensedElement>,
187            allows_multiple_lines: bool,
188        ) -> Retained<Self>;
189
190        #[cfg(all(
191            feature = "CPListImageRowItemElement",
192            feature = "CPListImageRowItemGridElement"
193        ))]
194        /// Initialize a list image row item with a text string, an array of
195        /// `CPListImageRowItemGridElement`and a boolean to allow multiple lines in this row.
196        ///
197        /// If a nil
198        /// `text`property is provided the cell will resize accordingly to hide the title.
199        ///
200        ///
201        /// Parameter `text`: The text visible at the top of the cell.
202        ///
203        /// Parameter `gridElements`: The list of
204        /// `CPListImageRowItemGridElement`elements visible below the text.
205        ///
206        /// Parameter `allowsMultipleLines`: Determines if the elements could be visible on more than a single line.
207        #[unsafe(method(initWithText:gridElements:allowsMultipleLines:))]
208        #[unsafe(method_family = init)]
209        pub unsafe fn initWithText_gridElements_allowsMultipleLines(
210            this: Allocated<Self>,
211            text: Option<&NSString>,
212            elements: &NSArray<CPListImageRowItemGridElement>,
213            allows_multiple_lines: bool,
214        ) -> Retained<Self>;
215
216        #[cfg(all(
217            feature = "CPListImageRowItemElement",
218            feature = "CPListImageRowItemImageGridElement"
219        ))]
220        /// Initialize a list image row item with a text string, an array of
221        /// `CPListImageRowItemImageGridElement`and a boolean to allow multiple lines in this row.
222        ///
223        /// If a nil
224        /// `text`property is provided the cell will resize accordingly to hide the title.
225        ///
226        ///
227        /// Parameter `text`: The text visible at the top of the cell.
228        ///
229        /// Parameter `imageGridElements`: The list of
230        /// `CPListImageRowItemImageGridElement`elements visible below the text.
231        ///
232        /// Parameter `allowsMultipleLines`: Determines if the elements could be visible on more than a single line.
233        #[unsafe(method(initWithText:imageGridElements:allowsMultipleLines:))]
234        #[unsafe(method_family = init)]
235        pub unsafe fn initWithText_imageGridElements_allowsMultipleLines(
236            this: Allocated<Self>,
237            text: Option<&NSString>,
238            elements: &NSArray<CPListImageRowItemImageGridElement>,
239            allows_multiple_lines: bool,
240        ) -> Retained<Self>;
241
242        /// The primary text shown in a cell displaying this list item.
243        #[unsafe(method(text))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn text(&self) -> Option<Retained<NSString>>;
246
247        /// Setter for [`text`][Self::text].
248        ///
249        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
250        #[unsafe(method(setText:))]
251        #[unsafe(method_family = none)]
252        pub unsafe fn setText(&self, text: Option<&NSString>);
253
254        /// Any custom user info related to this item.
255        #[unsafe(method(userInfo))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn userInfo(&self) -> Option<Retained<AnyObject>>;
258
259        /// Setter for [`userInfo`][Self::userInfo].
260        ///
261        /// # Safety
262        ///
263        /// `user_info` should be of the correct type.
264        #[unsafe(method(setUserInfo:))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn setUserInfo(&self, user_info: Option<&AnyObject>);
267
268        #[cfg(all(feature = "CPListItemTypes", feature = "block2", feature = "dispatch2"))]
269        /// An optional action block, fired when the user selects this item in a list template.
270        ///
271        /// # Safety
272        ///
273        /// - The returned block's argument 1 must be a valid pointer.
274        /// - The returned block's argument 2 must be a valid pointer.
275        #[unsafe(method(handler))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn handler(
278            &self,
279        ) -> *mut block2::DynBlock<
280            dyn Fn(NonNull<ProtocolObject<dyn CPSelectableListItem>>, dispatch_block_t),
281        >;
282
283        #[cfg(all(feature = "CPListItemTypes", feature = "block2", feature = "dispatch2"))]
284        /// Setter for [`handler`][Self::handler].
285        ///
286        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
287        #[unsafe(method(setHandler:))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn setHandler(
290            &self,
291            handler: Option<
292                &block2::DynBlock<
293                    dyn Fn(NonNull<ProtocolObject<dyn CPSelectableListItem>>, dispatch_block_t),
294                >,
295            >,
296        );
297
298        /// A Boolean value indicating whether the list item is enabled.
299        ///
300        ///
301        /// Set the value of this property to
302        /// `YES`to enable the list item or
303        /// `NO`to disable it. The default value of this property is
304        /// `YES.`
305        #[unsafe(method(isEnabled))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn isEnabled(&self) -> bool;
308
309        /// Setter for [`isEnabled`][Self::isEnabled].
310        #[unsafe(method(setEnabled:))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn setEnabled(&self, enabled: bool);
313
314        #[cfg(feature = "objc2-ui-kit")]
315        /// Read-only access to the grid images shown in a row in the cell.
316        ///
317        ///
318        /// Note: The maximum number of images shown is
319        /// `CPMaximumNumberOfGridImages.`If you supply more images, only the first
320        /// `CPMaximumNumberOfGridImages`will be used.
321        #[deprecated = "No longer supported"]
322        #[unsafe(method(gridImages))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn gridImages(&self) -> Retained<NSArray<UIImage>>;
325
326        #[cfg(feature = "objc2-ui-kit")]
327        /// Update the images displayed in this image row item. If this image row
328        /// item is already displayed in a list template, this image row item will be
329        /// automatically reloaded.
330        ///
331        /// When providing an image, your app should provide a
332        /// `UIImage`that is display-ready. If necessary for the image, provide
333        /// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
334        /// or by using
335        /// `UIImageAsset`to combine two
336        /// `UIImage`instances into a single image with
337        /// both styles.
338        ///
339        /// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
340        ///
341        ///
342        /// See: To update/reload the title of the image row item, assign to
343        /// the
344        /// `text`property of the image row item.
345        ///
346        /// See: To update/reload the title labels displayed below each image, assign to
347        /// the
348        /// `imageTitles`property of the image row item.
349        #[deprecated = "No longer supported"]
350        #[unsafe(method(updateImages:))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn updateImages(&self, grid_images: &NSArray<UIImage>);
353
354        /// The titles displayed for each image in this image row item.
355        ///
356        ///
357        /// See: To update/reload the title of the image row item, assign to
358        /// the
359        /// `text`property of the image row item.
360        #[deprecated = "No longer supported"]
361        #[unsafe(method(imageTitles))]
362        #[unsafe(method_family = none)]
363        pub unsafe fn imageTitles(&self) -> Retained<NSArray<NSString>>;
364
365        #[cfg(feature = "CPListImageRowItemElement")]
366        /// The array of elements used to draw visible elements.
367        #[unsafe(method(elements))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn elements(&self) -> Retained<NSArray<CPListImageRowItemElement>>;
370
371        #[cfg(feature = "CPListImageRowItemElement")]
372        /// Setter for [`elements`][Self::elements].
373        ///
374        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
375        #[unsafe(method(setElements:))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn setElements(&self, elements: &NSArray<CPListImageRowItemElement>);
378
379        /// A Boolean value indicating whether the elements should be visible in more than a single line.
380        ///
381        ///
382        /// Set the value of this property to
383        /// `YES`to allow elements to be visible on multiple lines. Set the value of this property to
384        /// `NO`to only show a single line of elements.
385        #[unsafe(method(allowsMultipleLines))]
386        #[unsafe(method_family = none)]
387        pub unsafe fn allowsMultipleLines(&self) -> bool;
388
389        #[cfg(all(feature = "block2", feature = "dispatch2"))]
390        /// A block that is called when the user selects one of the images in this image row item.
391        ///
392        /// The user may also select the cell itself - for that event, specify a
393        /// `handler.`
394        ///
395        /// # Safety
396        ///
397        /// - The returned block's argument 1 must be a valid pointer.
398        /// - The returned block's argument 3 must be a valid pointer.
399        #[unsafe(method(listImageRowHandler))]
400        #[unsafe(method_family = none)]
401        pub unsafe fn listImageRowHandler(
402            &self,
403        ) -> *mut block2::DynBlock<dyn Fn(NonNull<CPListImageRowItem>, NSInteger, dispatch_block_t)>;
404
405        #[cfg(all(feature = "block2", feature = "dispatch2"))]
406        /// Setter for [`listImageRowHandler`][Self::listImageRowHandler].
407        ///
408        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
409        #[unsafe(method(setListImageRowHandler:))]
410        #[unsafe(method_family = none)]
411        pub unsafe fn setListImageRowHandler(
412            &self,
413            list_image_row_handler: Option<
414                &block2::DynBlock<dyn Fn(NonNull<CPListImageRowItem>, NSInteger, dispatch_block_t)>,
415            >,
416        );
417
418        #[cfg(feature = "objc2-core-foundation")]
419        /// The expected image size for the grid images in your
420        /// `CPListImageRowItem.`Images provided
421        /// will be resized to this size.
422        ///
423        ///
424        /// To properly size your images, your app should size them to the display scale of the car screen.
425        /// See -[CPInterfaceController carTraitCollection].
426        #[deprecated = "Use +[CPListImageRowItemElement maximumImageSize] on an appropriate element"]
427        #[unsafe(method(maximumImageSize))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn maximumImageSize(mtm: MainThreadMarker) -> CGSize;
430    );
431}
432
433/// Methods declared on superclass `NSObject`.
434impl CPListImageRowItem {
435    extern_methods!(
436        #[unsafe(method(init))]
437        #[unsafe(method_family = init)]
438        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
439
440        #[unsafe(method(new))]
441        #[unsafe(method_family = new)]
442        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
443    );
444}