objc2_tv_services/generated/
TVTopShelfSectionedItem.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/// The shape of an image in the sectioned content style.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvtopshelfsectioneditemimageshape?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct TVTopShelfSectionedItemImageShape(pub NSInteger);
17impl TVTopShelfSectionedItemImageShape {
18    /// A 1:1 image.
19    #[doc(alias = "TVTopShelfSectionedItemImageShapeSquare")]
20    pub const Square: Self = Self(0);
21    /// A 2:3 poster image.
22    #[doc(alias = "TVTopShelfSectionedItemImageShapePoster")]
23    pub const Poster: Self = Self(1);
24    /// A 16:9 image.
25    #[doc(alias = "TVTopShelfSectionedItemImageShapeHDTV")]
26    pub const HDTV: Self = Self(2);
27}
28
29unsafe impl Encode for TVTopShelfSectionedItemImageShape {
30    const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for TVTopShelfSectionedItemImageShape {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37extern_class!(
38    /// An object that represents a single item in the sectioned content style.
39    ///
40    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvservices/tvtopshelfsectioneditem?language=objc)
41    #[unsafe(super(TVTopShelfItem, TVTopShelfObject, NSObject))]
42    #[derive(Debug, PartialEq, Eq, Hash)]
43    #[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
44    pub struct TVTopShelfSectionedItem;
45);
46
47#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
48extern_conformance!(
49    unsafe impl NSObjectProtocol for TVTopShelfSectionedItem {}
50);
51
52#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
53impl TVTopShelfSectionedItem {
54    extern_methods!(
55        /// The shape of the item's image.
56        ///
57        /// The default value is `.square`.
58        #[unsafe(method(imageShape))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn imageShape(&self) -> TVTopShelfSectionedItemImageShape;
61
62        /// Setter for [`imageShape`][Self::imageShape].
63        #[unsafe(method(setImageShape:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn setImageShape(&self, image_shape: TVTopShelfSectionedItemImageShape);
66
67        /// How far into the item the user has played.
68        ///
69        /// Must be a number in the range `0...1`.
70        #[unsafe(method(playbackProgress))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn playbackProgress(&self) -> c_double;
73
74        /// Setter for [`playbackProgress`][Self::playbackProgress].
75        #[unsafe(method(setPlaybackProgress:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn setPlaybackProgress(&self, playback_progress: c_double);
78    );
79}
80
81/// Methods declared on superclass `TVTopShelfItem`.
82#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
83impl TVTopShelfSectionedItem {
84    extern_methods!(
85        /// Create an item with a unique identifier.
86        ///
87        /// This identifier must be unique in the set of items you return to the system.
88        #[unsafe(method(initWithIdentifier:))]
89        #[unsafe(method_family = init)]
90        pub unsafe fn initWithIdentifier(
91            this: Allocated<Self>,
92            identifier: &NSString,
93        ) -> Retained<Self>;
94    );
95}
96
97/// Methods declared on superclass `TVTopShelfObject`.
98#[cfg(all(feature = "TVTopShelfItem", feature = "TVTopShelfObject"))]
99impl TVTopShelfSectionedItem {
100    extern_methods!(
101        #[unsafe(method(init))]
102        #[unsafe(method_family = init)]
103        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
104
105        #[unsafe(method(new))]
106        #[unsafe(method_family = new)]
107        pub unsafe fn new() -> Retained<Self>;
108    );
109}