objc2_car_play/generated/
CPGridButton.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    /// `CPMessageGridItemConfiguration`encapsulates the message configuration options for the grid item.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpmessagegriditemconfiguration?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct CPMessageGridItemConfiguration;
19);
20
21extern_conformance!(
22    unsafe impl NSObjectProtocol for CPMessageGridItemConfiguration {}
23);
24
25impl CPMessageGridItemConfiguration {
26    extern_methods!(
27        /// Initialize a
28        /// `CPMessageGridItemConfiguration`for use in a
29        /// `CPListTemplate.`
30        ///
31        /// Parameter `conversationIdentifier`: A value meaningful to your app to identify this conversation.
32        /// This identifier is not directly displayed to the user; rather, when the user selects this grid item,
33        /// SiriKit will pass this identifier back to your app for your own use.
34        ///
35        /// Parameter `unread`: A Boolean value indicating whether the item shows an unread indicator. The default value of this property is
36        /// `NO.`
37        #[unsafe(method(initWithConversationIdentifier:unread:))]
38        #[unsafe(method_family = init)]
39        pub unsafe fn initWithConversationIdentifier_unread(
40            this: Allocated<Self>,
41            conversation_identifier: &NSString,
42            unread: bool,
43        ) -> Retained<Self>;
44
45        #[unsafe(method(isUnread))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn isUnread(&self) -> bool;
48
49        /// Setter for [`isUnread`][Self::isUnread].
50        #[unsafe(method(setUnread:))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn setUnread(&self, unread: bool);
53
54        #[unsafe(method(conversationIdentifier))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn conversationIdentifier(&self) -> Retained<NSString>;
57    );
58}
59
60/// Methods declared on superclass `NSObject`.
61impl CPMessageGridItemConfiguration {
62    extern_methods!(
63        #[unsafe(method(init))]
64        #[unsafe(method_family = init)]
65        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
66
67        #[unsafe(method(new))]
68        #[unsafe(method_family = new)]
69        pub unsafe fn new() -> Retained<Self>;
70    );
71}
72
73extern_class!(
74    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpgridbutton?language=objc)
75    #[unsafe(super(NSObject))]
76    #[derive(Debug, PartialEq, Eq, Hash)]
77    pub struct CPGridButton;
78);
79
80extern_conformance!(
81    unsafe impl NSCoding for CPGridButton {}
82);
83
84extern_conformance!(
85    unsafe impl NSObjectProtocol for CPGridButton {}
86);
87
88extern_conformance!(
89    unsafe impl NSSecureCoding for CPGridButton {}
90);
91
92impl CPGridButton {
93    extern_methods!(
94        #[unsafe(method(new))]
95        #[unsafe(method_family = new)]
96        pub unsafe fn new() -> Retained<Self>;
97
98        #[unsafe(method(init))]
99        #[unsafe(method_family = init)]
100        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
101
102        #[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
103        /// Initialize a button with a title and image.
104        ///
105        ///
106        /// Parameter `titleVariants`: An array of title variants for this button, arranged from most to least preferred. You must provide at least one title.
107        ///
108        /// Parameter `image`: The image displayed on the button. It must be non-nil for the button to be displayed.
109        ///
110        /// 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.
111        ///
112        /// The image must be non-nil and the title must be a non-zero length string for the button to be displayed.
113        ///
114        ///
115        /// To properly size your images, your app should size them to the display scale of the car screen.
116        /// See -[CPInterfaceController carTraitCollection].
117        #[unsafe(method(initWithTitleVariants:image:handler:))]
118        #[unsafe(method_family = init)]
119        pub unsafe fn initWithTitleVariants_image_handler(
120            this: Allocated<Self>,
121            title_variants: &NSArray<NSString>,
122            image: &UIImage,
123            handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPGridButton>)>>,
124        ) -> Retained<Self>;
125
126        #[cfg(all(feature = "block2", feature = "objc2-ui-kit"))]
127        /// Initialize a button with a title, image, and message configuration.
128        #[unsafe(method(initWithTitleVariants:image:messageConfiguration:handler:))]
129        #[unsafe(method_family = init)]
130        pub unsafe fn initWithTitleVariants_image_messageConfiguration_handler(
131            this: Allocated<Self>,
132            title_variants: &NSArray<NSString>,
133            image: &UIImage,
134            message_configuration: Option<&CPMessageGridItemConfiguration>,
135            handler: Option<&block2::DynBlock<dyn Fn(NonNull<CPGridButton>)>>,
136        ) -> Retained<Self>;
137
138        /// A Boolean value indicating whether the button is enabled.
139        ///
140        ///
141        /// Set the value of this property to
142        /// `YES`to enable the button or
143        /// `NO`to disable it. The default value of this property is
144        /// `YES.`
145        #[unsafe(method(isEnabled))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn isEnabled(&self) -> bool;
148
149        /// Setter for [`isEnabled`][Self::isEnabled].
150        #[unsafe(method(setEnabled:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setEnabled(&self, enabled: bool);
153
154        #[unsafe(method(messageConfiguration))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn messageConfiguration(
157            &self,
158        ) -> Option<Retained<CPMessageGridItemConfiguration>>;
159
160        #[cfg(feature = "objc2-ui-kit")]
161        /// The image displayed on the button.
162        ///
163        ///
164        /// Animated images are not supported. If an animated image is assigned, only the first image will be used.
165        /// To properly size your list images, your app should size them to the display scale of the car screen.
166        /// See -[CPInterfaceController carTraitCollection].
167        #[unsafe(method(image))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn image(&self) -> Retained<UIImage>;
170
171        #[cfg(feature = "objc2-ui-kit")]
172        #[unsafe(method(updateImage:))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn updateImage(&self, image: &UIImage);
175
176        /// An array of title variants for this button, arranged from most to least preferred.
177        /// The system will select a title from your list of provided variants that fits the available space.
178        /// The variant strings should be provided as localized, displayable content.
179        #[unsafe(method(titleVariants))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn titleVariants(&self) -> Retained<NSArray<NSString>>;
182
183        #[unsafe(method(updateTitleVariants:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn updateTitleVariants(&self, title_variants: &NSArray<NSString>);
186    );
187}