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
//! 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::*;
/// Reasons why your navigation alert was dismissed.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnavigationalertdismissalcontext?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CPNavigationAlertDismissalContext(pub NSUInteger);
impl CPNavigationAlertDismissalContext {
#[doc(alias = "CPNavigationAlertDismissalContextTimeout")]
pub const Timeout: Self = Self(0);
#[doc(alias = "CPNavigationAlertDismissalContextUserDismissed")]
pub const UserDismissed: Self = Self(1);
#[doc(alias = "CPNavigationAlertDismissalContextSystemDismissed")]
pub const SystemDismissed: Self = Self(2);
}
unsafe impl Encode for CPNavigationAlertDismissalContext {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for CPNavigationAlertDismissalContext {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// Your
/// `CPNavigationAlert`may specify a duration for which the alert will be visible onscreen,
/// or 0 for an alert that is visible indefinitely.
///
/// For non-indefinite alerts, this is the minimum duration the alert will be visible.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnavigationalertminimumduration?language=objc)
pub static CPNavigationAlertMinimumDuration: NSTimeInterval = 5 as _;
extern_class!(
/// `CPNavigationAlert`is a banner alert that can display map or navigation-related information to the user.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnavigationalert?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPNavigationAlert;
);
extern_conformance!(
unsafe impl NSCoding for CPNavigationAlert {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPNavigationAlert {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CPNavigationAlert {}
);
impl CPNavigationAlert {
extern_methods!(
#[cfg(all(feature = "CPAlertAction", feature = "CPImageSet"))]
/// Fully specify a
/// `CPNavigationAlert`with a title, image, primary and secondary action,
/// and duration.
///
///
/// 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.
///
///
/// 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.
///
///
/// Parameter `imageSet`: An optional
/// `CPImageSet`to display in this navigation alert. Animated images are not supported.
/// If an animated image is provided, only the first image from each image set will be used.
///
///
/// Parameter `primaryAction`: The alert must include at least one action button.
///
///
/// Parameter `secondaryAction`: An optional secondary button to display on the trailing edge of this alert.
///
///
/// Parameter `duration`: The duration for which this alert should be visible. Specify 0 for an alert
/// that displays indefinitely.
///
///
/// Returns: an initialized
/// `CPNavigationAlert.`
#[deprecated]
#[unsafe(method(initWithTitleVariants:subtitleVariants:imageSet:primaryAction:secondaryAction:duration:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTitleVariants_subtitleVariants_imageSet_primaryAction_secondaryAction_duration(
this: Allocated<Self>,
title_variants: &NSArray<NSString>,
subtitle_variants: Option<&NSArray<NSString>>,
image_set: Option<&CPImageSet>,
primary_action: &CPAlertAction,
secondary_action: Option<&CPAlertAction>,
duration: NSTimeInterval,
) -> Retained<Self>;
#[cfg(all(feature = "CPAlertAction", feature = "objc2-ui-kit"))]
#[unsafe(method(initWithTitleVariants:subtitleVariants:image:primaryAction:secondaryAction:duration:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTitleVariants_subtitleVariants_image_primaryAction_secondaryAction_duration(
this: Allocated<Self>,
title_variants: &NSArray<NSString>,
subtitle_variants: Option<&NSArray<NSString>>,
image: Option<&UIImage>,
primary_action: &CPAlertAction,
secondary_action: Option<&CPAlertAction>,
duration: NSTimeInterval,
) -> Retained<Self>;
/// The navigation alert may be updated with new title and subtitle variants, either
/// after it has already been displayed on screen, or before its initial presentation on screen.
///
/// Updating an alert that has been already been dismissed has no effect.
///
///
/// Parameter `newTitleVariants`: an updated array of title variants
///
/// Parameter `newSubtitleVariants`: an updated array of subtitle variants
#[unsafe(method(updateTitleVariants:subtitleVariants:))]
#[unsafe(method_family = none)]
pub unsafe fn updateTitleVariants_subtitleVariants(
&self,
new_title_variants: &NSArray<NSString>,
new_subtitle_variants: &NSArray<NSString>,
);
#[unsafe(method(titleVariants))]
#[unsafe(method_family = none)]
pub unsafe fn titleVariants(&self) -> Retained<NSArray<NSString>>;
#[unsafe(method(subtitleVariants))]
#[unsafe(method_family = none)]
pub unsafe fn subtitleVariants(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "CPImageSet")]
#[unsafe(method(imageSet))]
#[unsafe(method_family = none)]
pub unsafe fn imageSet(&self) -> Option<Retained<CPImageSet>>;
#[cfg(feature = "objc2-ui-kit")]
#[unsafe(method(image))]
#[unsafe(method_family = none)]
pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "CPAlertAction")]
#[unsafe(method(primaryAction))]
#[unsafe(method_family = none)]
pub unsafe fn primaryAction(&self) -> Retained<CPAlertAction>;
#[cfg(feature = "CPAlertAction")]
#[unsafe(method(secondaryAction))]
#[unsafe(method_family = none)]
pub unsafe fn secondaryAction(&self) -> Option<Retained<CPAlertAction>>;
#[unsafe(method(duration))]
#[unsafe(method_family = none)]
pub unsafe fn duration(&self) -> NSTimeInterval;
);
}
/// Methods declared on superclass `NSObject`.
impl CPNavigationAlert {
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(mtm: MainThreadMarker) -> Retained<Self>;
);
}