objc2_car_play/generated/
CPNavigationAlert.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
12/// Reasons why your navigation alert was dismissed.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnavigationalertdismissalcontext?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct CPNavigationAlertDismissalContext(pub NSUInteger);
19impl CPNavigationAlertDismissalContext {
20    #[doc(alias = "CPNavigationAlertDismissalContextTimeout")]
21    pub const Timeout: Self = Self(0);
22    #[doc(alias = "CPNavigationAlertDismissalContextUserDismissed")]
23    pub const UserDismissed: Self = Self(1);
24    #[doc(alias = "CPNavigationAlertDismissalContextSystemDismissed")]
25    pub const SystemDismissed: Self = Self(2);
26}
27
28unsafe impl Encode for CPNavigationAlertDismissalContext {
29    const ENCODING: Encoding = NSUInteger::ENCODING;
30}
31
32unsafe impl RefEncode for CPNavigationAlertDismissalContext {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36/// Your
37/// `CPNavigationAlert`may specify a duration for which the alert will be visible onscreen,
38/// or 0 for an alert that is visible indefinitely.
39///
40/// For non-indefinite alerts, this is the minimum duration the alert will be visible.
41///
42/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnavigationalertminimumduration?language=objc)
43pub static CPNavigationAlertMinimumDuration: NSTimeInterval = 5 as _;
44
45extern_class!(
46    /// `CPNavigationAlert`is a banner alert that can display map or navigation-related information to the user.
47    ///
48    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnavigationalert?language=objc)
49    #[unsafe(super(NSObject))]
50    #[thread_kind = MainThreadOnly]
51    #[derive(Debug, PartialEq, Eq, Hash)]
52    pub struct CPNavigationAlert;
53);
54
55extern_conformance!(
56    unsafe impl NSCoding for CPNavigationAlert {}
57);
58
59extern_conformance!(
60    unsafe impl NSObjectProtocol for CPNavigationAlert {}
61);
62
63extern_conformance!(
64    unsafe impl NSSecureCoding for CPNavigationAlert {}
65);
66
67impl CPNavigationAlert {
68    extern_methods!(
69        #[cfg(all(feature = "CPAlertAction", feature = "CPImageSet"))]
70        /// Fully specify a
71        /// `CPNavigationAlert`with a title, image, primary and secondary action,
72        /// and duration.
73        ///
74        ///
75        /// Parameter `titleVariants`: An array of titles. The system will select a title that fits in the available space. The variant strings should be provided as localized, displayable content.
76        ///
77        ///
78        /// Parameter `subtitleVariants`: An array of subtitles. The system will select a subtitle that fits in the available space. The variant strings should be provided as localized, displayable content.
79        ///
80        ///
81        /// Parameter `imageSet`: An optional
82        /// `CPImageSet`to display in this navigation alert. Animated images are not supported.
83        /// If an animated image is provided, only the first image from each image set will be used.
84        ///
85        ///
86        /// Parameter `primaryAction`: The alert must include at least one action button.
87        ///
88        ///
89        /// Parameter `secondaryAction`: An optional secondary button to display on the trailing edge of this alert.
90        ///
91        ///
92        /// Parameter `duration`: The duration for which this alert should be visible. Specify 0 for an alert
93        /// that displays indefinitely.
94        ///
95        ///
96        /// Returns: an initialized
97        /// `CPNavigationAlert.`
98        #[deprecated]
99        #[unsafe(method(initWithTitleVariants:subtitleVariants:imageSet:primaryAction:secondaryAction:duration:))]
100        #[unsafe(method_family = init)]
101        pub unsafe fn initWithTitleVariants_subtitleVariants_imageSet_primaryAction_secondaryAction_duration(
102            this: Allocated<Self>,
103            title_variants: &NSArray<NSString>,
104            subtitle_variants: Option<&NSArray<NSString>>,
105            image_set: Option<&CPImageSet>,
106            primary_action: &CPAlertAction,
107            secondary_action: Option<&CPAlertAction>,
108            duration: NSTimeInterval,
109        ) -> Retained<Self>;
110
111        #[cfg(all(feature = "CPAlertAction", feature = "objc2-ui-kit"))]
112        #[unsafe(method(initWithTitleVariants:subtitleVariants:image:primaryAction:secondaryAction:duration:))]
113        #[unsafe(method_family = init)]
114        pub unsafe fn initWithTitleVariants_subtitleVariants_image_primaryAction_secondaryAction_duration(
115            this: Allocated<Self>,
116            title_variants: &NSArray<NSString>,
117            subtitle_variants: Option<&NSArray<NSString>>,
118            image: Option<&UIImage>,
119            primary_action: &CPAlertAction,
120            secondary_action: Option<&CPAlertAction>,
121            duration: NSTimeInterval,
122        ) -> Retained<Self>;
123
124        /// The navigation alert may be updated with new title and subtitle variants, either
125        /// after it has already been displayed on screen, or before its initial presentation on screen.
126        ///
127        /// Updating an alert that has been already been dismissed has no effect.
128        ///
129        ///
130        /// Parameter `newTitleVariants`: an updated array of title variants
131        ///
132        /// Parameter `newSubtitleVariants`: an updated array of subtitle variants
133        #[unsafe(method(updateTitleVariants:subtitleVariants:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn updateTitleVariants_subtitleVariants(
136            &self,
137            new_title_variants: &NSArray<NSString>,
138            new_subtitle_variants: &NSArray<NSString>,
139        );
140
141        #[unsafe(method(titleVariants))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn titleVariants(&self) -> Retained<NSArray<NSString>>;
144
145        #[unsafe(method(subtitleVariants))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn subtitleVariants(&self) -> Retained<NSArray<NSString>>;
148
149        #[cfg(feature = "CPImageSet")]
150        #[unsafe(method(imageSet))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn imageSet(&self) -> Option<Retained<CPImageSet>>;
153
154        #[cfg(feature = "objc2-ui-kit")]
155        #[unsafe(method(image))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
158
159        #[cfg(feature = "CPAlertAction")]
160        #[unsafe(method(primaryAction))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn primaryAction(&self) -> Retained<CPAlertAction>;
163
164        #[cfg(feature = "CPAlertAction")]
165        #[unsafe(method(secondaryAction))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn secondaryAction(&self) -> Option<Retained<CPAlertAction>>;
168
169        #[unsafe(method(duration))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn duration(&self) -> NSTimeInterval;
172    );
173}
174
175/// Methods declared on superclass `NSObject`.
176impl CPNavigationAlert {
177    extern_methods!(
178        #[unsafe(method(init))]
179        #[unsafe(method_family = init)]
180        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
181
182        #[unsafe(method(new))]
183        #[unsafe(method_family = new)]
184        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
185    );
186}