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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
//! 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::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;
use crate::*;
extern_class!(
/// `CPMessageGridItemConfiguration`encapsulates the message configuration options for the grid item.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessagegriditemconfiguration?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPMessageGridItemConfiguration;
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPMessageGridItemConfiguration {}
);
impl CPMessageGridItemConfiguration {
extern_methods!(
/// Initialize a
/// `CPMessageGridItemConfiguration`for use in a
/// `CPListTemplate.`
///
/// Parameter `conversationIdentifier`: A value meaningful to your app to identify this conversation.
/// This identifier is not directly displayed to the user; rather, when the user selects this grid item,
/// SiriKit will pass this identifier back to your app for your own use.
///
/// Parameter `unread`: A Boolean value indicating whether the item shows an unread indicator. The default value of this property is
/// `NO.`
#[unsafe(method(initWithConversationIdentifier:unread:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithConversationIdentifier_unread(
this: Allocated<Self>,
conversation_identifier: &NSString,
unread: bool,
) -> Retained<Self>;
#[unsafe(method(isUnread))]
#[unsafe(method_family = none)]
pub unsafe fn isUnread(&self) -> bool;
/// Setter for [`isUnread`][Self::isUnread].
#[unsafe(method(setUnread:))]
#[unsafe(method_family = none)]
pub unsafe fn setUnread(&self, unread: bool);
#[unsafe(method(conversationIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn conversationIdentifier(&self) -> Retained<NSString>;
);
}
/// Methods declared on superclass `NSObject`.
impl CPMessageGridItemConfiguration {
extern_methods!(
#[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>;
);
}
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpgridbutton?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPGridButton;
);
extern_conformance!(
unsafe impl NSCoding for CPGridButton {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPGridButton {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPGridButton {}
);
impl CPGridButton {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
/// Initialize a button with a title and image.
///
///
/// Parameter `titleVariants`: An array of title variants for this button, arranged from most to least preferred. You must provide at least one title.
///
/// Parameter `image`: The image displayed on the button. It must be non-nil for the button to be displayed.
///
/// Parameter `handler`: A block to execute when the user selects the button. The block has no return value and takes the selected button as its only parameter.
///
/// The image must be non-nil and the title must be a non-zero length string for the button to be displayed.
///
///
/// To properly size your images, your app should size them to the display scale of the car screen.
/// See -[CPInterfaceController carTraitCollection].
#[unsafe(method(initWithTitleVariants:image:handler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTitleVariants_image_handler(
this: Allocated<Self>,
title_variants: &NSArray<NSString>,
image: &UIImage,
handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPGridButton>)>>,
) -> Retained<Self>;
#[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
/// Initialize a button with a title, image, and message configuration.
#[unsafe(method(initWithTitleVariants:image:messageConfiguration:handler:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTitleVariants_image_messageConfiguration_handler(
this: Allocated<Self>,
title_variants: &NSArray<NSString>,
image: &UIImage,
message_configuration: Option<&CPMessageGridItemConfiguration>,
handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPGridButton>)>>,
) -> Retained<Self>;
/// A Boolean value indicating whether the button is enabled.
///
///
/// Set the value of this property to
/// `YES`to enable the button or
/// `NO`to disable it. The default value of this property is
/// `YES.`
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isEnabled(&self) -> bool;
/// Setter for [`isEnabled`][Self::isEnabled].
#[unsafe(method(setEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setEnabled(&self, enabled: bool);
#[unsafe(method(messageConfiguration))]
#[unsafe(method_family = none)]
pub unsafe fn messageConfiguration(
&self,
) -> Option<Retained<CPMessageGridItemConfiguration>>;
#[cfg(feature = "objc2-ui-kit")]
/// The image displayed on the button.
///
///
/// Animated images are not supported. If an animated image is assigned, only the first image will be used.
/// To properly size your list images, your app should size them to the display scale of the car screen.
/// See -[CPInterfaceController carTraitCollection].
#[unsafe(method(image))]
#[unsafe(method_family = none)]
pub unsafe fn image(&self) -> Retained<UIImage>;
#[cfg(feature = "objc2-ui-kit")]
#[unsafe(method(updateImage:))]
#[unsafe(method_family = none)]
pub unsafe fn updateImage(&self, image: &UIImage);
/// An array of title variants for this button, arranged from most to least preferred.
/// The system will select a title from your list of provided variants that fits the available space.
/// The variant strings should be provided as localized, displayable content.
#[unsafe(method(titleVariants))]
#[unsafe(method_family = none)]
pub unsafe fn titleVariants(&self) -> Retained<NSArray<NSString>>;
#[unsafe(method(updateTitleVariants:))]
#[unsafe(method_family = none)]
pub unsafe fn updateTitleVariants(&self, title_variants: &NSArray<NSString>);
);
}