1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// MPContentItem represents high-level metadata for a particular media item for
/// representation outside the client application. Examples of media items that a
/// developer might want to represent include song files, streaming audio URLs,
/// or radio stations.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpcontentitem?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MPContentItem;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MPContentItem {}
);
impl MPContentItem {
extern_methods!(
/// Designated initializer. A unique identifier is required to identify the item
/// for later use.
#[unsafe(method(initWithIdentifier:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithIdentifier(
this: Allocated<Self>,
identifier: &NSString,
) -> Retained<Self>;
/// A unique identifier for this content item. (Required)
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub unsafe fn identifier(&self) -> Retained<NSString>;
/// A title for this item. Usually this would be the track name, if representing
/// a song, the episode name of a podcast, etc.
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub unsafe fn title(&self) -> Option<Retained<NSString>>;
/// Setter for [`title`][Self::title].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub unsafe fn setTitle(&self, title: Option<&NSString>);
/// A subtitle for this item. If this were representing a song, this would
/// usually be the artist or composer.
#[unsafe(method(subtitle))]
#[unsafe(method_family = none)]
pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;
/// Setter for [`subtitle`][Self::subtitle].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setSubtitle:))]
#[unsafe(method_family = none)]
pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);
#[cfg(feature = "MPMediaItem")]
/// Artwork for this item. Examples of artwork for a content item are the album
/// cover for a song, or a movie poster for a movie.
#[unsafe(method(artwork))]
#[unsafe(method_family = none)]
pub unsafe fn artwork(&self) -> Option<Retained<MPMediaItemArtwork>>;
#[cfg(feature = "MPMediaItem")]
/// Setter for [`artwork`][Self::artwork].
#[unsafe(method(setArtwork:))]
#[unsafe(method_family = none)]
pub unsafe fn setArtwork(&self, artwork: Option<&MPMediaItemArtwork>);
/// Represents the current playback progress of the item.
/// 0.0 = not watched/listened/viewed, 1.0 = fully watched/listened/viewed
/// Default is -1.0 (no progress indicator shown)
#[unsafe(method(playbackProgress))]
#[unsafe(method_family = none)]
pub unsafe fn playbackProgress(&self) -> c_float;
/// Setter for [`playbackProgress`][Self::playbackProgress].
#[unsafe(method(setPlaybackProgress:))]
#[unsafe(method_family = none)]
pub unsafe fn setPlaybackProgress(&self, playback_progress: c_float);
/// Represents whether this content item is streaming content, i.e. from the cloud
/// where the content is not stored locally.
#[unsafe(method(isStreamingContent))]
#[unsafe(method_family = none)]
pub unsafe fn isStreamingContent(&self) -> bool;
/// Setter for [`isStreamingContent`][Self::isStreamingContent].
#[unsafe(method(setStreamingContent:))]
#[unsafe(method_family = none)]
pub unsafe fn setStreamingContent(&self, streaming_content: bool);
/// Represents whether this content item is explicit content
#[unsafe(method(isExplicitContent))]
#[unsafe(method_family = none)]
pub unsafe fn isExplicitContent(&self) -> bool;
/// Setter for [`isExplicitContent`][Self::isExplicitContent].
#[unsafe(method(setExplicitContent:))]
#[unsafe(method_family = none)]
pub unsafe fn setExplicitContent(&self, explicit_content: bool);
/// Represents whether the content item is a container that may contain other
/// content items, e.g. an album or a playlist.
#[unsafe(method(isContainer))]
#[unsafe(method_family = none)]
pub unsafe fn isContainer(&self) -> bool;
/// Setter for [`isContainer`][Self::isContainer].
#[unsafe(method(setContainer:))]
#[unsafe(method_family = none)]
pub unsafe fn setContainer(&self, container: bool);
/// Represents whether the content item is actionable from a playback
/// perspective. Albums are playable, for example, because selecting an album
/// for playback means the app should play each song in the album in order. An
/// example of a content item that may not be playable is a genre, since an app
/// experience typically doesn't involve selecting an entire genre for playback.
#[unsafe(method(isPlayable))]
#[unsafe(method_family = none)]
pub unsafe fn isPlayable(&self) -> bool;
/// Setter for [`isPlayable`][Self::isPlayable].
#[unsafe(method(setPlayable:))]
#[unsafe(method_family = none)]
pub unsafe fn setPlayable(&self, playable: bool);
);
}
/// Methods declared on superclass `NSObject`.
impl MPContentItem {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}