objc2_media_player/generated/
MPRemoteCommandEvent.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_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpremotecommandevent?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct MPRemoteCommandEvent;
15);
16
17unsafe impl NSObjectProtocol for MPRemoteCommandEvent {}
18
19impl MPRemoteCommandEvent {
20    extern_methods!(
21        #[cfg(feature = "MPRemoteCommand")]
22        /// The command that sent the event.
23        #[unsafe(method(command))]
24        #[unsafe(method_family = none)]
25        pub unsafe fn command(&self) -> Retained<MPRemoteCommand>;
26
27        /// The time when the event occurred.
28        #[unsafe(method(timestamp))]
29        #[unsafe(method_family = none)]
30        pub unsafe fn timestamp(&self) -> NSTimeInterval;
31    );
32}
33
34/// Methods declared on superclass `NSObject`.
35impl MPRemoteCommandEvent {
36    extern_methods!(
37        #[unsafe(method(init))]
38        #[unsafe(method_family = init)]
39        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
40
41        #[unsafe(method(new))]
42        #[unsafe(method_family = new)]
43        pub unsafe fn new() -> Retained<Self>;
44    );
45}
46
47extern_class!(
48    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpskipintervalcommandevent?language=objc)
49    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
50    #[derive(Debug, PartialEq, Eq, Hash)]
51    pub struct MPSkipIntervalCommandEvent;
52);
53
54unsafe impl NSObjectProtocol for MPSkipIntervalCommandEvent {}
55
56impl MPSkipIntervalCommandEvent {
57    extern_methods!(
58        /// The chosen interval for this skip command event.
59        #[unsafe(method(interval))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn interval(&self) -> NSTimeInterval;
62    );
63}
64
65/// Methods declared on superclass `NSObject`.
66impl MPSkipIntervalCommandEvent {
67    extern_methods!(
68        #[unsafe(method(init))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
71
72        #[unsafe(method(new))]
73        #[unsafe(method_family = new)]
74        pub unsafe fn new() -> Retained<Self>;
75    );
76}
77
78/// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpseekcommandeventtype?language=objc)
79// NS_ENUM
80#[repr(transparent)]
81#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
82pub struct MPSeekCommandEventType(pub NSUInteger);
83impl MPSeekCommandEventType {
84    #[doc(alias = "MPSeekCommandEventTypeBeginSeeking")]
85    pub const BeginSeeking: Self = Self(0);
86    #[doc(alias = "MPSeekCommandEventTypeEndSeeking")]
87    pub const EndSeeking: Self = Self(1);
88}
89
90unsafe impl Encode for MPSeekCommandEventType {
91    const ENCODING: Encoding = NSUInteger::ENCODING;
92}
93
94unsafe impl RefEncode for MPSeekCommandEventType {
95    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
96}
97
98extern_class!(
99    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpseekcommandevent?language=objc)
100    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
101    #[derive(Debug, PartialEq, Eq, Hash)]
102    pub struct MPSeekCommandEvent;
103);
104
105unsafe impl NSObjectProtocol for MPSeekCommandEvent {}
106
107impl MPSeekCommandEvent {
108    extern_methods!(
109        /// The type of seek command event, which specifies whether an external player
110        /// began or ended seeking.
111        #[unsafe(method(type))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn r#type(&self) -> MPSeekCommandEventType;
114    );
115}
116
117/// Methods declared on superclass `NSObject`.
118impl MPSeekCommandEvent {
119    extern_methods!(
120        #[unsafe(method(init))]
121        #[unsafe(method_family = init)]
122        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
123
124        #[unsafe(method(new))]
125        #[unsafe(method_family = new)]
126        pub unsafe fn new() -> Retained<Self>;
127    );
128}
129
130extern_class!(
131    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpratingcommandevent?language=objc)
132    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
133    #[derive(Debug, PartialEq, Eq, Hash)]
134    pub struct MPRatingCommandEvent;
135);
136
137unsafe impl NSObjectProtocol for MPRatingCommandEvent {}
138
139impl MPRatingCommandEvent {
140    extern_methods!(
141        /// The chosen rating for this command event. This value will be within the
142        /// minimumRating and maximumRating values set for the MPRatingCommand object.
143        #[unsafe(method(rating))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn rating(&self) -> c_float;
146    );
147}
148
149/// Methods declared on superclass `NSObject`.
150impl MPRatingCommandEvent {
151    extern_methods!(
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new() -> Retained<Self>;
159    );
160}
161
162extern_class!(
163    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpchangeplaybackratecommandevent?language=objc)
164    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
165    #[derive(Debug, PartialEq, Eq, Hash)]
166    pub struct MPChangePlaybackRateCommandEvent;
167);
168
169unsafe impl NSObjectProtocol for MPChangePlaybackRateCommandEvent {}
170
171impl MPChangePlaybackRateCommandEvent {
172    extern_methods!(
173        /// The chosen playback rate for this command event. This value will be equal
174        /// to one of the values specified in the supportedPlaybackRates array for the
175        /// MPChangePlaybackRateCommand object.
176        #[unsafe(method(playbackRate))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn playbackRate(&self) -> c_float;
179    );
180}
181
182/// Methods declared on superclass `NSObject`.
183impl MPChangePlaybackRateCommandEvent {
184    extern_methods!(
185        #[unsafe(method(init))]
186        #[unsafe(method_family = init)]
187        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
188
189        #[unsafe(method(new))]
190        #[unsafe(method_family = new)]
191        pub unsafe fn new() -> Retained<Self>;
192    );
193}
194
195extern_class!(
196    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpfeedbackcommandevent?language=objc)
197    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
198    #[derive(Debug, PartialEq, Eq, Hash)]
199    pub struct MPFeedbackCommandEvent;
200);
201
202unsafe impl NSObjectProtocol for MPFeedbackCommandEvent {}
203
204impl MPFeedbackCommandEvent {
205    extern_methods!(
206        /// Whether the command event is a negative operation. For example, the command
207        /// might ask that the app remove a bookmark for a particular track, rather than
208        /// add it. In this case, the handler for the bookmark command should check this
209        /// flag and remove the bookmark if it is set to YES.
210        ///
211        /// For like/dislike, a "negative like" might be treated differently from a
212        /// dislike command. The app might want to remove the "like" flag from the
213        /// current track, but not treat it as a dislike command.
214        #[unsafe(method(isNegative))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn isNegative(&self) -> bool;
217    );
218}
219
220/// Methods declared on superclass `NSObject`.
221impl MPFeedbackCommandEvent {
222    extern_methods!(
223        #[unsafe(method(init))]
224        #[unsafe(method_family = init)]
225        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
226
227        #[unsafe(method(new))]
228        #[unsafe(method_family = new)]
229        pub unsafe fn new() -> Retained<Self>;
230    );
231}
232
233extern_class!(
234    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpchangelanguageoptioncommandevent?language=objc)
235    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
236    #[derive(Debug, PartialEq, Eq, Hash)]
237    pub struct MPChangeLanguageOptionCommandEvent;
238);
239
240unsafe impl NSObjectProtocol for MPChangeLanguageOptionCommandEvent {}
241
242impl MPChangeLanguageOptionCommandEvent {
243    extern_methods!(
244        #[cfg(feature = "MPNowPlayingInfoLanguageOption")]
245        /// The requested language option to change.
246        /// The supplied language option may be the Automatic Legible Language Option
247        /// which would mean that best legible language option based on user preferences
248        /// is being requested. See MPNowPlayingInfoLanguageOption isAutomaticLegibleLanguageOption
249        #[unsafe(method(languageOption))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn languageOption(&self) -> Retained<MPNowPlayingInfoLanguageOption>;
252
253        #[cfg(feature = "MPRemoteControlTypes")]
254        /// Describes the extent of the changed language option
255        #[unsafe(method(setting))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn setting(&self) -> MPChangeLanguageOptionSetting;
258    );
259}
260
261/// Methods declared on superclass `NSObject`.
262impl MPChangeLanguageOptionCommandEvent {
263    extern_methods!(
264        #[unsafe(method(init))]
265        #[unsafe(method_family = init)]
266        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
267
268        #[unsafe(method(new))]
269        #[unsafe(method_family = new)]
270        pub unsafe fn new() -> Retained<Self>;
271    );
272}
273
274extern_class!(
275    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpchangeplaybackpositioncommandevent?language=objc)
276    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
277    #[derive(Debug, PartialEq, Eq, Hash)]
278    pub struct MPChangePlaybackPositionCommandEvent;
279);
280
281unsafe impl NSObjectProtocol for MPChangePlaybackPositionCommandEvent {}
282
283impl MPChangePlaybackPositionCommandEvent {
284    extern_methods!(
285        /// The desired playback position to use when setting the current time of the player.
286        #[unsafe(method(positionTime))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn positionTime(&self) -> NSTimeInterval;
289    );
290}
291
292/// Methods declared on superclass `NSObject`.
293impl MPChangePlaybackPositionCommandEvent {
294    extern_methods!(
295        #[unsafe(method(init))]
296        #[unsafe(method_family = init)]
297        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
298
299        #[unsafe(method(new))]
300        #[unsafe(method_family = new)]
301        pub unsafe fn new() -> Retained<Self>;
302    );
303}
304
305extern_class!(
306    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpchangeshufflemodecommandevent?language=objc)
307    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
308    #[derive(Debug, PartialEq, Eq, Hash)]
309    pub struct MPChangeShuffleModeCommandEvent;
310);
311
312unsafe impl NSObjectProtocol for MPChangeShuffleModeCommandEvent {}
313
314impl MPChangeShuffleModeCommandEvent {
315    extern_methods!(
316        #[cfg(feature = "MPRemoteControlTypes")]
317        /// The desired shuffle type to use when fulfilling the request.
318        #[unsafe(method(shuffleType))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn shuffleType(&self) -> MPShuffleType;
321
322        /// Whether or not the selection should be preserved between playback sessions
323        #[unsafe(method(preservesShuffleMode))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn preservesShuffleMode(&self) -> bool;
326    );
327}
328
329/// Methods declared on superclass `NSObject`.
330impl MPChangeShuffleModeCommandEvent {
331    extern_methods!(
332        #[unsafe(method(init))]
333        #[unsafe(method_family = init)]
334        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
335
336        #[unsafe(method(new))]
337        #[unsafe(method_family = new)]
338        pub unsafe fn new() -> Retained<Self>;
339    );
340}
341
342extern_class!(
343    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpchangerepeatmodecommandevent?language=objc)
344    #[unsafe(super(MPRemoteCommandEvent, NSObject))]
345    #[derive(Debug, PartialEq, Eq, Hash)]
346    pub struct MPChangeRepeatModeCommandEvent;
347);
348
349unsafe impl NSObjectProtocol for MPChangeRepeatModeCommandEvent {}
350
351impl MPChangeRepeatModeCommandEvent {
352    extern_methods!(
353        #[cfg(feature = "MPRemoteControlTypes")]
354        /// The desired repeat type to use when fulfilling the request.
355        #[unsafe(method(repeatType))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn repeatType(&self) -> MPRepeatType;
358
359        /// Whether or not the selection should be preserved between playback sessions
360        #[unsafe(method(preservesRepeatMode))]
361        #[unsafe(method_family = none)]
362        pub unsafe fn preservesRepeatMode(&self) -> bool;
363    );
364}
365
366/// Methods declared on superclass `NSObject`.
367impl MPChangeRepeatModeCommandEvent {
368    extern_methods!(
369        #[unsafe(method(init))]
370        #[unsafe(method_family = init)]
371        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
372
373        #[unsafe(method(new))]
374        #[unsafe(method_family = new)]
375        pub unsafe fn new() -> Retained<Self>;
376    );
377}