objc2_car_play/generated/CPNowPlayingMode.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6#[cfg(feature = "objc2-ui-kit")]
7use objc2_ui_kit::*;
8
9use crate::*;
10
11extern_class!(
12 /// [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingmode?language=objc)
13 #[unsafe(super(NSObject))]
14 #[thread_kind = MainThreadOnly]
15 #[derive(Debug, PartialEq, Eq, Hash)]
16 pub struct CPNowPlayingMode;
17);
18
19extern_conformance!(
20 unsafe impl NSCoding for CPNowPlayingMode {}
21);
22
23extern_conformance!(
24 unsafe impl NSObjectProtocol for CPNowPlayingMode {}
25);
26
27extern_conformance!(
28 unsafe impl NSSecureCoding for CPNowPlayingMode {}
29);
30
31impl CPNowPlayingMode {
32 extern_methods!(
33 /// The default now playing mode. While this mode is active,
34 /// your app will display now playing metadata as donated to
35 /// the shared system now playing info center.
36 #[unsafe(method(defaultNowPlayingMode))]
37 #[unsafe(method_family = none)]
38 pub unsafe fn defaultNowPlayingMode(mtm: MainThreadMarker) -> Retained<CPNowPlayingMode>;
39 );
40}
41
42/// Methods declared on superclass `NSObject`.
43impl CPNowPlayingMode {
44 extern_methods!(
45 #[unsafe(method(init))]
46 #[unsafe(method_family = init)]
47 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
48
49 #[unsafe(method(new))]
50 #[unsafe(method_family = new)]
51 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
52 );
53}
54
55extern_class!(
56 /// The sports mode represents a layout for now playing suited to live-streaming or
57 /// recorded playback of a sporting event that features exactly two teams.
58 ///
59 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingmodesports?language=objc)
60 #[unsafe(super(CPNowPlayingMode, NSObject))]
61 #[thread_kind = MainThreadOnly]
62 #[derive(Debug, PartialEq, Eq, Hash)]
63 pub struct CPNowPlayingModeSports;
64);
65
66extern_conformance!(
67 unsafe impl NSCoding for CPNowPlayingModeSports {}
68);
69
70extern_conformance!(
71 unsafe impl NSObjectProtocol for CPNowPlayingModeSports {}
72);
73
74extern_conformance!(
75 unsafe impl NSSecureCoding for CPNowPlayingModeSports {}
76);
77
78impl CPNowPlayingModeSports {
79 extern_methods!(
80 #[cfg(feature = "objc2-ui-kit")]
81 /// Initialize a sports mode for display on the CarPlay now playing screen.
82 ///
83 ///
84 /// Parameter `leftTeam`: The sports team that should appear on the left side of the
85 /// now playing screen. This is commonly (but not always) the AWAY or VISITING team.
86 /// This team will be on the left in all layouts; it does not flip to the right
87 /// side when in a right-to-left language or a right-hand-drive vehicle.
88 ///
89 ///
90 /// Parameter `rightTeam`: The sports team that should appear on the right side of the
91 /// now playing screen. This is commonly (but not always) the HOME team.
92 /// This team will be on the right in all layouts; it does not flip to the left
93 /// side when in a right-to-left language or a right-hand-drive vehicle.
94 ///
95 ///
96 /// Parameter `eventStatus`: A representation of the current event status. See
97 /// `CPNowPlayingSportsEventStatus`for more information.
98 ///
99 ///
100 /// Parameter `backgroundArtwork`: A large colorful image for the background of the
101 /// now playing screen. A gradient or crossfade image works best, especially
102 /// when it includes the primary colors of each team. Provide an image no larger
103 /// than 500x500.
104 #[unsafe(method(initWithLeftTeam:rightTeam:eventStatus:backgroundArtwork:))]
105 #[unsafe(method_family = init)]
106 pub unsafe fn initWithLeftTeam_rightTeam_eventStatus_backgroundArtwork(
107 this: Allocated<Self>,
108 left_team: &CPNowPlayingSportsTeam,
109 right_team: &CPNowPlayingSportsTeam,
110 event_status: Option<&CPNowPlayingSportsEventStatus>,
111 background_artwork: Option<&UIImage>,
112 ) -> Retained<Self>;
113
114 /// The sports team that should appear on the left side of the
115 /// now playing screen. This is commonly (but not always) the AWAY or VISITING team.
116 /// This team will be on the left in all layouts; it does not flip to the right
117 /// side when in a right-to-left language or a right-hand-drive vehicle.
118 #[unsafe(method(leftTeam))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn leftTeam(&self) -> Retained<CPNowPlayingSportsTeam>;
121
122 /// The sports team that should appear on the right side of the
123 /// now playing screen. This is commonly (but not always) the HOME team.
124 /// This team will be on the right in all layouts; it does not flip to the left
125 /// side when in a right-to-left language or a right-hand-drive vehicle.
126 #[unsafe(method(rightTeam))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn rightTeam(&self) -> Retained<CPNowPlayingSportsTeam>;
129
130 /// A representation of the current event status. See
131 /// `CPNowPlayingSportsEventStatus`for more information.
132 #[unsafe(method(eventStatus))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn eventStatus(&self) -> Option<Retained<CPNowPlayingSportsEventStatus>>;
135
136 #[cfg(feature = "objc2-ui-kit")]
137 /// A large colorful image for the background of the
138 /// now playing screen. A gradient or crossfade image works best, especially
139 /// when it includes the primary colors of each team. Provide an image no larger
140 /// than 500x500.
141 #[unsafe(method(backgroundArtwork))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn backgroundArtwork(&self) -> Option<Retained<UIImage>>;
144 );
145}
146
147/// Methods declared on superclass `NSObject`.
148impl CPNowPlayingModeSports {
149 extern_methods!(
150 #[unsafe(method(init))]
151 #[unsafe(method_family = init)]
152 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
153
154 #[unsafe(method(new))]
155 #[unsafe(method_family = new)]
156 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
157 );
158}
159
160extern_class!(
161 /// A representation of a sports team for the now playing screen,
162 /// in sports that have exactly two teams.
163 ///
164 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingsportsteam?language=objc)
165 #[unsafe(super(NSObject))]
166 #[thread_kind = MainThreadOnly]
167 #[derive(Debug, PartialEq, Eq, Hash)]
168 pub struct CPNowPlayingSportsTeam;
169);
170
171extern_conformance!(
172 unsafe impl NSCoding for CPNowPlayingSportsTeam {}
173);
174
175extern_conformance!(
176 unsafe impl NSObjectProtocol for CPNowPlayingSportsTeam {}
177);
178
179extern_conformance!(
180 unsafe impl NSSecureCoding for CPNowPlayingSportsTeam {}
181);
182
183impl CPNowPlayingSportsTeam {
184 extern_methods!(
185 #[cfg(feature = "objc2-ui-kit")]
186 /// Initialize a sports team for display on the now playing screen.
187 ///
188 ///
189 /// Parameter `name`: A localized, user-visible name for this sports team.
190 ///
191 /// Parameter `logo`: The team logo or, if no logo is available, the initials/abbreviation for this team.
192 ///
193 /// Parameter `teamStandings`: An optional additional label displayed near the team name. This could be a
194 /// win-loss ratio string, team standings, or other statistics relevant to this team.
195 /// Depending on the size of the car screen, a maximum of 15-20 characters may
196 /// be displayed.
197 ///
198 /// Parameter `eventScore`: The score string for this team in the current event. Depending on the size
199 /// of the car screen, a maximum of 3 to 5 characters may be displayed.
200 ///
201 /// Parameter `possessionIndicator`: An optional indicator used to indicate possession by this team.
202 /// Only one team should have possession at a given time.
203 ///
204 /// Parameter `favorite`: If true, the team is marked with a star to indicate it has been saved as a
205 /// user favorite.
206 #[unsafe(method(initWithName:logo:teamStandings:eventScore:possessionIndicator:favorite:))]
207 #[unsafe(method_family = init)]
208 pub unsafe fn initWithName_logo_teamStandings_eventScore_possessionIndicator_favorite(
209 this: Allocated<Self>,
210 name: &NSString,
211 logo: &CPNowPlayingSportsTeamLogo,
212 team_standings: Option<&NSString>,
213 event_score: &NSString,
214 possession_indicator: Option<&UIImage>,
215 favorite: bool,
216 ) -> Retained<Self>;
217
218 /// A localized, user-visible name for this sports team.
219 #[unsafe(method(name))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn name(&self) -> Retained<NSString>;
222
223 /// The team logo or, if no logo is available, the initials/abbreviation for this team.
224 /// See
225 /// `CPNowPlayingSportsTeamLogo.`
226 #[unsafe(method(logo))]
227 #[unsafe(method_family = none)]
228 pub unsafe fn logo(&self) -> Retained<CPNowPlayingSportsTeamLogo>;
229
230 /// An optional additional label displayed near the team name. This could be a
231 /// win-loss ratio string, team standings, or other statistics relevant to this team.
232 /// Depending on the size of the car screen, a maximum of 15-20 characters may
233 /// be displayed.
234 #[unsafe(method(teamStandings))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn teamStandings(&self) -> Option<Retained<NSString>>;
237
238 /// The numeric score string for this team in the current event. Depending on the size
239 /// of the car screen, a maximum of 3 to 5 characters may be displayed.
240 #[unsafe(method(eventScore))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn eventScore(&self) -> Retained<NSString>;
243
244 #[cfg(feature = "objc2-ui-kit")]
245 /// An optional indicator used to indicate possession by this team.
246 /// Only one team should have possession at a given time.
247 #[unsafe(method(possessionIndicator))]
248 #[unsafe(method_family = none)]
249 pub unsafe fn possessionIndicator(&self) -> Option<Retained<UIImage>>;
250
251 /// If true, the team is marked with a star to indicate it has been saved as a
252 /// user favorite.
253 #[unsafe(method(isFavorite))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn isFavorite(&self) -> bool;
256
257 #[unsafe(method(init))]
258 #[unsafe(method_family = init)]
259 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
260
261 #[unsafe(method(new))]
262 #[unsafe(method_family = new)]
263 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
264 );
265}
266
267extern_class!(
268 /// A representation of the status of a sporting event.
269 ///
270 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingsportseventstatus?language=objc)
271 #[unsafe(super(NSObject))]
272 #[thread_kind = MainThreadOnly]
273 #[derive(Debug, PartialEq, Eq, Hash)]
274 pub struct CPNowPlayingSportsEventStatus;
275);
276
277extern_conformance!(
278 unsafe impl NSCoding for CPNowPlayingSportsEventStatus {}
279);
280
281extern_conformance!(
282 unsafe impl NSObjectProtocol for CPNowPlayingSportsEventStatus {}
283);
284
285extern_conformance!(
286 unsafe impl NSSecureCoding for CPNowPlayingSportsEventStatus {}
287);
288
289impl CPNowPlayingSportsEventStatus {
290 extern_methods!(
291 #[cfg(feature = "objc2-ui-kit")]
292 /// Initialize an event status with optional event status text, an optional event status image,
293 /// and an optional event clock.
294 ///
295 ///
296 /// Parameter `eventStatusText`: Up to three separate strings for event status may be displayed.
297 ///
298 /// The first string should always be used to show the play period (quarter, inning, period)
299 /// using as few characters as possible; e.g. "2nd" for the 2nd quarter.
300 ///
301 /// The second and third strings can be used to display additional information, like "1st & 10" and "SF 15"
302 /// for an American football game.
303 ///
304 /// All three strings should be kept as brief as possible to ensure they display well on car screens
305 /// of various sizes.
306 ///
307 /// Parameter `eventStatusImage`: An optional event status image for this event, if it applies to this event. For example,
308 /// a baseball game could display a representation of the bases and outs, indicating
309 /// how many bases are loaded and the number of outs in the current inning.
310 ///
311 /// Parameter `eventClock`: The event timer, if it applies to this event. See
312 /// `CPNowPlayingSportsClock.`
313 #[unsafe(method(initWithEventStatusText:eventStatusImage:eventClock:))]
314 #[unsafe(method_family = init)]
315 pub unsafe fn initWithEventStatusText_eventStatusImage_eventClock(
316 this: Allocated<Self>,
317 event_status_text: Option<&NSArray<NSString>>,
318 event_status_image: Option<&UIImage>,
319 event_clock: Option<&CPNowPlayingSportsClock>,
320 ) -> Retained<Self>;
321
322 /// Up to three separate strings for event status may be displayed.
323 ///
324 /// The first string should always be used to show the play period (quarter, inning, period)
325 /// using as few characters as possible; e.g. "2nd" for the 2nd quarter.
326 ///
327 /// The second and third strings can be used to display additional information, like "1st & 10" and "SF 15"
328 /// for an American football game.
329 ///
330 /// All three strings should be kept as brief as possible to ensure they display well on car screens
331 /// of various sizes.
332 #[unsafe(method(eventStatusText))]
333 #[unsafe(method_family = none)]
334 pub unsafe fn eventStatusText(&self) -> Option<Retained<NSArray<NSString>>>;
335
336 /// The event timer, if it applies to this event. See
337 /// `CPNowPlayingSportsClock.`
338 #[unsafe(method(eventClock))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn eventClock(&self) -> Option<Retained<CPNowPlayingSportsClock>>;
341
342 #[cfg(feature = "objc2-ui-kit")]
343 /// An optional event status image for this event, if it applies to this event. For example,
344 /// a baseball game could display a representation of the bases and outs, indicating
345 /// how many bases are loaded and the number of outs in the current inning.
346 #[unsafe(method(eventStatusImage))]
347 #[unsafe(method_family = none)]
348 pub unsafe fn eventStatusImage(&self) -> Option<Retained<UIImage>>;
349
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(mtm: MainThreadMarker) -> Retained<Self>;
357 );
358}
359
360extern_class!(
361 /// A representation of the amount of time elapsed so far in this event,
362 /// for events where the clock counts UP.
363 ///
364 /// Or, a representation of the amount of time remaining in the event,
365 /// or a section of the event (period/quarter/etc.) for events where the
366 /// clock counts DOWN.
367 ///
368 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingsportsclock?language=objc)
369 #[unsafe(super(NSObject))]
370 #[thread_kind = MainThreadOnly]
371 #[derive(Debug, PartialEq, Eq, Hash)]
372 pub struct CPNowPlayingSportsClock;
373);
374
375extern_conformance!(
376 unsafe impl NSCoding for CPNowPlayingSportsClock {}
377);
378
379extern_conformance!(
380 unsafe impl NSObjectProtocol for CPNowPlayingSportsClock {}
381);
382
383extern_conformance!(
384 unsafe impl NSSecureCoding for CPNowPlayingSportsClock {}
385);
386
387impl CPNowPlayingSportsClock {
388 extern_methods!(
389 /// Represents a duration of time that has elapsed so far in this event, or play period of the event (quarter/inning/period).
390 ///
391 /// When displayed on the now playing screen, the clock will count UP.
392 #[unsafe(method(initWithElapsedTime:paused:))]
393 #[unsafe(method_family = init)]
394 pub unsafe fn initWithElapsedTime_paused(
395 this: Allocated<Self>,
396 elapsed_time: NSTimeInterval,
397 paused: bool,
398 ) -> Retained<Self>;
399
400 /// Represents an amount of time remaining in the event, or play period of the event (quarter/inning/period).
401 ///
402 /// When displayed on the now playing screen, the clock will count DOWN.
403 #[unsafe(method(initWithTimeRemaining:paused:))]
404 #[unsafe(method_family = init)]
405 pub unsafe fn initWithTimeRemaining_paused(
406 this: Allocated<Self>,
407 time_remaining: NSTimeInterval,
408 paused: bool,
409 ) -> Retained<Self>;
410
411 /// The time value in the clock; either elapsed time or time remaining.
412 #[unsafe(method(timeValue))]
413 #[unsafe(method_family = none)]
414 pub unsafe fn timeValue(&self) -> NSTimeInterval;
415
416 /// Whether the clock should be paused, e.g. due to a stoppage in play.
417 ///
418 /// If YES, the clock will be paused at the specified value.
419 ///
420 /// If NO, the clock will count up (or down).
421 #[unsafe(method(isPaused))]
422 #[unsafe(method_family = none)]
423 pub unsafe fn isPaused(&self) -> bool;
424
425 /// If true, the timer is counting UP, so as to indicate an amount of time elapsed
426 /// so far in this event.
427 ///
428 /// If false, the timer is counting DOWN, so as to indicate an amount of time
429 /// remaining in the event, or a play period of the event (quarter/inning/period).
430 #[unsafe(method(countsUp))]
431 #[unsafe(method_family = none)]
432 pub unsafe fn countsUp(&self) -> bool;
433
434 #[unsafe(method(init))]
435 #[unsafe(method_family = init)]
436 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
437
438 #[unsafe(method(new))]
439 #[unsafe(method_family = new)]
440 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
441 );
442}
443
444extern_class!(
445 /// A logo image or, if no image is available, an abbreviation
446 /// or initialism for this team.
447 ///
448 /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnowplayingsportsteamlogo?language=objc)
449 #[unsafe(super(NSObject))]
450 #[thread_kind = MainThreadOnly]
451 #[derive(Debug, PartialEq, Eq, Hash)]
452 pub struct CPNowPlayingSportsTeamLogo;
453);
454
455extern_conformance!(
456 unsafe impl NSCoding for CPNowPlayingSportsTeamLogo {}
457);
458
459extern_conformance!(
460 unsafe impl NSObjectProtocol for CPNowPlayingSportsTeamLogo {}
461);
462
463extern_conformance!(
464 unsafe impl NSSecureCoding for CPNowPlayingSportsTeamLogo {}
465);
466
467impl CPNowPlayingSportsTeamLogo {
468 extern_methods!(
469 #[cfg(feature = "objc2-ui-kit")]
470 /// Initialize a team logo with an image representation of this team.
471 /// Provide an image no larger than 350x350; larger images will be resized down.
472 #[unsafe(method(initWithTeamLogo:))]
473 #[unsafe(method_family = init)]
474 pub unsafe fn initWithTeamLogo(
475 this: Allocated<Self>,
476 team_logo: &UIImage,
477 ) -> Retained<Self>;
478
479 /// If no team logo image is available, initialize a team logo
480 /// with an abbreviation or initialism for this team.
481 ///
482 /// A maximum of 3 characters may be displayed for the team initials.
483 #[unsafe(method(initWithTeamInitials:))]
484 #[unsafe(method_family = init)]
485 pub unsafe fn initWithTeamInitials(
486 this: Allocated<Self>,
487 team_initials: &NSString,
488 ) -> Retained<Self>;
489
490 #[cfg(feature = "objc2-ui-kit")]
491 /// A team logo image for this team.
492 #[unsafe(method(logo))]
493 #[unsafe(method_family = none)]
494 pub unsafe fn logo(&self) -> Option<Retained<UIImage>>;
495
496 /// An abbreviation or initialism for this team, used only if
497 /// no logo image is available for this team.
498 #[unsafe(method(initials))]
499 #[unsafe(method_family = none)]
500 pub unsafe fn initials(&self) -> Option<Retained<NSString>>;
501
502 #[unsafe(method(init))]
503 #[unsafe(method_family = init)]
504 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
505
506 #[unsafe(method(new))]
507 #[unsafe(method_family = new)]
508 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
509 );
510}