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
54unsafe impl NSObjectProtocol for MPRemoteCommand {}
55
56impl MPRemoteCommand {
57 extern_methods!(
58 #[unsafe(method(new))]
59 #[unsafe(method_family = new)]
60 pub unsafe fn new() -> Retained<Self>;
61
62 #[unsafe(method(init))]
63 #[unsafe(method_family = init)]
64 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
65
66 #[unsafe(method(isEnabled))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn isEnabled(&self) -> bool;
71
72 #[unsafe(method(setEnabled:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn setEnabled(&self, enabled: bool);
76
77 #[unsafe(method(addTarget:action:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn addTarget_action(&self, target: &AnyObject, action: Sel);
80
81 #[unsafe(method(removeTarget:action:))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn removeTarget_action(&self, target: &AnyObject, action: Option<Sel>);
84
85 #[unsafe(method(removeTarget:))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn removeTarget(&self, target: Option<&AnyObject>);
88
89 #[cfg(all(feature = "MPRemoteCommandEvent", feature = "block2"))]
90 #[unsafe(method(addTargetWithHandler:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn addTargetWithHandler(
94 &self,
95 handler: &block2::Block<
96 dyn Fn(NonNull<MPRemoteCommandEvent>) -> MPRemoteCommandHandlerStatus,
97 >,
98 ) -> Retained<AnyObject>;
99 );
100}
101
102extern_class!(
103 #[unsafe(super(MPRemoteCommand, NSObject))]
105 #[derive(Debug, PartialEq, Eq, Hash)]
106 pub struct MPSkipIntervalCommand;
107);
108
109unsafe impl NSObjectProtocol for MPSkipIntervalCommand {}
110
111impl MPSkipIntervalCommand {
112 extern_methods!(
113 #[unsafe(method(preferredIntervals))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn preferredIntervals(&self) -> Retained<NSArray<NSNumber>>;
117
118 #[unsafe(method(setPreferredIntervals:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn setPreferredIntervals(&self, preferred_intervals: &NSArray<NSNumber>);
122 );
123}
124
125impl MPSkipIntervalCommand {
127 extern_methods!(
128 #[unsafe(method(new))]
129 #[unsafe(method_family = new)]
130 pub unsafe fn new() -> Retained<Self>;
131
132 #[unsafe(method(init))]
133 #[unsafe(method_family = init)]
134 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
135 );
136}
137
138extern_class!(
139 #[unsafe(super(MPRemoteCommand, NSObject))]
141 #[derive(Debug, PartialEq, Eq, Hash)]
142 pub struct MPFeedbackCommand;
143);
144
145unsafe impl NSObjectProtocol for MPFeedbackCommand {}
146
147impl MPFeedbackCommand {
148 extern_methods!(
149 #[unsafe(method(isActive))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn isActive(&self) -> bool;
155
156 #[unsafe(method(setActive:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn setActive(&self, active: bool);
160
161 #[unsafe(method(localizedTitle))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn localizedTitle(&self) -> Retained<NSString>;
165
166 #[unsafe(method(setLocalizedTitle:))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn setLocalizedTitle(&self, localized_title: &NSString);
170
171 #[unsafe(method(localizedShortTitle))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn localizedShortTitle(&self) -> Retained<NSString>;
177
178 #[unsafe(method(setLocalizedShortTitle:))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn setLocalizedShortTitle(&self, localized_short_title: &NSString);
182 );
183}
184
185impl MPFeedbackCommand {
187 extern_methods!(
188 #[unsafe(method(new))]
189 #[unsafe(method_family = new)]
190 pub unsafe fn new() -> Retained<Self>;
191
192 #[unsafe(method(init))]
193 #[unsafe(method_family = init)]
194 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
195 );
196}
197
198extern_class!(
199 #[unsafe(super(MPRemoteCommand, NSObject))]
201 #[derive(Debug, PartialEq, Eq, Hash)]
202 pub struct MPRatingCommand;
203);
204
205unsafe impl NSObjectProtocol for MPRatingCommand {}
206
207impl MPRatingCommand {
208 extern_methods!(
209 #[unsafe(method(minimumRating))]
211 #[unsafe(method_family = none)]
212 pub unsafe fn minimumRating(&self) -> c_float;
213
214 #[unsafe(method(setMinimumRating:))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn setMinimumRating(&self, minimum_rating: c_float);
218
219 #[unsafe(method(maximumRating))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn maximumRating(&self) -> c_float;
223
224 #[unsafe(method(setMaximumRating:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn setMaximumRating(&self, maximum_rating: c_float);
228 );
229}
230
231impl MPRatingCommand {
233 extern_methods!(
234 #[unsafe(method(new))]
235 #[unsafe(method_family = new)]
236 pub unsafe fn new() -> Retained<Self>;
237
238 #[unsafe(method(init))]
239 #[unsafe(method_family = init)]
240 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
241 );
242}
243
244extern_class!(
245 #[unsafe(super(MPRemoteCommand, NSObject))]
247 #[derive(Debug, PartialEq, Eq, Hash)]
248 pub struct MPChangePlaybackRateCommand;
249);
250
251unsafe impl NSObjectProtocol for MPChangePlaybackRateCommand {}
252
253impl MPChangePlaybackRateCommand {
254 extern_methods!(
255 #[unsafe(method(supportedPlaybackRates))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn supportedPlaybackRates(&self) -> Retained<NSArray<NSNumber>>;
260
261 #[unsafe(method(setSupportedPlaybackRates:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn setSupportedPlaybackRates(
265 &self,
266 supported_playback_rates: &NSArray<NSNumber>,
267 );
268 );
269}
270
271impl MPChangePlaybackRateCommand {
273 extern_methods!(
274 #[unsafe(method(new))]
275 #[unsafe(method_family = new)]
276 pub unsafe fn new() -> Retained<Self>;
277
278 #[unsafe(method(init))]
279 #[unsafe(method_family = init)]
280 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
281 );
282}
283
284extern_class!(
285 #[unsafe(super(MPRemoteCommand, NSObject))]
290 #[derive(Debug, PartialEq, Eq, Hash)]
291 pub struct MPChangePlaybackPositionCommand;
292);
293
294unsafe impl NSObjectProtocol for MPChangePlaybackPositionCommand {}
295
296impl MPChangePlaybackPositionCommand {
297 extern_methods!();
298}
299
300impl MPChangePlaybackPositionCommand {
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))]
321 #[derive(Debug, PartialEq, Eq, Hash)]
322 pub struct MPChangeShuffleModeCommand;
323);
324
325unsafe impl NSObjectProtocol for MPChangeShuffleModeCommand {}
326
327impl MPChangeShuffleModeCommand {
328 extern_methods!(
329 #[cfg(feature = "MPRemoteControlTypes")]
330 #[unsafe(method(currentShuffleType))]
332 #[unsafe(method_family = none)]
333 pub unsafe fn currentShuffleType(&self) -> MPShuffleType;
334
335 #[cfg(feature = "MPRemoteControlTypes")]
336 #[unsafe(method(setCurrentShuffleType:))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn setCurrentShuffleType(&self, current_shuffle_type: MPShuffleType);
340 );
341}
342
343impl MPChangeShuffleModeCommand {
345 extern_methods!(
346 #[unsafe(method(new))]
347 #[unsafe(method_family = new)]
348 pub unsafe fn new() -> Retained<Self>;
349
350 #[unsafe(method(init))]
351 #[unsafe(method_family = init)]
352 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
353 );
354}
355
356extern_class!(
357 #[unsafe(super(MPRemoteCommand, NSObject))]
364 #[derive(Debug, PartialEq, Eq, Hash)]
365 pub struct MPChangeRepeatModeCommand;
366);
367
368unsafe impl NSObjectProtocol for MPChangeRepeatModeCommand {}
369
370impl MPChangeRepeatModeCommand {
371 extern_methods!(
372 #[cfg(feature = "MPRemoteControlTypes")]
373 #[unsafe(method(currentRepeatType))]
375 #[unsafe(method_family = none)]
376 pub unsafe fn currentRepeatType(&self) -> MPRepeatType;
377
378 #[cfg(feature = "MPRemoteControlTypes")]
379 #[unsafe(method(setCurrentRepeatType:))]
381 #[unsafe(method_family = none)]
382 pub unsafe fn setCurrentRepeatType(&self, current_repeat_type: MPRepeatType);
383 );
384}
385
386impl MPChangeRepeatModeCommand {
388 extern_methods!(
389 #[unsafe(method(new))]
390 #[unsafe(method_family = new)]
391 pub unsafe fn new() -> Retained<Self>;
392
393 #[unsafe(method(init))]
394 #[unsafe(method_family = init)]
395 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
396 );
397}