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
//! 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" {
/// The expected maximum size of an image size for your
/// `CPListSection.`To properly size your images, your app should size them to the display scale of the car screen.
/// See -[CPInterfaceController carTraitCollection].
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmaximumlistsectionimagesize?language=objc)
#[cfg(feature = "objc2-core-foundation")]
pub static CPMaximumListSectionImageSize: CGSize;
}
extern_class!(
/// `CPListSection`models a single section of items appearing in a
/// `CPListTemplate.`
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cplistsection?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPListSection;
);
extern_conformance!(
unsafe impl NSCoding for CPListSection {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPListSection {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPListSection {}
);
impl CPListSection {
extern_methods!(
#[cfg(feature = "CPListItemTypes")]
#[unsafe(method(initWithItems:header:sectionIndexTitle:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithItems_header_sectionIndexTitle(
this: Allocated<Self>,
items: &NSArray<ProtocolObject<dyn CPListTemplateItem>>,
header: Option<&NSString>,
section_index_title: Option<&NSString>,
) -> Retained<Self>;
#[cfg(all(
feature = "CPButton",
feature = "CPListItemTypes",
feature = "objc2-ui-kit"
))]
/// Create a section with a list of items and an optional header containing labels, an image, and a button.
///
///
/// Note: The maximum size of the section header image is given by CPMaximumListSectionImageSize.
///
/// When providing an image, your app may 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 header image, your app should consider the display scale of the car screen.
/// See -[CPInterfaceController carTraitCollection].
#[unsafe(method(initWithItems:header:headerSubtitle:headerImage:headerButton:sectionIndexTitle:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithItems_header_headerSubtitle_headerImage_headerButton_sectionIndexTitle(
this: Allocated<Self>,
items: &NSArray<ProtocolObject<dyn CPListTemplateItem>>,
header: &NSString,
header_subtitle: Option<&NSString>,
header_image: Option<&UIImage>,
header_button: Option<&CPButton>,
section_index_title: Option<&NSString>,
) -> Retained<Self>;
#[cfg(feature = "CPListItemTypes")]
#[unsafe(method(initWithItems:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithItems(
this: Allocated<Self>,
items: &NSArray<ProtocolObject<dyn CPListTemplateItem>>,
) -> Retained<Self>;
#[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>;
/// Optional string to use for a simple header in this section.
#[unsafe(method(header))]
#[unsafe(method_family = none)]
pub unsafe fn header(&self) -> Option<Retained<NSString>>;
/// Optional section header elements used by the enhanced header in this section.
#[unsafe(method(headerSubtitle))]
#[unsafe(method_family = none)]
pub unsafe fn headerSubtitle(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "objc2-ui-kit")]
#[unsafe(method(headerImage))]
#[unsafe(method_family = none)]
pub unsafe fn headerImage(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "objc2-ui-kit")]
/// Setter for [`headerImage`][Self::headerImage].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setHeaderImage:))]
#[unsafe(method_family = none)]
pub unsafe fn setHeaderImage(&self, header_image: Option<&UIImage>);
#[cfg(feature = "CPButton")]
#[unsafe(method(headerButton))]
#[unsafe(method_family = none)]
pub unsafe fn headerButton(&self) -> Option<Retained<CPButton>>;
/// An optional section index title to use in a table displaying this section.
/// The system will enforce a maximum length of 1 for each section index title - in other words,
/// you must choose single-character section index titles.
#[unsafe(method(sectionIndexTitle))]
#[unsafe(method_family = none)]
pub unsafe fn sectionIndexTitle(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "CPListItemTypes")]
/// Items appearing in this section.
#[unsafe(method(items))]
#[unsafe(method_family = none)]
pub unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn CPListTemplateItem>>>;
#[cfg(feature = "CPListItemTypes")]
/// Search for an item in this section, returning its index
/// or
/// `NSNotFound`if not found.
#[unsafe(method(indexOfItem:))]
#[unsafe(method_family = none)]
pub unsafe fn indexOfItem(
&self,
item: &ProtocolObject<dyn CPListTemplateItem>,
) -> NSUInteger;
#[cfg(feature = "CPListItemTypes")]
/// Convenience access to the item in this section at the specified index.
#[unsafe(method(itemAtIndex:))]
#[unsafe(method_family = none)]
pub unsafe fn itemAtIndex(
&self,
index: NSUInteger,
) -> Retained<ProtocolObject<dyn CPListTemplateItem>>;
);
}