objc2_tv_services/generated/
TVContentItem.rs

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