objc2_car_play/generated/
CPContact.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
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpcontact?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct CPContact;
17);
18
19extern_conformance!(
20    unsafe impl NSCoding for CPContact {}
21);
22
23extern_conformance!(
24    unsafe impl NSObjectProtocol for CPContact {}
25);
26
27extern_conformance!(
28    unsafe impl NSSecureCoding for CPContact {}
29);
30
31impl CPContact {
32    extern_methods!(
33        #[cfg(feature = "objc2-ui-kit")]
34        /// Initializes a new contact to be used with
35        /// `CPContactTemplate,`with a name and image
36        ///
37        ///
38        /// Parameter `name`: The name to be displayed for this contact.
39        ///
40        /// Parameter `image`: An image for this contact. The maximum image size in points is CPButtonMaximumImageSize; larger images will be scaled down.
41        ///
42        ///
43        /// Note: When providing an image, your app should provide a
44        /// `UIImage`that is display-ready. If necessary for the image, provide
45        /// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
46        /// or by using
47        /// `UIImageAsset`to combine two
48        /// `UIImage`instances into a single image with
49        /// both styles.
50        ///
51        /// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
52        ///
53        ///
54        /// To properly size your list images, your app should consider the display scale of the car screen.
55        /// See -[CPInterfaceController carTraitCollection].
56        #[unsafe(method(initWithName:image:))]
57        #[unsafe(method_family = init)]
58        pub unsafe fn initWithName_image(
59            this: Allocated<Self>,
60            name: &NSString,
61            image: &UIImage,
62        ) -> Retained<Self>;
63
64        /// The name that will be displayed for this contact.
65        #[unsafe(method(name))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn name(&self) -> Retained<NSString>;
68
69        /// Setter for [`name`][Self::name].
70        ///
71        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
72        #[unsafe(method(setName:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn setName(&self, name: &NSString);
75
76        #[cfg(feature = "objc2-ui-kit")]
77        /// An image representing the contact.
78        #[unsafe(method(image))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn image(&self) -> Retained<UIImage>;
81
82        #[cfg(feature = "objc2-ui-kit")]
83        /// Setter for [`image`][Self::image].
84        #[unsafe(method(setImage:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn setImage(&self, image: &UIImage);
87
88        #[cfg(feature = "CPButton")]
89        /// Action buttons that will be displayed when this
90        /// `CPContact`is displayed in a
91        /// `CPContactTemplate.`
92        #[unsafe(method(actions))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn actions(&self) -> Option<Retained<NSArray<CPButton>>>;
95
96        #[cfg(feature = "CPButton")]
97        /// Setter for [`actions`][Self::actions].
98        ///
99        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
100        #[unsafe(method(setActions:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setActions(&self, actions: Option<&NSArray<CPButton>>);
103
104        /// Optional text that will be displayed in addition to the contact name
105        #[unsafe(method(subtitle))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;
108
109        /// Setter for [`subtitle`][Self::subtitle].
110        ///
111        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
112        #[unsafe(method(setSubtitle:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);
115
116        /// Optional text that will be displayed in addition to the contact name
117        #[unsafe(method(informativeText))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn informativeText(&self) -> Option<Retained<NSString>>;
120
121        /// Setter for [`informativeText`][Self::informativeText].
122        ///
123        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
124        #[unsafe(method(setInformativeText:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn setInformativeText(&self, informative_text: Option<&NSString>);
127    );
128}
129
130/// Methods declared on superclass `NSObject`.
131impl CPContact {
132    extern_methods!(
133        #[unsafe(method(init))]
134        #[unsafe(method_family = init)]
135        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
136
137        #[unsafe(method(new))]
138        #[unsafe(method_family = new)]
139        pub unsafe fn new() -> Retained<Self>;
140    );
141}
142
143extern_class!(
144    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpcontactcallbutton?language=objc)
145    #[unsafe(super(CPButton, NSObject))]
146    #[derive(Debug, PartialEq, Eq, Hash)]
147    #[cfg(feature = "CPButton")]
148    pub struct CPContactCallButton;
149);
150
151#[cfg(feature = "CPButton")]
152extern_conformance!(
153    unsafe impl NSObjectProtocol for CPContactCallButton {}
154);
155
156#[cfg(feature = "CPButton")]
157impl CPContactCallButton {
158    extern_methods!(
159        #[cfg(feature = "block2")]
160        /// Create a contact button with a system-provided call image that, when tapped, calls your custom handler.
161        ///
162        ///
163        /// Parameter `handler`: A block that will be called when the user taps this button.
164        #[unsafe(method(initWithHandler:))]
165        #[unsafe(method_family = init)]
166        pub unsafe fn initWithHandler(
167            this: Allocated<Self>,
168            handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
169        ) -> Retained<Self>;
170
171        #[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
172        #[unsafe(method(initWithImage:handler:))]
173        #[unsafe(method_family = init)]
174        pub unsafe fn initWithImage_handler(
175            this: Allocated<Self>,
176            image: &UIImage,
177            handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
178        ) -> Retained<Self>;
179    );
180}
181
182/// Methods declared on superclass `CPButton`.
183#[cfg(feature = "CPButton")]
184impl CPContactCallButton {
185    extern_methods!(
186        #[unsafe(method(new))]
187        #[unsafe(method_family = new)]
188        pub unsafe fn new() -> Retained<Self>;
189
190        #[unsafe(method(init))]
191        #[unsafe(method_family = init)]
192        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
193    );
194}
195
196extern_class!(
197    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpcontactmessagebutton?language=objc)
198    #[unsafe(super(CPButton, NSObject))]
199    #[derive(Debug, PartialEq, Eq, Hash)]
200    #[cfg(feature = "CPButton")]
201    pub struct CPContactMessageButton;
202);
203
204#[cfg(feature = "CPButton")]
205extern_conformance!(
206    unsafe impl NSObjectProtocol for CPContactMessageButton {}
207);
208
209#[cfg(feature = "CPButton")]
210impl CPContactMessageButton {
211    extern_methods!(
212        /// Create a contact button that, when tapped, launches to Siri to compose a message to this entity.
213        /// When tapped, this button does NOT call a handler in your app. Instead, it will launch to Siri.
214        /// To compose a message, you must provide a phone OR email for this contact.
215        ///
216        ///
217        /// Parameter `phoneOrEmail`: A phone or email address for this contact. This will not be displayed in the button,
218        /// but it is necessary for Siri to compose a message to this contact entity.
219        #[unsafe(method(initWithPhoneOrEmail:))]
220        #[unsafe(method_family = init)]
221        pub unsafe fn initWithPhoneOrEmail(
222            this: Allocated<Self>,
223            phone_or_email: &NSString,
224        ) -> Retained<Self>;
225
226        #[unsafe(method(phoneOrEmail))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn phoneOrEmail(&self) -> Retained<NSString>;
229    );
230}
231
232/// Methods declared on superclass `CPButton`.
233#[cfg(feature = "CPButton")]
234impl CPContactMessageButton {
235    extern_methods!(
236        #[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
237        /// Initialize a button for the Contact, POI, or Information templates with a custom image and a handler, called when
238        /// the user taps this button.
239        ///
240        ///
241        /// Parameter `image`: An image to be displayed in this button. The maximum image size is given by
242        /// `CPButtonMaximumImageSize.`
243        /// Parameter `handler`: A block that will be called when the user taps this button.
244        ///
245        ///
246        /// Note: This class is only available in templates that support buttons with custom images, like the Contact template.
247        ///
248        ///
249        /// When providing an image, your app should provide a
250        /// `UIImage`that is display-ready. If necessary for the image, provide
251        /// light and dark styles by using an asset from your asset catalog, prepared with light and dark styles
252        /// or by using
253        /// `UIImageAsset`to combine two
254        /// `UIImage`instances into a single image with
255        /// both styles.
256        ///
257        /// UIImageAsset is used to combine multiple UIImages with different trait collections into a single UIImage.
258        #[unsafe(method(initWithImage:handler:))]
259        #[unsafe(method_family = init)]
260        pub unsafe fn initWithImage_handler(
261            this: Allocated<Self>,
262            image: &UIImage,
263            handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
264        ) -> Retained<Self>;
265
266        #[unsafe(method(new))]
267        #[unsafe(method_family = new)]
268        pub unsafe fn new() -> Retained<Self>;
269
270        #[unsafe(method(init))]
271        #[unsafe(method_family = init)]
272        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
273    );
274}
275
276extern_class!(
277    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpcontactdirectionsbutton?language=objc)
278    #[unsafe(super(CPButton, NSObject))]
279    #[derive(Debug, PartialEq, Eq, Hash)]
280    #[cfg(feature = "CPButton")]
281    pub struct CPContactDirectionsButton;
282);
283
284#[cfg(feature = "CPButton")]
285extern_conformance!(
286    unsafe impl NSObjectProtocol for CPContactDirectionsButton {}
287);
288
289#[cfg(feature = "CPButton")]
290impl CPContactDirectionsButton {
291    extern_methods!(
292        #[cfg(feature = "block2")]
293        /// Create a contact button with a system-provided navigation directions image that, when tapped, calls your custom handler.
294        ///
295        ///
296        /// Parameter `handler`: A block that will be called when the user taps this button.
297        #[unsafe(method(initWithHandler:))]
298        #[unsafe(method_family = init)]
299        pub unsafe fn initWithHandler(
300            this: Allocated<Self>,
301            handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
302        ) -> Retained<Self>;
303
304        #[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
305        #[unsafe(method(initWithImage:handler:))]
306        #[unsafe(method_family = init)]
307        pub unsafe fn initWithImage_handler(
308            this: Allocated<Self>,
309            image: &UIImage,
310            handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPButton>)>>,
311        ) -> Retained<Self>;
312    );
313}
314
315/// Methods declared on superclass `CPButton`.
316#[cfg(feature = "CPButton")]
317impl CPContactDirectionsButton {
318    extern_methods!(
319        #[unsafe(method(new))]
320        #[unsafe(method_family = new)]
321        pub unsafe fn new() -> Retained<Self>;
322
323        #[unsafe(method(init))]
324        #[unsafe(method_family = init)]
325        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
326    );
327}