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
//! 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::*;
/// A set of traits that allows the system to request variants of an image.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvtopshelfitemimagetraits?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TVTopShelfItemImageTraits(pub NSUInteger);
bitflags::bitflags! {
impl TVTopShelfItemImageTraits: NSUInteger {
/// Variant used when the device is running in 1x.
#[doc(alias = "TVTopShelfItemImageTraitScreenScale1x")]
const ScreenScale1x = 1<<0;
/// Variant used when the device is running in 2x.
#[doc(alias = "TVTopShelfItemImageTraitScreenScale2x")]
const ScreenScale2x = 2<<0;
}
}
unsafe impl Encode for TVTopShelfItemImageTraits {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for TVTopShelfItemImageTraits {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// The base class for describing Top Shelf content to the system.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvtopshelfitem?language=objc)
#[unsafe(super(TVTopShelfObject, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "TVTopShelfObject")]
pub struct TVTopShelfItem;
);
#[cfg(feature = "TVTopShelfObject")]
extern_conformance!(
unsafe impl NSObjectProtocol for TVTopShelfItem {}
);
#[cfg(feature = "TVTopShelfObject")]
impl TVTopShelfItem {
extern_methods!(
/// The item's unique identifier.
///
/// This identifier must be unique in the set of items you return to the system.
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub unsafe fn identifier(&self) -> Retained<NSString>;
#[cfg(feature = "TVTopShelfAction")]
/// The action performed when the user wants to play an item.
///
/// In sectioned and inset content styles this action is used when the user presses the play/pause button when the item is focused. In carousel content styles this is the first button shown to the user.
#[unsafe(method(playAction))]
#[unsafe(method_family = none)]
pub unsafe fn playAction(&self) -> Option<Retained<TVTopShelfAction>>;
#[cfg(feature = "TVTopShelfAction")]
/// Setter for [`playAction`][Self::playAction].
#[unsafe(method(setPlayAction:))]
#[unsafe(method_family = none)]
pub unsafe fn setPlayAction(&self, play_action: Option<&TVTopShelfAction>);
#[cfg(feature = "TVTopShelfAction")]
/// The action performed when the user wants to see more information about an item.
///
/// In sectioned and inset content styles this action is used when the user selects the item. In carousel content styles this is the second button shown to the user.
#[unsafe(method(displayAction))]
#[unsafe(method_family = none)]
pub unsafe fn displayAction(&self) -> Option<Retained<TVTopShelfAction>>;
#[cfg(feature = "TVTopShelfAction")]
/// Setter for [`displayAction`][Self::displayAction].
#[unsafe(method(setDisplayAction:))]
#[unsafe(method_family = none)]
pub unsafe fn setDisplayAction(&self, display_action: Option<&TVTopShelfAction>);
/// The date when the user will no longer be able to access the item.
#[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.
#[unsafe(method(setExpirationDate:))]
#[unsafe(method_family = none)]
pub unsafe fn setExpirationDate(&self, expiration_date: Option<&NSDate>);
/// Set an image URL for the given combination of traits.
///
/// In sectioned and inset content styles this is the image displayed for the item. In carousel content styles this image is displayed before the preview video.
#[unsafe(method(setImageURL:forTraits:))]
#[unsafe(method_family = none)]
pub unsafe fn setImageURL_forTraits(
&self,
image_url: Option<&NSURL>,
traits: TVTopShelfItemImageTraits,
);
/// Get the image URL for the given combination of traits.
///
/// In sectioned and inset content styles this is the image displayed for the item. In carousel content styles this image is displayed before the preview video.
#[unsafe(method(imageURLForTraits:))]
#[unsafe(method_family = none)]
pub unsafe fn imageURLForTraits(
&self,
traits: TVTopShelfItemImageTraits,
) -> Option<Retained<NSURL>>;
/// Create an item with a unique identifier.
///
/// This identifier must be unique in the set of items you return to the system.
#[unsafe(method(initWithIdentifier:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithIdentifier(
this: Allocated<Self>,
identifier: &NSString,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `TVTopShelfObject`.
#[cfg(feature = "TVTopShelfObject")]
impl TVTopShelfItem {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}