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        #[deprecated = "Use setImageURL:forTraits: to set image URLs into TVContentItem."]
134        #[unsafe(method(setImageURL:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setImageURL(&self, image_url: Option<&NSURL>);
137
138        /// Retrieve a previously set image URL.
139        ///
140        /// Returns nil if no URL has been set for the given combination
141        /// of trait options.
142        #[unsafe(method(imageURLForTraits:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn imageURLForTraits(
145            &self,
146            traits: TVContentItemImageTrait,
147        ) -> Option<Retained<NSURL>>;
148
149        /// Set URLs of images to display for this content item.
150        ///
151        /// The aURL parameter can be nil to remove a previously set
152        /// value for the given trait combination.
153        #[unsafe(method(setImageURL:forTraits:))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn setImageURL_forTraits(
156            &self,
157            a_url: Option<&NSURL>,
158            traits: TVContentItemImageTrait,
159        );
160
161        /// A TVContentItemImageShape value describing the intended aspect
162        /// ratio or shape of the image.
163        ///
164        /// For Top Shelf purposes: the subset of values which are valid in
165        /// in this property, for TVContentItems in the topShelfItems property
166        /// of the TVTopShelfProvider, depends on the value of the topShelfStyle
167        /// property of the TVTopShelfProvider:
168        /// TVTopShelfContentStyleInset:
169        /// valid: TVContentItemImageShapeExtraWide
170        /// TVTopShelfContentStyleSectioned:
171        /// valid: TVContentItemImageShapePoster
172        /// valid: TVContentItemImageShapeSquare
173        /// valid: TVContentItemImageShapeHDTV
174        /// When the value of this property is not valid for the Top Shelf style,
175        /// the system reserves the right to scale the image in any way.
176        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
177        #[unsafe(method(imageShape))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn imageShape(&self) -> TVContentItemImageShape;
180
181        /// Setter for [`imageShape`][Self::imageShape].
182        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
183        #[unsafe(method(setImageShape:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn setImageShape(&self, image_shape: TVContentItemImageShape);
186
187        /// The localized string title of the item.
188        ///
189        /// String should be localized into the current user's locale.
190        /// This is the only property, other than topShelfItems, which is
191        /// used from a TVContentItem representing a section.
192        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
193        #[unsafe(method(title))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn title(&self) -> Option<Retained<NSString>>;
196
197        /// Setter for [`title`][Self::title].
198        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
199        #[unsafe(method(setTitle:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setTitle(&self, title: Option<&NSString>);
202
203        /// Date at which the user last accessed (whatever that might mean
204        /// the particular content described by this content item) this item.
205        ///
206        /// A typical use would be the date at which the user last played
207        /// the item, or played a subitem within the item (if this item
208        /// represents a group of items), for content types where "playing"
209        /// applies. This should not be when the user just looked at an item.
210        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
211        #[unsafe(method(lastAccessedDate))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn lastAccessedDate(&self) -> Option<Retained<NSDate>>;
214
215        /// Setter for [`lastAccessedDate`][Self::lastAccessedDate].
216        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
217        #[unsafe(method(setLastAccessedDate:))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn setLastAccessedDate(&self, last_accessed_date: Option<&NSDate>);
220
221        /// Date at which the user will no longer be able to access the item.
222        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
223        #[unsafe(method(expirationDate))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn expirationDate(&self) -> Option<Retained<NSDate>>;
226
227        /// Setter for [`expirationDate`][Self::expirationDate].
228        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
229        #[unsafe(method(setExpirationDate:))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn setExpirationDate(&self, expiration_date: Option<&NSDate>);
232
233        /// Date at which the content item was created, or was first
234        /// broadcast, or other such kind of origination date.
235        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
236        #[unsafe(method(creationDate))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;
239
240        /// Setter for [`creationDate`][Self::creationDate].
241        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
242        #[unsafe(method(setCreationDate:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn setCreationDate(&self, creation_date: Option<&NSDate>);
245
246        /// A badging integer for this item.
247        ///
248        /// The number is interpreted as a positive integer. Not all UI uses
249        /// of content items display badges.
250        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
251        #[unsafe(method(badgeCount))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn badgeCount(&self) -> Option<Retained<NSNumber>>;
254
255        /// Setter for [`badgeCount`][Self::badgeCount].
256        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
257        #[unsafe(method(setBadgeCount:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn setBadgeCount(&self, badge_count: Option<&NSNumber>);
260
261        /// The time length of this item.
262        ///
263        /// The number is interpreted as a double number of seconds.
264        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
265        #[unsafe(method(duration))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn duration(&self) -> Option<Retained<NSNumber>>;
268
269        /// Setter for [`duration`][Self::duration].
270        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
271        #[unsafe(method(setDuration:))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn setDuration(&self, duration: Option<&NSNumber>);
274
275        /// The last time index the user was at in playing this item.
276        ///
277        /// The number is interpreted as a double number of seconds.
278        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
279        #[unsafe(method(currentPosition))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn currentPosition(&self) -> Option<Retained<NSNumber>>;
282
283        /// Setter for [`currentPosition`][Self::currentPosition].
284        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
285        #[unsafe(method(setCurrentPosition:))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn setCurrentPosition(&self, current_position: Option<&NSNumber>);
288
289        /// A boolean indicating whether the user can be considered to have
290        /// finished this item.
291        ///
292        /// The number is interpreted as a boolean.
293        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
294        #[unsafe(method(hasPlayedToEnd))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn hasPlayedToEnd(&self) -> Option<Retained<NSNumber>>;
297
298        /// Setter for [`hasPlayedToEnd`][Self::hasPlayedToEnd].
299        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
300        #[unsafe(method(setHasPlayedToEnd:))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn setHasPlayedToEnd(&self, has_played_to_end: Option<&NSNumber>);
303
304        /// A URL for the system to open to cause the application (which
305        /// created this content item) to begin playing the item, at the
306        /// user's currentPosition.
307        ///
308        /// When opened (the app receives the UIApplication delegate method),
309        /// the application should proceed directly to playback without any
310        /// prompting for other information or confirmation panels or other
311        /// UI, if at all possible.
312        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
313        #[unsafe(method(playURL))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn playURL(&self) -> Option<Retained<NSURL>>;
316
317        /// Setter for [`playURL`][Self::playURL].
318        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
319        #[unsafe(method(setPlayURL:))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn setPlayURL(&self, play_url: Option<&NSURL>);
322
323        /// A URL for the system to open to cause the application (which
324        /// created this content item) to display a description screen
325        /// for the item.
326        ///
327        /// When opened (the app receives the UIApplication delegate method),
328        /// the application should proceed directly to displaying the
329        /// description of the item without any prompting for other information
330        /// or confirmation panels or other UI, if at all possible.
331        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
332        #[unsafe(method(displayURL))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn displayURL(&self) -> Option<Retained<NSURL>>;
335
336        /// Setter for [`displayURL`][Self::displayURL].
337        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
338        #[unsafe(method(setDisplayURL:))]
339        #[unsafe(method_family = none)]
340        pub unsafe fn setDisplayURL(&self, display_url: Option<&NSURL>);
341
342        /// An array of TVContentItems which are the items of a section.
343        ///
344        /// If non-nil, this item will be interpreted as a section item in
345        /// main menu Top Shelf usage contexts. The title property is the
346        /// other interesting property in that case, though other properties
347        /// of this item may be also interpreted by the system in the future.
348        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
349        #[unsafe(method(topShelfItems))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn topShelfItems(&self) -> Option<Retained<NSArray<TVContentItem>>>;
352
353        /// Setter for [`topShelfItems`][Self::topShelfItems].
354        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
355        #[unsafe(method(setTopShelfItems:))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn setTopShelfItems(&self, top_shelf_items: Option<&NSArray<TVContentItem>>);
358
359        #[cfg(feature = "TVContentIdentifier")]
360        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
361        #[unsafe(method(initWithContentIdentifier:))]
362        #[unsafe(method_family = init)]
363        pub unsafe fn initWithContentIdentifier(
364            this: Allocated<Self>,
365            ident: &TVContentIdentifier,
366        ) -> Retained<Self>;
367
368        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
369        #[unsafe(method(initWithCoder:))]
370        #[unsafe(method_family = init)]
371        pub unsafe fn initWithCoder(
372            this: Allocated<Self>,
373            coder: &NSCoder,
374        ) -> Option<Retained<Self>>;
375
376        #[deprecated = "TVContentItem has been replaced by TVTopShelfItem"]
377        #[unsafe(method(init))]
378        #[unsafe(method_family = init)]
379        pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;
380    );
381}
382
383/// Methods declared on superclass `NSObject`.
384impl TVContentItem {
385    extern_methods!(
386        #[unsafe(method(new))]
387        #[unsafe(method_family = new)]
388        pub unsafe fn new() -> Retained<Self>;
389    );
390}