objc2_car_play/generated/
CPListSection.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    /// The expected maximum size of an image size for your
16    /// `CPListSection.`To properly size your images, your app should size them to the display scale of the car screen.
17    /// See -[CPInterfaceController carTraitCollection].
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmaximumlistsectionimagesize?language=objc)
20    #[cfg(feature = "objc2-core-foundation")]
21    pub static CPMaximumListSectionImageSize: CGSize;
22}
23
24extern_class!(
25    /// `CPListSection`models a single section of items appearing in a
26    /// `CPListTemplate.`
27    ///
28    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cplistsection?language=objc)
29    #[unsafe(super(NSObject))]
30    #[derive(Debug, PartialEq, Eq, Hash)]
31    pub struct CPListSection;
32);
33
34extern_conformance!(
35    unsafe impl NSCoding for CPListSection {}
36);
37
38extern_conformance!(
39    unsafe impl NSObjectProtocol for CPListSection {}
40);
41
42extern_conformance!(
43    unsafe impl NSSecureCoding for CPListSection {}
44);
45
46impl CPListSection {
47    extern_methods!(
48        #[cfg(feature = "CPListItemTypes")]
49        #[unsafe(method(initWithItems:header:sectionIndexTitle:))]
50        #[unsafe(method_family = init)]
51        pub unsafe fn initWithItems_header_sectionIndexTitle(
52            this: Allocated<Self>,
53            items: &NSArray<ProtocolObject<dyn CPListTemplateItem>>,
54            header: Option<&NSString>,
55            section_index_title: Option<&NSString>,
56        ) -> Retained<Self>;
57
58        #[cfg(all(
59            feature = "CPButton",
60            feature = "CPListItemTypes",
61            feature = "objc2-ui-kit"
62        ))]
63        /// Create a section with a list of items and an optional header containing labels, an image, and a button.
64        ///
65        ///
66        /// Note: The maximum size of the section header image is given by CPMaximumListSectionImageSize.
67        ///
68        /// When providing an image, your app may provide a
69        /// `UIImage`that is display-ready. If necessary for the image, provide
70        /// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
71        /// or by using
72        /// `UIImageAsset`to combine two
73        /// `UIImage`instances into a single image with
74        /// both styles.
75        ///
76        /// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
77        ///
78        ///
79        /// To properly size your header image, your app should consider the display scale of the car screen.
80        /// See -[CPInterfaceController carTraitCollection].
81        #[unsafe(method(initWithItems:header:headerSubtitle:headerImage:headerButton:sectionIndexTitle:))]
82        #[unsafe(method_family = init)]
83        pub unsafe fn initWithItems_header_headerSubtitle_headerImage_headerButton_sectionIndexTitle(
84            this: Allocated<Self>,
85            items: &NSArray<ProtocolObject<dyn CPListTemplateItem>>,
86            header: &NSString,
87            header_subtitle: Option<&NSString>,
88            header_image: Option<&UIImage>,
89            header_button: Option<&CPButton>,
90            section_index_title: Option<&NSString>,
91        ) -> Retained<Self>;
92
93        #[cfg(feature = "CPListItemTypes")]
94        #[unsafe(method(initWithItems:))]
95        #[unsafe(method_family = init)]
96        pub unsafe fn initWithItems(
97            this: Allocated<Self>,
98            items: &NSArray<ProtocolObject<dyn CPListTemplateItem>>,
99        ) -> Retained<Self>;
100
101        #[unsafe(method(init))]
102        #[unsafe(method_family = init)]
103        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
104
105        #[unsafe(method(new))]
106        #[unsafe(method_family = new)]
107        pub unsafe fn new() -> Retained<Self>;
108
109        /// Optional string to use for a simple header in this section.
110        #[unsafe(method(header))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn header(&self) -> Option<Retained<NSString>>;
113
114        /// Optional section header elements used by the enhanced header in this section.
115        #[unsafe(method(headerSubtitle))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn headerSubtitle(&self) -> Option<Retained<NSString>>;
118
119        #[cfg(feature = "objc2-ui-kit")]
120        #[unsafe(method(headerImage))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn headerImage(&self) -> Option<Retained<UIImage>>;
123
124        #[cfg(feature = "objc2-ui-kit")]
125        /// Setter for [`headerImage`][Self::headerImage].
126        ///
127        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
128        #[unsafe(method(setHeaderImage:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setHeaderImage(&self, header_image: Option<&UIImage>);
131
132        #[cfg(feature = "CPButton")]
133        #[unsafe(method(headerButton))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn headerButton(&self) -> Option<Retained<CPButton>>;
136
137        /// An optional section index title to use in a table displaying this section.
138        /// The system will enforce a maximum length of 1 for each section index title - in other words,
139        /// you must choose single-character section index titles.
140        #[unsafe(method(sectionIndexTitle))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn sectionIndexTitle(&self) -> Option<Retained<NSString>>;
143
144        #[cfg(feature = "CPListItemTypes")]
145        /// Items appearing in this section.
146        #[unsafe(method(items))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn CPListTemplateItem>>>;
149
150        #[cfg(feature = "CPListItemTypes")]
151        /// Search for an item in this section, returning its index
152        /// or
153        /// `NSNotFound`if not found.
154        #[unsafe(method(indexOfItem:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn indexOfItem(
157            &self,
158            item: &ProtocolObject<dyn CPListTemplateItem>,
159        ) -> NSUInteger;
160
161        #[cfg(feature = "CPListItemTypes")]
162        /// Convenience access to the item in this section at the specified index.
163        #[unsafe(method(itemAtIndex:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn itemAtIndex(
166            &self,
167            index: NSUInteger,
168        ) -> Retained<ProtocolObject<dyn CPListTemplateItem>>;
169    );
170}