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
//! 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::*;
use objc2_foundation::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpinformationtemplatelayout?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CPInformationTemplateLayout(pub NSInteger);
impl CPInformationTemplateLayout {
/// A layout that will align all items on the leading edge of the template.
#[doc(alias = "CPInformationTemplateLayoutLeading")]
pub const Leading: Self = Self(0);
/// A layout that will split each item into two columns.
#[doc(alias = "CPInformationTemplateLayoutTwoColumn")]
pub const TwoColumn: Self = Self(1);
}
unsafe impl Encode for CPInformationTemplateLayout {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for CPInformationTemplateLayout {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpinformationtemplate?language=objc)
#[unsafe(super(CPTemplate, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "CPTemplate")]
pub struct CPInformationTemplate;
);
#[cfg(all(feature = "CPBarButtonProviding", feature = "CPTemplate"))]
extern_conformance!(
unsafe impl CPBarButtonProviding for CPInformationTemplate {}
);
#[cfg(feature = "CPTemplate")]
extern_conformance!(
unsafe impl NSCoding for CPInformationTemplate {}
);
#[cfg(feature = "CPTemplate")]
extern_conformance!(
unsafe impl NSObjectProtocol for CPInformationTemplate {}
);
#[cfg(feature = "CPTemplate")]
extern_conformance!(
unsafe impl NSSecureCoding for CPInformationTemplate {}
);
#[cfg(feature = "CPTemplate")]
impl CPInformationTemplate {
extern_methods!(
#[cfg(all(feature = "CPInformationItem", feature = "CPTextButton"))]
/// Initialize a CPInformationTemplate with a title, optional labels, and optional action buttons.
///
///
/// Parameter `layout`: Information template layout, either leading aligned or two columns
///
/// Parameter `title`: Information template title, appears at the top of the template
///
/// Parameter `items`: Information items that will appear in the template
///
/// Parameter `actions`: Optional actions that appear at the bottom of the template
///
///
/// Note: The maximum number of
/// `CPInformationItem`is 10. If you specify more than 10 items, only the first 10 will be used.
/// The maximum number of
/// `CPTextButton`is 3. If you specify more than 3, only the first 3 will be used.
#[unsafe(method(initWithTitle:layout:items:actions:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTitle_layout_items_actions(
this: Allocated<Self>,
title: &NSString,
layout: CPInformationTemplateLayout,
items: &NSArray<CPInformationItem>,
actions: &NSArray<CPTextButton>,
) -> Retained<Self>;
/// Information template layout, either leading aligned or two columns.
#[unsafe(method(layout))]
#[unsafe(method_family = none)]
pub unsafe fn layout(&self) -> CPInformationTemplateLayout;
/// Title that will appear at the top of the template.
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub unsafe fn title(&self) -> Retained<NSString>;
/// Setter for [`title`][Self::title].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub unsafe fn setTitle(&self, title: &NSString);
#[cfg(feature = "CPInformationItem")]
/// An array of
/// `CPInformationItem.`To update the items appearing in this information template, assign a new array to this property.
///
///
/// Note: The maximum number of items is 10. If you specify more than 10 items, only the first 10 will be used.
#[unsafe(method(items))]
#[unsafe(method_family = none)]
pub unsafe fn items(&self) -> Retained<NSArray<CPInformationItem>>;
#[cfg(feature = "CPInformationItem")]
/// Setter for [`items`][Self::items].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setItems:))]
#[unsafe(method_family = none)]
pub unsafe fn setItems(&self, items: &NSArray<CPInformationItem>);
#[cfg(feature = "CPTextButton")]
/// An array of actions that appear at the bottom of the template.
///
/// To update the actions appearing in this information template, assign a new array to this property.
///
///
/// Note: The maximum number of actions is 3. If you specify more than 3, only the first 3 will be used.
#[unsafe(method(actions))]
#[unsafe(method_family = none)]
pub unsafe fn actions(&self) -> Retained<NSArray<CPTextButton>>;
#[cfg(feature = "CPTextButton")]
/// Setter for [`actions`][Self::actions].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setActions:))]
#[unsafe(method_family = none)]
pub unsafe fn setActions(&self, actions: &NSArray<CPTextButton>);
#[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>;
);
}