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        ///
87        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
88        #[unsafe(method(setContextTitle:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setContextTitle(&self, context_title: Option<&NSString>);
91
92        /// A descriptive summary of the movie or show.
93        #[unsafe(method(summary))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn summary(&self) -> Option<Retained<NSString>>;
96
97        /// Setter for [`summary`][Self::summary].
98        ///
99        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
100        #[unsafe(method(setSummary:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setSummary(&self, summary: Option<&NSString>);
103
104        /// The genre of the movie or show.
105        #[unsafe(method(genre))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn genre(&self) -> Option<Retained<NSString>>;
108
109        /// Setter for [`genre`][Self::genre].
110        ///
111        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
112        #[unsafe(method(setGenre:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setGenre(&self, genre: Option<&NSString>);
115
116        /// The length of the movie or show.
117        #[unsafe(method(duration))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn duration(&self) -> NSTimeInterval;
120
121        /// Setter for [`duration`][Self::duration].
122        #[unsafe(method(setDuration:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setDuration(&self, duration: NSTimeInterval);
125
126        /// The date this item was created or released.
127        #[unsafe(method(creationDate))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;
130
131        /// Setter for [`creationDate`][Self::creationDate].
132        ///
133        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
134        #[unsafe(method(setCreationDate:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setCreationDate(&self, creation_date: Option<&NSDate>);
137
138        /// The media options supported by the movie or show.
139        ///
140        /// Values provided here are used to show media capability badges in the Top Shelf UI.
141        #[unsafe(method(mediaOptions))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn mediaOptions(&self) -> TVTopShelfCarouselItemMediaOptions;
144
145        /// Setter for [`mediaOptions`][Self::mediaOptions].
146        #[unsafe(method(setMediaOptions:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setMediaOptions(&self, media_options: TVTopShelfCarouselItemMediaOptions);
149
150        /// The trailer for the movie or show.
151        ///
152        /// If provided this video is played after the image or cinemagraph when the user rests on the item.
153        #[unsafe(method(previewVideoURL))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn previewVideoURL(&self) -> Option<Retained<NSURL>>;
156
157        /// Setter for [`previewVideoURL`][Self::previewVideoURL].
158        ///
159        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
160        #[unsafe(method(setPreviewVideoURL:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn setPreviewVideoURL(&self, preview_video_url: Option<&NSURL>);
163
164        /// A looping video shown before the preview video instead of the image.
165        ///
166        /// If provided this video takes the place of the image. It will loop without sound until the preview video is ready to play.
167        #[unsafe(method(cinemagraphURL))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn cinemagraphURL(&self) -> Option<Retained<NSURL>>;
170
171        /// Setter for [`cinemagraphURL`][Self::cinemagraphURL].
172        ///
173        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
174        #[unsafe(method(setCinemagraphURL:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setCinemagraphURL(&self, cinemagraph_url: Option<&NSURL>);
177
178        #[cfg(feature = "TVTopShelfNamedAttribute")]
179        /// A collection of up to 4 named attributes displayed by the Top Shelf UI in a stylized manner.
180        #[unsafe(method(namedAttributes))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn namedAttributes(&self) -> Retained<NSArray<TVTopShelfNamedAttribute>>;
183
184        #[cfg(feature = "TVTopShelfNamedAttribute")]
185        /// Setter for [`namedAttributes`][Self::namedAttributes].
186        ///
187        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
188        #[unsafe(method(setNamedAttributes:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setNamedAttributes(
191            &self,
192            named_attributes: &NSArray<TVTopShelfNamedAttribute>,
193        );
194    );
195}
196
197/// Methods declared on superclass `TVTopShelfItem`.
198#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
199impl TVTopShelfCarouselItem {
200    extern_methods!(
201        /// Create an item with a unique identifier.
202        ///
203        /// This identifier must be unique in the set of items you return to the system.
204        #[unsafe(method(initWithIdentifier:))]
205        #[unsafe(method_family = init)]
206        pub unsafe fn initWithIdentifier(
207            this: Allocated<Self>,
208            identifier: &NSString,
209        ) -> Retained<Self>;
210    );
211}
212
213/// Methods declared on superclass `TVTopShelfObject`.
214#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
215impl TVTopShelfCarouselItem {
216    extern_methods!(
217        #[unsafe(method(init))]
218        #[unsafe(method_family = init)]
219        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
220
221        #[unsafe(method(new))]
222        #[unsafe(method_family = new)]
223        pub unsafe fn new() -> Retained<Self>;
224    );
225}