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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
//! 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::*;
/// Option bits for imageURLForTraits: and setImageURL:forTraits:.
///
/// In Objective C, use the bitwise OR (|) operator to combine
/// options together. Apple will not define values for the upper
/// 16 bits of this 64-bit type (that is, 1
/// <
/// <
/// 48 and higher).
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvcontentitemimagetrait?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TVContentItemImageTrait(pub NSUInteger);
bitflags::bitflags! {
impl TVContentItemImageTrait: NSUInteger {
#[doc(alias = "TVContentItemImageTraitUserInterfaceStyleLight")]
const UserInterfaceStyleLight = 1<<8;
#[doc(alias = "TVContentItemImageTraitUserInterfaceStyleDark")]
const UserInterfaceStyleDark = 2<<8;
#[doc(alias = "TVContentItemImageTraitScreenScale1x")]
const ScreenScale1x = 1<<12;
#[doc(alias = "TVContentItemImageTraitScreenScale2x")]
const ScreenScale2x = 2<<12;
}
}
unsafe impl Encode for TVContentItemImageTrait {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for TVContentItemImageTrait {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
/// Values for the imageShape property.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvcontentitemimageshape?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TVContentItemImageShape(pub NSInteger);
impl TVContentItemImageShape {
#[doc(alias = "TVContentItemImageShapeNone")]
pub const None: Self = Self(0);
#[doc(alias = "TVContentItemImageShapePoster")]
pub const Poster: Self = Self(1);
#[doc(alias = "TVContentItemImageShapeSquare")]
pub const Square: Self = Self(2);
#[doc(alias = "TVContentItemImageShapeSDTV")]
pub const SDTV: Self = Self(3);
#[doc(alias = "TVContentItemImageShapeHDTV")]
pub const HDTV: Self = Self(4);
#[doc(alias = "TVContentItemImageShapeWide")]
pub const Wide: Self = Self(5);
#[doc(alias = "TVContentItemImageShapeExtraWide")]
pub const ExtraWide: Self = Self(6);
}
unsafe impl Encode for TVContentItemImageShape {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for TVContentItemImageShape {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// An object describing a piece or group of content.
///
/// Most properties are optional, and indeed some properties
/// will not apply to all individual items or groups or types
/// of content.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvcontentitem?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
pub struct TVContentItem;
);
extern_conformance!(
unsafe impl NSCoding for TVContentItem {}
);
extern_conformance!(
unsafe impl NSCopying for TVContentItem {}
);
unsafe impl CopyingHelper for TVContentItem {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for TVContentItem {}
);
extern_conformance!(
unsafe impl NSSecureCoding for TVContentItem {}
);
impl TVContentItem {
extern_methods!(
#[cfg(feature = "TVContentIdentifier")]
/// The unique content identifier of this item.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(contentIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn contentIdentifier(&self) -> Retained<TVContentIdentifier>;
/// A URL of an image to display for this content item.
///
/// In tvOS 11.0 and later, use setImageURL:forTraits: to set URLs
/// for specific system states. If no URLs are set for trait
/// combinations the system understands, the value of this
/// property will be used as a last resort, for backwards
/// compatibility with older tvOS.
#[deprecated = "Use setImageURL:forTraits: to set image URLs into TVContentItem."]
#[unsafe(method(imageURL))]
#[unsafe(method_family = none)]
pub unsafe fn imageURL(&self) -> Option<Retained<NSURL>>;
/// Setter for [`imageURL`][Self::imageURL].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "Use setImageURL:forTraits: to set image URLs into TVContentItem."]
#[unsafe(method(setImageURL:))]
#[unsafe(method_family = none)]
pub unsafe fn setImageURL(&self, image_url: Option<&NSURL>);
/// Retrieve a previously set image URL.
///
/// Returns nil if no URL has been set for the given combination
/// of trait options.
#[unsafe(method(imageURLForTraits:))]
#[unsafe(method_family = none)]
pub unsafe fn imageURLForTraits(
&self,
traits: TVContentItemImageTrait,
) -> Option<Retained<NSURL>>;
/// Set URLs of images to display for this content item.
///
/// The aURL parameter can be nil to remove a previously set
/// value for the given trait combination.
#[unsafe(method(setImageURL:forTraits:))]
#[unsafe(method_family = none)]
pub unsafe fn setImageURL_forTraits(
&self,
a_url: Option<&NSURL>,
traits: TVContentItemImageTrait,
);
/// A TVContentItemImageShape value describing the intended aspect
/// ratio or shape of the image.
///
/// For Top Shelf purposes: the subset of values which are valid in
/// in this property, for TVContentItems in the topShelfItems property
/// of the TVTopShelfProvider, depends on the value of the topShelfStyle
/// property of the TVTopShelfProvider:
/// TVTopShelfContentStyleInset:
/// valid: TVContentItemImageShapeExtraWide
/// TVTopShelfContentStyleSectioned:
/// valid: TVContentItemImageShapePoster
/// valid: TVContentItemImageShapeSquare
/// valid: TVContentItemImageShapeHDTV
/// When the value of this property is not valid for the Top Shelf style,
/// the system reserves the right to scale the image in any way.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(imageShape))]
#[unsafe(method_family = none)]
pub unsafe fn imageShape(&self) -> TVContentItemImageShape;
/// Setter for [`imageShape`][Self::imageShape].
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setImageShape:))]
#[unsafe(method_family = none)]
pub unsafe fn setImageShape(&self, image_shape: TVContentItemImageShape);
/// The localized string title of the item.
///
/// String should be localized into the current user's locale.
/// This is the only property, other than topShelfItems, which is
/// used from a TVContentItem representing a section.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[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.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub unsafe fn setTitle(&self, title: Option<&NSString>);
/// Date at which the user last accessed (whatever that might mean
/// the particular content described by this content item) this item.
///
/// A typical use would be the date at which the user last played
/// the item, or played a subitem within the item (if this item
/// represents a group of items), for content types where "playing"
/// applies. This should not be when the user just looked at an item.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(lastAccessedDate))]
#[unsafe(method_family = none)]
pub unsafe fn lastAccessedDate(&self) -> Option<Retained<NSDate>>;
/// Setter for [`lastAccessedDate`][Self::lastAccessedDate].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setLastAccessedDate:))]
#[unsafe(method_family = none)]
pub unsafe fn setLastAccessedDate(&self, last_accessed_date: Option<&NSDate>);
/// Date at which the user will no longer be able to access the item.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(expirationDate))]
#[unsafe(method_family = none)]
pub unsafe fn expirationDate(&self) -> Option<Retained<NSDate>>;
/// Setter for [`expirationDate`][Self::expirationDate].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setExpirationDate:))]
#[unsafe(method_family = none)]
pub unsafe fn setExpirationDate(&self, expiration_date: Option<&NSDate>);
/// Date at which the content item was created, or was first
/// broadcast, or other such kind of origination date.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(creationDate))]
#[unsafe(method_family = none)]
pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;
/// Setter for [`creationDate`][Self::creationDate].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setCreationDate:))]
#[unsafe(method_family = none)]
pub unsafe fn setCreationDate(&self, creation_date: Option<&NSDate>);
/// A badging integer for this item.
///
/// The number is interpreted as a positive integer. Not all UI uses
/// of content items display badges.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(badgeCount))]
#[unsafe(method_family = none)]
pub unsafe fn badgeCount(&self) -> Option<Retained<NSNumber>>;
/// Setter for [`badgeCount`][Self::badgeCount].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setBadgeCount:))]
#[unsafe(method_family = none)]
pub unsafe fn setBadgeCount(&self, badge_count: Option<&NSNumber>);
/// The time length of this item.
///
/// The number is interpreted as a double number of seconds.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(duration))]
#[unsafe(method_family = none)]
pub unsafe fn duration(&self) -> Option<Retained<NSNumber>>;
/// Setter for [`duration`][Self::duration].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setDuration:))]
#[unsafe(method_family = none)]
pub unsafe fn setDuration(&self, duration: Option<&NSNumber>);
/// The last time index the user was at in playing this item.
///
/// The number is interpreted as a double number of seconds.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(currentPosition))]
#[unsafe(method_family = none)]
pub unsafe fn currentPosition(&self) -> Option<Retained<NSNumber>>;
/// Setter for [`currentPosition`][Self::currentPosition].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setCurrentPosition:))]
#[unsafe(method_family = none)]
pub unsafe fn setCurrentPosition(&self, current_position: Option<&NSNumber>);
/// A boolean indicating whether the user can be considered to have
/// finished this item.
///
/// The number is interpreted as a boolean.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(hasPlayedToEnd))]
#[unsafe(method_family = none)]
pub unsafe fn hasPlayedToEnd(&self) -> Option<Retained<NSNumber>>;
/// Setter for [`hasPlayedToEnd`][Self::hasPlayedToEnd].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setHasPlayedToEnd:))]
#[unsafe(method_family = none)]
pub unsafe fn setHasPlayedToEnd(&self, has_played_to_end: Option<&NSNumber>);
/// A URL for the system to open to cause the application (which
/// created this content item) to begin playing the item, at the
/// user's currentPosition.
///
/// When opened (the app receives the UIApplication delegate method),
/// the application should proceed directly to playback without any
/// prompting for other information or confirmation panels or other
/// UI, if at all possible.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(playURL))]
#[unsafe(method_family = none)]
pub unsafe fn playURL(&self) -> Option<Retained<NSURL>>;
/// Setter for [`playURL`][Self::playURL].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setPlayURL:))]
#[unsafe(method_family = none)]
pub unsafe fn setPlayURL(&self, play_url: Option<&NSURL>);
/// A URL for the system to open to cause the application (which
/// created this content item) to display a description screen
/// for the item.
///
/// When opened (the app receives the UIApplication delegate method),
/// the application should proceed directly to displaying the
/// description of the item without any prompting for other information
/// or confirmation panels or other UI, if at all possible.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(displayURL))]
#[unsafe(method_family = none)]
pub unsafe fn displayURL(&self) -> Option<Retained<NSURL>>;
/// Setter for [`displayURL`][Self::displayURL].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setDisplayURL:))]
#[unsafe(method_family = none)]
pub unsafe fn setDisplayURL(&self, display_url: Option<&NSURL>);
/// An array of TVContentItems which are the items of a section.
///
/// If non-nil, this item will be interpreted as a section item in
/// main menu Top Shelf usage contexts. The title property is the
/// other interesting property in that case, though other properties
/// of this item may be also interpreted by the system in the future.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(topShelfItems))]
#[unsafe(method_family = none)]
pub unsafe fn topShelfItems(&self) -> Option<Retained<NSArray<TVContentItem>>>;
/// Setter for [`topShelfItems`][Self::topShelfItems].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(setTopShelfItems:))]
#[unsafe(method_family = none)]
pub unsafe fn setTopShelfItems(&self, top_shelf_items: Option<&NSArray<TVContentItem>>);
#[cfg(feature = "TVContentIdentifier")]
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(initWithContentIdentifier:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithContentIdentifier(
this: Allocated<Self>,
ident: &TVContentIdentifier,
) -> Retained<Self>;
/// # Safety
///
/// `coder` possibly has further requirements.
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;
);
}
/// Methods declared on superclass `NSObject`.
impl TVContentItem {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}