objc2_car_play/generated/
CPListImageRowItemImageGridElement.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
12/// Types of shape used to draw a list item.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cplistimagerowitemimagegridelementshape?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct CPListImageRowItemImageGridElementShape(pub NSInteger);
19impl CPListImageRowItemImageGridElementShape {
20    /// The list item will render a row of elements.
21    #[doc(alias = "CPListImageRowItemImageGridElementShapeCircular")]
22    pub const Circular: Self = Self(0);
23    /// The list item will render a condensed list of rounded rectangle elements.
24    #[doc(alias = "CPListImageRowItemImageGridElementShapeRoundedRectangle")]
25    pub const RoundedRectangle: Self = Self(1);
26}
27
28unsafe impl Encode for CPListImageRowItemImageGridElementShape {
29    const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32unsafe impl RefEncode for CPListImageRowItemImageGridElementShape {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern_class!(
37    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cplistimagerowitemimagegridelement?language=objc)
38    #[unsafe(super(CPListImageRowItemElement, NSObject))]
39    #[thread_kind = MainThreadOnly]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    #[cfg(feature = "CPListImageRowItemElement")]
42    pub struct CPListImageRowItemImageGridElement;
43);
44
45#[cfg(feature = "CPListImageRowItemElement")]
46extern_conformance!(
47    unsafe impl NSObjectProtocol for CPListImageRowItemImageGridElement {}
48);
49
50#[cfg(feature = "CPListImageRowItemElement")]
51impl CPListImageRowItemImageGridElement {
52    extern_methods!(
53        #[cfg(feature = "objc2-ui-kit")]
54        /// Initialize an element that is constituted of an image and an image shape.
55        ///
56        /// When providing an image, your app should provide a
57        /// `UIImage`that is display-ready. If necessary for the image, provide
58        /// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
59        /// or by using
60        /// `UIImageAsset`to combine two
61        /// `UIImage`instances into a single image with
62        /// both styles.
63        ///
64        /// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
65        ///
66        ///
67        /// Note: The expected image size is given by +[CPListImageRowItemImageGridElement maximumImageSize]. Images provided will be resized to this size if necessary.
68        ///
69        ///
70        /// To properly size your images, your app should size them to the display scale of the car screen.
71        /// See -[CPInterfaceController carTraitCollection].
72        ///
73        ///
74        /// Parameter `image`: The image associated to the element.
75        ///
76        /// Parameter `imageShape`: The
77        /// `CPListImageRowItemImageGridElementShape`shape being applied on the image.
78        ///
79        /// Parameter `title`: The title of the element.
80        ///
81        /// Parameter `accessorySymbolName`: The system symbol used as an accessory view.
82        #[unsafe(method(initWithImage:imageShape:title:accessorySymbolName:))]
83        #[unsafe(method_family = init)]
84        pub unsafe fn initWithImage_imageShape_title_accessorySymbolName(
85            this: Allocated<Self>,
86            image: &UIImage,
87            image_shape: CPListImageRowItemImageGridElementShape,
88            title: &NSString,
89            accessory_symbol_name: Option<&NSString>,
90        ) -> Retained<Self>;
91
92        /// The title associated with this element.
93        #[unsafe(method(title))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn title(&self) -> Retained<NSString>;
96
97        /// Setter for [`title`][Self::title].
98        ///
99        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
100        #[unsafe(method(setTitle:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setTitle(&self, title: &NSString);
103
104        /// The name of the system symbol image to use as accessory.
105        #[unsafe(method(accessorySymbolName))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn accessorySymbolName(&self) -> Option<Retained<NSString>>;
108
109        /// Setter for [`accessorySymbolName`][Self::accessorySymbolName].
110        ///
111        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
112        #[unsafe(method(setAccessorySymbolName:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setAccessorySymbolName(&self, accessory_symbol_name: Option<&NSString>);
115
116        /// Shape used to draw the image of the element.
117        #[unsafe(method(imageShape))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn imageShape(&self) -> CPListImageRowItemImageGridElementShape;
120    );
121}
122
123/// Methods declared on superclass `CPListImageRowItemElement`.
124#[cfg(feature = "CPListImageRowItemElement")]
125impl CPListImageRowItemImageGridElement {
126    extern_methods!(
127        #[unsafe(method(init))]
128        #[unsafe(method_family = init)]
129        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
130    );
131}
132
133/// Methods declared on superclass `NSObject`.
134#[cfg(feature = "CPListImageRowItemElement")]
135impl CPListImageRowItemImageGridElement {
136    extern_methods!(
137        #[unsafe(method(new))]
138        #[unsafe(method_family = new)]
139        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
140    );
141}