objc2_media_player/generated/
MPRemoteCommand.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct MPRemoteCommandHandlerStatus(pub NSInteger);
15impl MPRemoteCommandHandlerStatus {
16 #[doc(alias = "MPRemoteCommandHandlerStatusSuccess")]
18 pub const Success: Self = Self(0);
19 #[doc(alias = "MPRemoteCommandHandlerStatusNoSuchContent")]
22 pub const NoSuchContent: Self = Self(100);
23 #[doc(alias = "MPRemoteCommandHandlerStatusNoActionableNowPlayingItem")]
28 pub const NoActionableNowPlayingItem: Self = Self(110);
29 #[doc(alias = "MPRemoteCommandHandlerStatusDeviceNotFound")]
33 pub const DeviceNotFound: Self = Self(120);
34 #[doc(alias = "MPRemoteCommandHandlerStatusCommandFailed")]
36 pub const CommandFailed: Self = Self(200);
37}
38
39unsafe impl Encode for MPRemoteCommandHandlerStatus {
40 const ENCODING: Encoding = NSInteger::ENCODING;
41}
42
43unsafe impl RefEncode for MPRemoteCommandHandlerStatus {
44 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47extern_class!(
48 #[unsafe(super(NSObject))]
50 #[derive(Debug, PartialEq, Eq, Hash)]
51 pub struct MPRemoteCommand;
52);
53
54extern_conformance!(
55 unsafe impl NSObjectProtocol for MPRemoteCommand {}
56);
57
58impl MPRemoteCommand {
59 extern_methods!(
60 #[unsafe(method(new))]
61 #[unsafe(method_family = new)]
62 pub unsafe fn new() -> Retained<Self>;
63
64 #[unsafe(method(init))]
65 #[unsafe(method_family = init)]
66 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
67
68 #[unsafe(method(isEnabled))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn isEnabled(&self) -> bool;
73
74 #[unsafe(method(setEnabled:))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn setEnabled(&self, enabled: bool);
78
79 #[unsafe(method(addTarget:action:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn addTarget_action(&self, target: &AnyObject, action: Sel);
86
87 #[unsafe(method(removeTarget:action:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn removeTarget_action(&self, target: &AnyObject, action: Option<Sel>);
94
95 #[unsafe(method(removeTarget:))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn removeTarget(&self, target: Option<&AnyObject>);
101
102 #[cfg(all(feature = "MPRemoteCommandEvent", feature = "block2"))]
103 #[unsafe(method(addTargetWithHandler:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn addTargetWithHandler(
107 &self,
108 handler: &block2::DynBlock<
109 dyn Fn(NonNull<MPRemoteCommandEvent>) -> MPRemoteCommandHandlerStatus,
110 >,
111 ) -> Retained<AnyObject>;
112 );
113}
114
115extern_class!(
116 #[unsafe(super(MPRemoteCommand, NSObject))]
118 #[derive(Debug, PartialEq, Eq, Hash)]
119 pub struct MPSkipIntervalCommand;
120);
121
122extern_conformance!(
123 unsafe impl NSObjectProtocol for MPSkipIntervalCommand {}
124);
125
126impl MPSkipIntervalCommand {
127 extern_methods!(
128 #[unsafe(method(preferredIntervals))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn preferredIntervals(&self) -> Retained<NSArray<NSNumber>>;
132
133 #[unsafe(method(setPreferredIntervals:))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn setPreferredIntervals(&self, preferred_intervals: &NSArray<NSNumber>);
139 );
140}
141
142impl MPSkipIntervalCommand {
144 extern_methods!(
145 #[unsafe(method(new))]
146 #[unsafe(method_family = new)]
147 pub unsafe fn new() -> Retained<Self>;
148
149 #[unsafe(method(init))]
150 #[unsafe(method_family = init)]
151 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
152 );
153}
154
155extern_class!(
156 #[unsafe(super(MPRemoteCommand, NSObject))]
158 #[derive(Debug, PartialEq, Eq, Hash)]
159 pub struct MPFeedbackCommand;
160);
161
162extern_conformance!(
163 unsafe impl NSObjectProtocol for MPFeedbackCommand {}
164);
165
166impl MPFeedbackCommand {
167 extern_methods!(
168 #[unsafe(method(isActive))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn isActive(&self) -> bool;
174
175 #[unsafe(method(setActive:))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn setActive(&self, active: bool);
179
180 #[unsafe(method(localizedTitle))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn localizedTitle(&self) -> Retained<NSString>;
184
185 #[unsafe(method(setLocalizedTitle:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn setLocalizedTitle(&self, localized_title: &NSString);
191
192 #[unsafe(method(localizedShortTitle))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn localizedShortTitle(&self) -> Retained<NSString>;
198
199 #[unsafe(method(setLocalizedShortTitle:))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn setLocalizedShortTitle(&self, localized_short_title: &NSString);
205 );
206}
207
208impl MPFeedbackCommand {
210 extern_methods!(
211 #[unsafe(method(new))]
212 #[unsafe(method_family = new)]
213 pub unsafe fn new() -> Retained<Self>;
214
215 #[unsafe(method(init))]
216 #[unsafe(method_family = init)]
217 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
218 );
219}
220
221extern_class!(
222 #[unsafe(super(MPRemoteCommand, NSObject))]
224 #[derive(Debug, PartialEq, Eq, Hash)]
225 pub struct MPRatingCommand;
226);
227
228extern_conformance!(
229 unsafe impl NSObjectProtocol for MPRatingCommand {}
230);
231
232impl MPRatingCommand {
233 extern_methods!(
234 #[unsafe(method(minimumRating))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn minimumRating(&self) -> c_float;
238
239 #[unsafe(method(setMinimumRating:))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn setMinimumRating(&self, minimum_rating: c_float);
243
244 #[unsafe(method(maximumRating))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn maximumRating(&self) -> c_float;
248
249 #[unsafe(method(setMaximumRating:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn setMaximumRating(&self, maximum_rating: c_float);
253 );
254}
255
256impl MPRatingCommand {
258 extern_methods!(
259 #[unsafe(method(new))]
260 #[unsafe(method_family = new)]
261 pub unsafe fn new() -> Retained<Self>;
262
263 #[unsafe(method(init))]
264 #[unsafe(method_family = init)]
265 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
266 );
267}
268
269extern_class!(
270 #[unsafe(super(MPRemoteCommand, NSObject))]
272 #[derive(Debug, PartialEq, Eq, Hash)]
273 pub struct MPChangePlaybackRateCommand;
274);
275
276extern_conformance!(
277 unsafe impl NSObjectProtocol for MPChangePlaybackRateCommand {}
278);
279
280impl MPChangePlaybackRateCommand {
281 extern_methods!(
282 #[unsafe(method(supportedPlaybackRates))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn supportedPlaybackRates(&self) -> Retained<NSArray<NSNumber>>;
287
288 #[unsafe(method(setSupportedPlaybackRates:))]
292 #[unsafe(method_family = none)]
293 pub unsafe fn setSupportedPlaybackRates(
294 &self,
295 supported_playback_rates: &NSArray<NSNumber>,
296 );
297 );
298}
299
300impl MPChangePlaybackRateCommand {
302 extern_methods!(
303 #[unsafe(method(new))]
304 #[unsafe(method_family = new)]
305 pub unsafe fn new() -> Retained<Self>;
306
307 #[unsafe(method(init))]
308 #[unsafe(method_family = init)]
309 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
310 );
311}
312
313extern_class!(
314 #[unsafe(super(MPRemoteCommand, NSObject))]
319 #[derive(Debug, PartialEq, Eq, Hash)]
320 pub struct MPChangePlaybackPositionCommand;
321);
322
323extern_conformance!(
324 unsafe impl NSObjectProtocol for MPChangePlaybackPositionCommand {}
325);
326
327impl MPChangePlaybackPositionCommand {
328 extern_methods!();
329}
330
331impl MPChangePlaybackPositionCommand {
333 extern_methods!(
334 #[unsafe(method(new))]
335 #[unsafe(method_family = new)]
336 pub unsafe fn new() -> Retained<Self>;
337
338 #[unsafe(method(init))]
339 #[unsafe(method_family = init)]
340 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
341 );
342}
343
344extern_class!(
345 #[unsafe(super(MPRemoteCommand, NSObject))]
352 #[derive(Debug, PartialEq, Eq, Hash)]
353 pub struct MPChangeShuffleModeCommand;
354);
355
356extern_conformance!(
357 unsafe impl NSObjectProtocol for MPChangeShuffleModeCommand {}
358);
359
360impl MPChangeShuffleModeCommand {
361 extern_methods!(
362 #[cfg(feature = "MPRemoteControlTypes")]
363 #[unsafe(method(currentShuffleType))]
365 #[unsafe(method_family = none)]
366 pub unsafe fn currentShuffleType(&self) -> MPShuffleType;
367
368 #[cfg(feature = "MPRemoteControlTypes")]
369 #[unsafe(method(setCurrentShuffleType:))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn setCurrentShuffleType(&self, current_shuffle_type: MPShuffleType);
373 );
374}
375
376impl MPChangeShuffleModeCommand {
378 extern_methods!(
379 #[unsafe(method(new))]
380 #[unsafe(method_family = new)]
381 pub unsafe fn new() -> Retained<Self>;
382
383 #[unsafe(method(init))]
384 #[unsafe(method_family = init)]
385 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
386 );
387}
388
389extern_class!(
390 #[unsafe(super(MPRemoteCommand, NSObject))]
397 #[derive(Debug, PartialEq, Eq, Hash)]
398 pub struct MPChangeRepeatModeCommand;
399);
400
401extern_conformance!(
402 unsafe impl NSObjectProtocol for MPChangeRepeatModeCommand {}
403);
404
405impl MPChangeRepeatModeCommand {
406 extern_methods!(
407 #[cfg(feature = "MPRemoteControlTypes")]
408 #[unsafe(method(currentRepeatType))]
410 #[unsafe(method_family = none)]
411 pub unsafe fn currentRepeatType(&self) -> MPRepeatType;
412
413 #[cfg(feature = "MPRemoteControlTypes")]
414 #[unsafe(method(setCurrentRepeatType:))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn setCurrentRepeatType(&self, current_repeat_type: MPRepeatType);
418 );
419}
420
421impl MPChangeRepeatModeCommand {
423 extern_methods!(
424 #[unsafe(method(new))]
425 #[unsafe(method_family = new)]
426 pub unsafe fn new() -> Retained<Self>;
427
428 #[unsafe(method(init))]
429 #[unsafe(method_family = init)]
430 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
431 );
432}