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