objc2_car_play/generated/
CPNowPlayingTemplate.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
8use crate::*;
9
10extern_protocol!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingtemplateobserver?language=objc)
12    pub unsafe trait CPNowPlayingTemplateObserver: NSObjectProtocol {
13        #[cfg(feature = "CPTemplate")]
14        /// The user has selected the Up Next button on the now playing template. Your application
15        /// should push a new template displaying the list of upcoming or queued content.
16        #[optional]
17        #[unsafe(method(nowPlayingTemplateUpNextButtonTapped:))]
18        #[unsafe(method_family = none)]
19        unsafe fn nowPlayingTemplateUpNextButtonTapped(
20            &self,
21            now_playing_template: &CPNowPlayingTemplate,
22        );
23
24        #[cfg(feature = "CPTemplate")]
25        /// The user has selected the album/artist button on the now playing template. Your application
26        /// should push a new template displaying the content appearing in this container (album, playlist, or show).
27        #[optional]
28        #[unsafe(method(nowPlayingTemplateAlbumArtistButtonTapped:))]
29        #[unsafe(method_family = none)]
30        unsafe fn nowPlayingTemplateAlbumArtistButtonTapped(
31            &self,
32            now_playing_template: &CPNowPlayingTemplate,
33        );
34    }
35);
36
37extern_class!(
38    /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingtemplate?language=objc)
39    #[unsafe(super(CPTemplate, NSObject))]
40    #[thread_kind = MainThreadOnly]
41    #[derive(Debug, PartialEq, Eq, Hash)]
42    #[cfg(feature = "CPTemplate")]
43    pub struct CPNowPlayingTemplate;
44);
45
46#[cfg(feature = "CPTemplate")]
47extern_conformance!(
48    unsafe impl NSCoding for CPNowPlayingTemplate {}
49);
50
51#[cfg(feature = "CPTemplate")]
52extern_conformance!(
53    unsafe impl NSObjectProtocol for CPNowPlayingTemplate {}
54);
55
56#[cfg(feature = "CPTemplate")]
57extern_conformance!(
58    unsafe impl NSSecureCoding for CPNowPlayingTemplate {}
59);
60
61#[cfg(feature = "CPTemplate")]
62impl CPNowPlayingTemplate {
63    extern_methods!(
64        /// Access the shared now playing template for your app. Instead of creating your own
65        /// now playing template, you should configure the properties of this shared instance.
66        ///
67        /// You should present this shared instance when your app needs to present now playing,
68        /// for example in response to the user selecting a playable item.
69        ///
70        /// When the system needs to present now playing on behalf of your app, it will present
71        /// this shared instance.
72        #[unsafe(method(sharedTemplate))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn sharedTemplate(mtm: MainThreadMarker) -> Retained<CPNowPlayingTemplate>;
75
76        #[unsafe(method(init))]
77        #[unsafe(method_family = init)]
78        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
79
80        #[unsafe(method(new))]
81        #[unsafe(method_family = new)]
82        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
83
84        /// Add an observer. Observers are notified about now playing template events.
85        #[unsafe(method(addObserver:))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn addObserver(
88            &self,
89            observer: &ProtocolObject<dyn CPNowPlayingTemplateObserver>,
90        );
91
92        /// Remove an observer.
93        #[unsafe(method(removeObserver:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn removeObserver(
96            &self,
97            observer: &ProtocolObject<dyn CPNowPlayingTemplateObserver>,
98        );
99
100        #[cfg(feature = "CPNowPlayingButton")]
101        /// Playback control buttons on the Now Playing screen, like repeat, shuffle, and more.
102        ///
103        /// Your application may specify a maximum of 5 now playing buttons.
104        ///
105        ///
106        /// Buttons are filled in array order, from the leading side to the trailing side of the screen.
107        #[unsafe(method(nowPlayingButtons))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn nowPlayingButtons(&self) -> Retained<NSArray<CPNowPlayingButton>>;
110
111        /// A Boolean value indicating whether the "Up Next" button on the upper right of a Now Playing view is enabled.
112        ///
113        ///
114        /// Set the value of this property to
115        /// `YES`to enable the button.
116        ///
117        /// Defaults to NO.
118        #[unsafe(method(isUpNextButtonEnabled))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn isUpNextButtonEnabled(&self) -> bool;
121
122        /// Setter for [`isUpNextButtonEnabled`][Self::isUpNextButtonEnabled].
123        #[unsafe(method(setUpNextButtonEnabled:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setUpNextButtonEnabled(&self, up_next_button_enabled: bool);
126
127        /// If your template elects to display the "Up Next" button, you may optionally specify a string
128        /// indicating the title for the up next button. If no title is specified, a default system title
129        /// will be used.
130        ///
131        ///
132        /// See: -[CPNowPlayingTemplate upNextButtonEnabled].
133        #[unsafe(method(upNextTitle))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn upNextTitle(&self) -> Retained<NSString>;
136
137        /// Setter for [`upNextTitle`][Self::upNextTitle].
138        ///
139        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
140        #[unsafe(method(setUpNextTitle:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn setUpNextTitle(&self, up_next_title: &NSString);
143
144        /// A Boolean value indicating whether the string that displays the album and artist above the playback controls should be a tappable button
145        ///
146        ///
147        /// Set the value of this property to
148        /// `YES`to enable the button.
149        ///
150        /// Defaults to NO.
151        #[unsafe(method(isAlbumArtistButtonEnabled))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn isAlbumArtistButtonEnabled(&self) -> bool;
154
155        /// Setter for [`isAlbumArtistButtonEnabled`][Self::isAlbumArtistButtonEnabled].
156        #[unsafe(method(setAlbumArtistButtonEnabled:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setAlbumArtistButtonEnabled(&self, album_artist_button_enabled: bool);
159
160        #[cfg(feature = "CPNowPlayingButton")]
161        /// Update the buttons displayed in this Now Playing template.
162        #[unsafe(method(updateNowPlayingButtons:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn updateNowPlayingButtons(
165            &self,
166            now_playing_buttons: &NSArray<CPNowPlayingButton>,
167        );
168
169        #[cfg(feature = "CPNowPlayingMode")]
170        /// The currently-active now playing mode. See
171        /// `CPNowPlayingMode.`
172        #[unsafe(method(nowPlayingMode))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn nowPlayingMode(&self) -> Option<Retained<CPNowPlayingMode>>;
175
176        #[cfg(feature = "CPNowPlayingMode")]
177        /// Setter for [`nowPlayingMode`][Self::nowPlayingMode].
178        #[unsafe(method(setNowPlayingMode:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn setNowPlayingMode(&self, now_playing_mode: Option<&CPNowPlayingMode>);
181    );
182}