objc2_tv_services/generated/
TVTopShelfCarouselItem.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/// Options for describing media capabilities supported by a movie or show.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvtopshelfcarouselitemmediaoptions?language=objc)
13// NS_OPTIONS
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct TVTopShelfCarouselItemMediaOptions(pub NSUInteger);
17bitflags::bitflags! {
18    impl TVTopShelfCarouselItemMediaOptions: NSUInteger {
19/// High-definition video resolution.
20///
21/// Only one resolution value should be provided.
22        #[doc(alias = "TVTopShelfCarouselItemVideoResolutionHD")]
23        const VideoResolutionHD = 1<<0;
24/// Ultra-high-definition 4K video resolution.
25///
26/// Only one resolution value should be provided.
27        #[doc(alias = "TVTopShelfCarouselItemVideoResolution4K")]
28        const VideoResolution4K = 2<<0;
29/// High-dynamic-range video.
30///
31/// Only one color space value should be provided.
32        #[doc(alias = "TVTopShelfCarouselItemVideoColorSpaceHDR")]
33        const VideoColorSpaceHDR = 1<<6;
34/// Dolby Vision video.
35///
36/// Only one color space value should be provided.
37        #[doc(alias = "TVTopShelfCarouselItemVideoColorSpaceDolbyVision")]
38        const VideoColorSpaceDolbyVision = 2<<6;
39/// Whether the movie or show supports Dolby Atmos audio.
40        #[doc(alias = "TVTopShelfCarouselItemAudioDolbyAtmos")]
41        const AudioDolbyAtmos = 1<<12;
42/// Whether the movie or show supports closed captioning.
43        #[doc(alias = "TVTopShelfCarouselItemAudioTranscriptionClosedCaptioning")]
44        const AudioTranscriptionClosedCaptioning = 1<<13;
45/// Whether the movie or show supports subtitles for the deaf and hard-of-hearing.
46        #[doc(alias = "TVTopShelfCarouselItemAudioTranscriptionSDH")]
47        const AudioTranscriptionSDH = 1<<14;
48/// Whether the movie or show supports audio descriptions.
49        #[doc(alias = "TVTopShelfCarouselItemAudioDescription")]
50        const AudioDescription = 1<<15;
51    }
52}
53
54unsafe impl Encode for TVTopShelfCarouselItemMediaOptions {
55    const ENCODING: Encoding = NSUInteger::ENCODING;
56}
57
58unsafe impl RefEncode for TVTopShelfCarouselItemMediaOptions {
59    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
60}
61
62extern_class!(
63    /// An object that represents a single item in the carousel content style.
64    ///
65    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvtopshelfcarouselitem?language=objc)
66    #[unsafe(super(TVTopShelfItem, TVTopShelfObject, NSObject))]
67    #[derive(Debug, PartialEq, Eq, Hash)]
68    #[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
69    pub struct TVTopShelfCarouselItem;
70);
71
72#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
73extern_conformance!(
74    unsafe impl NSObjectProtocol for TVTopShelfCarouselItem {}
75);
76
77#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
78impl TVTopShelfCarouselItem {
79    extern_methods!(
80        /// A localized string that describes why this item is being shown in the Top Shelf.
81        #[unsafe(method(contextTitle))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn contextTitle(&self) -> Option<Retained<NSString>>;
84
85        /// Setter for [`contextTitle`][Self::contextTitle].
86        #[unsafe(method(setContextTitle:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setContextTitle(&self, context_title: Option<&NSString>);
89
90        /// A descriptive summary of the movie or show.
91        #[unsafe(method(summary))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn summary(&self) -> Option<Retained<NSString>>;
94
95        /// Setter for [`summary`][Self::summary].
96        #[unsafe(method(setSummary:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setSummary(&self, summary: Option<&NSString>);
99
100        /// The genre of the movie or show.
101        #[unsafe(method(genre))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn genre(&self) -> Option<Retained<NSString>>;
104
105        /// Setter for [`genre`][Self::genre].
106        #[unsafe(method(setGenre:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn setGenre(&self, genre: Option<&NSString>);
109
110        /// The length of the movie or show.
111        #[unsafe(method(duration))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn duration(&self) -> NSTimeInterval;
114
115        /// Setter for [`duration`][Self::duration].
116        #[unsafe(method(setDuration:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setDuration(&self, duration: NSTimeInterval);
119
120        /// The date this item was created or released.
121        #[unsafe(method(creationDate))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;
124
125        /// Setter for [`creationDate`][Self::creationDate].
126        #[unsafe(method(setCreationDate:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setCreationDate(&self, creation_date: Option<&NSDate>);
129
130        /// The media options supported by the movie or show.
131        ///
132        /// Values provided here are used to show media capability badges in the Top Shelf UI.
133        #[unsafe(method(mediaOptions))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn mediaOptions(&self) -> TVTopShelfCarouselItemMediaOptions;
136
137        /// Setter for [`mediaOptions`][Self::mediaOptions].
138        #[unsafe(method(setMediaOptions:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setMediaOptions(&self, media_options: TVTopShelfCarouselItemMediaOptions);
141
142        /// The trailer for the movie or show.
143        ///
144        /// If provided this video is played after the image or cinemagraph when the user rests on the item.
145        #[unsafe(method(previewVideoURL))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn previewVideoURL(&self) -> Option<Retained<NSURL>>;
148
149        /// Setter for [`previewVideoURL`][Self::previewVideoURL].
150        #[unsafe(method(setPreviewVideoURL:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setPreviewVideoURL(&self, preview_video_url: Option<&NSURL>);
153
154        /// A looping video shown before the preview video instead of the image.
155        ///
156        /// If provided this video takes the place of the image. It will loop without sound until the preview video is ready to play.
157        #[unsafe(method(cinemagraphURL))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn cinemagraphURL(&self) -> Option<Retained<NSURL>>;
160
161        /// Setter for [`cinemagraphURL`][Self::cinemagraphURL].
162        #[unsafe(method(setCinemagraphURL:))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn setCinemagraphURL(&self, cinemagraph_url: Option<&NSURL>);
165
166        #[cfg(feature = "TVTopShelfNamedAttribute")]
167        /// A collection of up to 4 named attributes displayed by the Top Shelf UI in a stylized manner.
168        #[unsafe(method(namedAttributes))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn namedAttributes(&self) -> Retained<NSArray<TVTopShelfNamedAttribute>>;
171
172        #[cfg(feature = "TVTopShelfNamedAttribute")]
173        /// Setter for [`namedAttributes`][Self::namedAttributes].
174        #[unsafe(method(setNamedAttributes:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setNamedAttributes(
177            &self,
178            named_attributes: &NSArray<TVTopShelfNamedAttribute>,
179        );
180    );
181}
182
183/// Methods declared on superclass `TVTopShelfItem`.
184#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
185impl TVTopShelfCarouselItem {
186    extern_methods!(
187        /// Create an item with a unique identifier.
188        ///
189        /// This identifier must be unique in the set of items you return to the system.
190        #[unsafe(method(initWithIdentifier:))]
191        #[unsafe(method_family = init)]
192        pub unsafe fn initWithIdentifier(
193            this: Allocated<Self>,
194            identifier: &NSString,
195        ) -> Retained<Self>;
196    );
197}
198
199/// Methods declared on superclass `TVTopShelfObject`.
200#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
201impl TVTopShelfCarouselItem {
202    extern_methods!(
203        #[unsafe(method(init))]
204        #[unsafe(method_family = init)]
205        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
206
207        #[unsafe(method(new))]
208        #[unsafe(method_family = new)]
209        pub unsafe fn new() -> Retained<Self>;
210    );
211}