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
//! 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::*;
use crate::*;
extern_protocol!(
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingtemplateobserver?language=objc)
pub unsafe trait CPNowPlayingTemplateObserver: NSObjectProtocol {
#[cfg(feature = "CPTemplate")]
/// The user has selected the Up Next button on the now playing template. Your application
/// should push a new template displaying the list of upcoming or queued content.
#[optional]
#[unsafe(method(nowPlayingTemplateUpNextButtonTapped:))]
#[unsafe(method_family = none)]
unsafe fn nowPlayingTemplateUpNextButtonTapped(
&self,
now_playing_template: &CPNowPlayingTemplate,
);
#[cfg(feature = "CPTemplate")]
/// The user has selected the album/artist button on the now playing template. Your application
/// should push a new template displaying the content appearing in this container (album, playlist, or show).
#[optional]
#[unsafe(method(nowPlayingTemplateAlbumArtistButtonTapped:))]
#[unsafe(method_family = none)]
unsafe fn nowPlayingTemplateAlbumArtistButtonTapped(
&self,
now_playing_template: &CPNowPlayingTemplate,
);
}
);
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingtemplate?language=objc)
#[unsafe(super(CPTemplate, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "CPTemplate")]
pub struct CPNowPlayingTemplate;
);
#[cfg(feature = "CPTemplate")]
extern_conformance!(
unsafe impl NSCoding for CPNowPlayingTemplate {}
);
#[cfg(feature = "CPTemplate")]
extern_conformance!(
unsafe impl NSObjectProtocol for CPNowPlayingTemplate {}
);
#[cfg(feature = "CPTemplate")]
extern_conformance!(
unsafe impl NSSecureCoding for CPNowPlayingTemplate {}
);
#[cfg(feature = "CPTemplate")]
impl CPNowPlayingTemplate {
extern_methods!(
/// Access the shared now playing template for your app. Instead of creating your own
/// now playing template, you should configure the properties of this shared instance.
///
/// You should present this shared instance when your app needs to present now playing,
/// for example in response to the user selecting a playable item.
///
/// When the system needs to present now playing on behalf of your app, it will present
/// this shared instance.
#[unsafe(method(sharedTemplate))]
#[unsafe(method_family = none)]
pub unsafe fn sharedTemplate(mtm: MainThreadMarker) -> Retained<CPNowPlayingTemplate>;
#[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>;
/// Add an observer. Observers are notified about now playing template events.
#[unsafe(method(addObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn addObserver(
&self,
observer: &ProtocolObject<dyn CPNowPlayingTemplateObserver>,
);
/// Remove an observer.
#[unsafe(method(removeObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn removeObserver(
&self,
observer: &ProtocolObject<dyn CPNowPlayingTemplateObserver>,
);
#[cfg(feature = "CPNowPlayingButton")]
/// Playback control buttons on the Now Playing screen, like repeat, shuffle, and more.
///
/// Your application may specify a maximum of 5 now playing buttons.
///
///
/// Buttons are filled in array order, from the leading side to the trailing side of the screen.
#[unsafe(method(nowPlayingButtons))]
#[unsafe(method_family = none)]
pub unsafe fn nowPlayingButtons(&self) -> Retained<NSArray<CPNowPlayingButton>>;
/// A Boolean value indicating whether the "Up Next" button on the upper right of a Now Playing view is enabled.
///
///
/// Set the value of this property to
/// `YES`to enable the button.
///
/// Defaults to NO.
#[unsafe(method(isUpNextButtonEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isUpNextButtonEnabled(&self) -> bool;
/// Setter for [`isUpNextButtonEnabled`][Self::isUpNextButtonEnabled].
#[unsafe(method(setUpNextButtonEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setUpNextButtonEnabled(&self, up_next_button_enabled: bool);
/// If your template elects to display the "Up Next" button, you may optionally specify a string
/// indicating the title for the up next button. If no title is specified, a default system title
/// will be used.
///
///
/// See: -[CPNowPlayingTemplate upNextButtonEnabled].
#[unsafe(method(upNextTitle))]
#[unsafe(method_family = none)]
pub unsafe fn upNextTitle(&self) -> Retained<NSString>;
/// Setter for [`upNextTitle`][Self::upNextTitle].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setUpNextTitle:))]
#[unsafe(method_family = none)]
pub unsafe fn setUpNextTitle(&self, up_next_title: &NSString);
/// A Boolean value indicating whether the string that displays the album and artist above the playback controls should be a tappable button
///
///
/// Set the value of this property to
/// `YES`to enable the button.
///
/// Defaults to NO.
#[unsafe(method(isAlbumArtistButtonEnabled))]
#[unsafe(method_family = none)]
pub unsafe fn isAlbumArtistButtonEnabled(&self) -> bool;
/// Setter for [`isAlbumArtistButtonEnabled`][Self::isAlbumArtistButtonEnabled].
#[unsafe(method(setAlbumArtistButtonEnabled:))]
#[unsafe(method_family = none)]
pub unsafe fn setAlbumArtistButtonEnabled(&self, album_artist_button_enabled: bool);
#[cfg(feature = "CPNowPlayingButton")]
/// Update the buttons displayed in this Now Playing template.
#[unsafe(method(updateNowPlayingButtons:))]
#[unsafe(method_family = none)]
pub unsafe fn updateNowPlayingButtons(
&self,
now_playing_buttons: &NSArray<CPNowPlayingButton>,
);
#[cfg(feature = "CPNowPlayingMode")]
/// The currently-active now playing mode. See
/// `CPNowPlayingMode.`
#[unsafe(method(nowPlayingMode))]
#[unsafe(method_family = none)]
pub unsafe fn nowPlayingMode(&self) -> Option<Retained<CPNowPlayingMode>>;
#[cfg(feature = "CPNowPlayingMode")]
/// Setter for [`nowPlayingMode`][Self::nowPlayingMode].
#[unsafe(method(setNowPlayingMode:))]
#[unsafe(method_family = none)]
pub unsafe fn setNowPlayingMode(&self, now_playing_mode: Option<&CPNowPlayingMode>);
);
}