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:))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn addTarget_action(&self, target: &AnyObject, action: Sel);
82
83 #[unsafe(method(removeTarget:action:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn removeTarget_action(&self, target: &AnyObject, action: Option<Sel>);
86
87 #[unsafe(method(removeTarget:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn removeTarget(&self, target: Option<&AnyObject>);
90
91 #[cfg(all(feature = "MPRemoteCommandEvent", feature = "block2"))]
92 #[unsafe(method(addTargetWithHandler:))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn addTargetWithHandler(
96 &self,
97 handler: &block2::DynBlock<
98 dyn Fn(NonNull<MPRemoteCommandEvent>) -> MPRemoteCommandHandlerStatus,
99 >,
100 ) -> Retained<AnyObject>;
101 );
102}
103
104extern_class!(
105 #[unsafe(super(MPRemoteCommand, NSObject))]
107 #[derive(Debug, PartialEq, Eq, Hash)]
108 pub struct MPSkipIntervalCommand;
109);
110
111extern_conformance!(
112 unsafe impl NSObjectProtocol for MPSkipIntervalCommand {}
113);
114
115impl MPSkipIntervalCommand {
116 extern_methods!(
117 #[unsafe(method(preferredIntervals))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn preferredIntervals(&self) -> Retained<NSArray<NSNumber>>;
121
122 #[unsafe(method(setPreferredIntervals:))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn setPreferredIntervals(&self, preferred_intervals: &NSArray<NSNumber>);
126 );
127}
128
129impl MPSkipIntervalCommand {
131 extern_methods!(
132 #[unsafe(method(new))]
133 #[unsafe(method_family = new)]
134 pub unsafe fn new() -> Retained<Self>;
135
136 #[unsafe(method(init))]
137 #[unsafe(method_family = init)]
138 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
139 );
140}
141
142extern_class!(
143 #[unsafe(super(MPRemoteCommand, NSObject))]
145 #[derive(Debug, PartialEq, Eq, Hash)]
146 pub struct MPFeedbackCommand;
147);
148
149extern_conformance!(
150 unsafe impl NSObjectProtocol for MPFeedbackCommand {}
151);
152
153impl MPFeedbackCommand {
154 extern_methods!(
155 #[unsafe(method(isActive))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn isActive(&self) -> bool;
161
162 #[unsafe(method(setActive:))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn setActive(&self, active: bool);
166
167 #[unsafe(method(localizedTitle))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn localizedTitle(&self) -> Retained<NSString>;
171
172 #[unsafe(method(setLocalizedTitle:))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn setLocalizedTitle(&self, localized_title: &NSString);
176
177 #[unsafe(method(localizedShortTitle))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn localizedShortTitle(&self) -> Retained<NSString>;
183
184 #[unsafe(method(setLocalizedShortTitle:))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn setLocalizedShortTitle(&self, localized_short_title: &NSString);
188 );
189}
190
191impl MPFeedbackCommand {
193 extern_methods!(
194 #[unsafe(method(new))]
195 #[unsafe(method_family = new)]
196 pub unsafe fn new() -> Retained<Self>;
197
198 #[unsafe(method(init))]
199 #[unsafe(method_family = init)]
200 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
201 );
202}
203
204extern_class!(
205 #[unsafe(super(MPRemoteCommand, NSObject))]
207 #[derive(Debug, PartialEq, Eq, Hash)]
208 pub struct MPRatingCommand;
209);
210
211extern_conformance!(
212 unsafe impl NSObjectProtocol for MPRatingCommand {}
213);
214
215impl MPRatingCommand {
216 extern_methods!(
217 #[unsafe(method(minimumRating))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn minimumRating(&self) -> c_float;
221
222 #[unsafe(method(setMinimumRating:))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn setMinimumRating(&self, minimum_rating: c_float);
226
227 #[unsafe(method(maximumRating))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn maximumRating(&self) -> c_float;
231
232 #[unsafe(method(setMaximumRating:))]
234 #[unsafe(method_family = none)]
235 pub unsafe fn setMaximumRating(&self, maximum_rating: c_float);
236 );
237}
238
239impl MPRatingCommand {
241 extern_methods!(
242 #[unsafe(method(new))]
243 #[unsafe(method_family = new)]
244 pub unsafe fn new() -> Retained<Self>;
245
246 #[unsafe(method(init))]
247 #[unsafe(method_family = init)]
248 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
249 );
250}
251
252extern_class!(
253 #[unsafe(super(MPRemoteCommand, NSObject))]
255 #[derive(Debug, PartialEq, Eq, Hash)]
256 pub struct MPChangePlaybackRateCommand;
257);
258
259extern_conformance!(
260 unsafe impl NSObjectProtocol for MPChangePlaybackRateCommand {}
261);
262
263impl MPChangePlaybackRateCommand {
264 extern_methods!(
265 #[unsafe(method(supportedPlaybackRates))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn supportedPlaybackRates(&self) -> Retained<NSArray<NSNumber>>;
270
271 #[unsafe(method(setSupportedPlaybackRates:))]
273 #[unsafe(method_family = none)]
274 pub unsafe fn setSupportedPlaybackRates(
275 &self,
276 supported_playback_rates: &NSArray<NSNumber>,
277 );
278 );
279}
280
281impl MPChangePlaybackRateCommand {
283 extern_methods!(
284 #[unsafe(method(new))]
285 #[unsafe(method_family = new)]
286 pub unsafe fn new() -> Retained<Self>;
287
288 #[unsafe(method(init))]
289 #[unsafe(method_family = init)]
290 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
291 );
292}
293
294extern_class!(
295 #[unsafe(super(MPRemoteCommand, NSObject))]
300 #[derive(Debug, PartialEq, Eq, Hash)]
301 pub struct MPChangePlaybackPositionCommand;
302);
303
304extern_conformance!(
305 unsafe impl NSObjectProtocol for MPChangePlaybackPositionCommand {}
306);
307
308impl MPChangePlaybackPositionCommand {
309 extern_methods!();
310}
311
312impl MPChangePlaybackPositionCommand {
314 extern_methods!(
315 #[unsafe(method(new))]
316 #[unsafe(method_family = new)]
317 pub unsafe fn new() -> Retained<Self>;
318
319 #[unsafe(method(init))]
320 #[unsafe(method_family = init)]
321 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
322 );
323}
324
325extern_class!(
326 #[unsafe(super(MPRemoteCommand, NSObject))]
333 #[derive(Debug, PartialEq, Eq, Hash)]
334 pub struct MPChangeShuffleModeCommand;
335);
336
337extern_conformance!(
338 unsafe impl NSObjectProtocol for MPChangeShuffleModeCommand {}
339);
340
341impl MPChangeShuffleModeCommand {
342 extern_methods!(
343 #[cfg(feature = "MPRemoteControlTypes")]
344 #[unsafe(method(currentShuffleType))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn currentShuffleType(&self) -> MPShuffleType;
348
349 #[cfg(feature = "MPRemoteControlTypes")]
350 #[unsafe(method(setCurrentShuffleType:))]
352 #[unsafe(method_family = none)]
353 pub unsafe fn setCurrentShuffleType(&self, current_shuffle_type: MPShuffleType);
354 );
355}
356
357impl MPChangeShuffleModeCommand {
359 extern_methods!(
360 #[unsafe(method(new))]
361 #[unsafe(method_family = new)]
362 pub unsafe fn new() -> Retained<Self>;
363
364 #[unsafe(method(init))]
365 #[unsafe(method_family = init)]
366 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
367 );
368}
369
370extern_class!(
371 #[unsafe(super(MPRemoteCommand, NSObject))]
378 #[derive(Debug, PartialEq, Eq, Hash)]
379 pub struct MPChangeRepeatModeCommand;
380);
381
382extern_conformance!(
383 unsafe impl NSObjectProtocol for MPChangeRepeatModeCommand {}
384);
385
386impl MPChangeRepeatModeCommand {
387 extern_methods!(
388 #[cfg(feature = "MPRemoteControlTypes")]
389 #[unsafe(method(currentRepeatType))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn currentRepeatType(&self) -> MPRepeatType;
393
394 #[cfg(feature = "MPRemoteControlTypes")]
395 #[unsafe(method(setCurrentRepeatType:))]
397 #[unsafe(method_family = none)]
398 pub unsafe fn setCurrentRepeatType(&self, current_repeat_type: MPRepeatType);
399 );
400}
401
402impl MPChangeRepeatModeCommand {
404 extern_methods!(
405 #[unsafe(method(new))]
406 #[unsafe(method_family = new)]
407 pub unsafe fn new() -> Retained<Self>;
408
409 #[unsafe(method(init))]
410 #[unsafe(method_family = init)]
411 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
412 );
413}