objc2_tv_ml_kit/generated/
TVViewElement.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/// [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvelementeventtype?language=objc)
11// NS_ENUM
12#[deprecated = "Please use SwiftUI or UIKit"]
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct TVElementEventType(pub NSInteger);
16impl TVElementEventType {
17    #[doc(alias = "TVElementEventTypePlay")]
18    #[deprecated = "Please use SwiftUI or UIKit"]
19    pub const Play: Self = Self(1);
20    #[doc(alias = "TVElementEventTypeSelect")]
21    #[deprecated = "Please use SwiftUI or UIKit"]
22    pub const Select: Self = Self(2);
23    #[doc(alias = "TVElementEventTypeHoldSelect")]
24    #[deprecated = "Please use SwiftUI or UIKit"]
25    pub const HoldSelect: Self = Self(3);
26    #[doc(alias = "TVElementEventTypeHighlight")]
27    #[deprecated = "Please use SwiftUI or UIKit"]
28    pub const Highlight: Self = Self(4);
29    #[doc(alias = "TVElementEventTypeChange")]
30    #[deprecated = "Please use SwiftUI or UIKit"]
31    pub const Change: Self = Self(5);
32}
33
34unsafe impl Encode for TVElementEventType {
35    const ENCODING: Encoding = NSInteger::ENCODING;
36}
37
38unsafe impl RefEncode for TVElementEventType {
39    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
40}
41
42/// [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvelementupdatetype?language=objc)
43// NS_ENUM
44#[deprecated = "Please use SwiftUI or UIKit"]
45#[repr(transparent)]
46#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
47pub struct TVElementUpdateType(pub NSInteger);
48impl TVElementUpdateType {
49    #[doc(alias = "TVElementUpdateTypeNone")]
50    #[deprecated = "Please use SwiftUI or UIKit"]
51    pub const None: Self = Self(0);
52    /// Signifies that one of the elements in the subtree is updated without
53    /// affecting the order of immediate children.
54    #[doc(alias = "TVElementUpdateTypeSubtree")]
55    #[deprecated = "Please use SwiftUI or UIKit"]
56    pub const Subtree: Self = Self(1);
57    /// Signifies that style property on view elements could have changed as
58    /// a result of reevaluating media queries.
59    #[doc(alias = "TVElementUpdateTypeStyles")]
60    #[deprecated = "Please use SwiftUI or UIKit"]
61    pub const Styles: Self = Self(2);
62    /// Signifies that the order of children is updated due to addition,
63    /// removal or replacement of child nodes.
64    #[doc(alias = "TVElementUpdateTypeChildren")]
65    #[deprecated = "Please use SwiftUI or UIKit"]
66    pub const Children: Self = Self(3);
67    /// Signifies that the node itself and its subtree is modified.
68    #[doc(alias = "TVElementUpdateTypeSelf")]
69    #[deprecated = "Please use SwiftUI or UIKit"]
70    pub const Node: Self = Self(4);
71}
72
73unsafe impl Encode for TVElementUpdateType {
74    const ENCODING: Encoding = NSInteger::ENCODING;
75}
76
77unsafe impl RefEncode for TVElementUpdateType {
78    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
79}
80
81/// Properties of TVViewElement that can be reset by the client to their
82/// default values. These properties communicate a message from the DOM, as opposed to
83/// define the model, which the client should reset after their values have been
84/// read.
85///
86/// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvelementresettableproperty?language=objc)
87// NS_ENUM
88#[deprecated = "Please use SwiftUI or UIKit"]
89#[repr(transparent)]
90#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
91pub struct TVElementResettableProperty(pub NSInteger);
92impl TVElementResettableProperty {
93    /// Maps to updateType property.
94    #[doc(alias = "TVElementResettablePropertyUpdateType")]
95    #[deprecated = "Please use SwiftUI or UIKit"]
96    pub const UpdateType: Self = Self(0);
97    /// Maps to autoHighlightIdentifier.
98    #[doc(alias = "TVElementResettablePropertyAutoHighlightIdentifier")]
99    #[deprecated = "Please use SwiftUI or UIKit"]
100    pub const AutoHighlightIdentifier: Self = Self(1);
101}
102
103unsafe impl Encode for TVElementResettableProperty {
104    const ENCODING: Encoding = NSInteger::ENCODING;
105}
106
107unsafe impl RefEncode for TVElementResettableProperty {
108    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
109}
110
111extern_class!(
112    /// TVViewElement represents a read only DOM node along with it's
113    /// attributes and aggregated style. This model object is traversed
114    /// by the factory to construct view/view controllers, to render templates.
115    /// View/View controllers should use the avaliable dispatch API's to
116    /// send user events to JavaScript.
117    ///
118    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvviewelement?language=objc)
119    #[unsafe(super(NSObject))]
120    #[derive(Debug, PartialEq, Eq, Hash)]
121    #[deprecated = "Please use SwiftUI or UIKit"]
122    pub struct TVViewElement;
123);
124
125extern_conformance!(
126    unsafe impl NSCopying for TVViewElement {}
127);
128
129unsafe impl CopyingHelper for TVViewElement {
130    type Result = Self;
131}
132
133extern_conformance!(
134    unsafe impl NSObjectProtocol for TVViewElement {}
135);
136
137impl TVViewElement {
138    extern_methods!(
139        #[deprecated = "Please use SwiftUI or UIKit"]
140        #[unsafe(method(elementIdentifier))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn elementIdentifier(&self) -> Retained<NSString>;
143
144        #[deprecated = "Please use SwiftUI or UIKit"]
145        #[unsafe(method(elementName))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn elementName(&self) -> Retained<NSString>;
148
149        #[deprecated = "Please use SwiftUI or UIKit"]
150        #[unsafe(method(parentViewElement))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn parentViewElement(&self) -> Option<Retained<TVViewElement>>;
153
154        #[deprecated = "Please use SwiftUI or UIKit"]
155        #[unsafe(method(childViewElements))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn childViewElements(&self) -> Option<Retained<NSArray<TVViewElement>>>;
158
159        #[deprecated = "Please use SwiftUI or UIKit"]
160        #[unsafe(method(attributes))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn attributes(&self) -> Option<Retained<NSDictionary<NSString, NSString>>>;
163
164        #[cfg(feature = "TVViewElementStyle")]
165        #[deprecated = "Please use SwiftUI or UIKit"]
166        #[unsafe(method(style))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn style(&self) -> Option<Retained<TVViewElementStyle>>;
169
170        #[deprecated = "Please use SwiftUI or UIKit"]
171        #[unsafe(method(autoHighlightIdentifier))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn autoHighlightIdentifier(&self) -> Option<Retained<NSString>>;
174
175        #[deprecated = "Please use SwiftUI or UIKit"]
176        #[unsafe(method(isDisabled))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn isDisabled(&self) -> bool;
179
180        /// Setter for [`isDisabled`][Self::isDisabled].
181        #[deprecated = "Please use SwiftUI or UIKit"]
182        #[unsafe(method(setDisabled:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn setDisabled(&self, disabled: bool);
185
186        #[deprecated = "Please use SwiftUI or UIKit"]
187        #[unsafe(method(updateType))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn updateType(&self) -> TVElementUpdateType;
190
191        #[deprecated = "Please use SwiftUI or UIKit"]
192        #[unsafe(method(elementData))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn elementData(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
195
196        /// Resets the property to its default value. This API can be used to reset
197        /// a resettable property to its default value after the changes have been read.
198        #[deprecated = "Please use SwiftUI or UIKit"]
199        #[unsafe(method(resetProperty:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn resetProperty(&self, resettable_property: TVElementResettableProperty);
202
203        #[cfg(feature = "block2")]
204        /// # Safety
205        ///
206        /// `extra_info` generic should be of the correct type.
207        #[deprecated = "Please use SwiftUI or UIKit"]
208        #[unsafe(method(dispatchEventOfType:canBubble:cancellable:extraInfo:completion:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn dispatchEventOfType_canBubble_cancellable_extraInfo_completion(
211            &self,
212            r#type: TVElementEventType,
213            can_bubble: bool,
214            is_cancellable: bool,
215            extra_info: Option<&NSDictionary<NSString, AnyObject>>,
216            completion: Option<&block2::DynBlock<dyn Fn(Bool, Bool)>>,
217        );
218
219        #[cfg(feature = "block2")]
220        /// # Safety
221        ///
222        /// `extra_info` generic should be of the correct type.
223        #[deprecated = "Please use SwiftUI or UIKit"]
224        #[unsafe(method(dispatchEventWithName:canBubble:cancellable:extraInfo:completion:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn dispatchEventWithName_canBubble_cancellable_extraInfo_completion(
227            &self,
228            event_name: &NSString,
229            can_bubble: bool,
230            is_cancellable: bool,
231            extra_info: Option<&NSDictionary<NSString, AnyObject>>,
232            completion: Option<&block2::DynBlock<dyn Fn(Bool, Bool)>>,
233        );
234    );
235}
236
237/// Methods declared on superclass `NSObject`.
238impl TVViewElement {
239    extern_methods!(
240        #[unsafe(method(init))]
241        #[unsafe(method_family = init)]
242        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
243
244        #[unsafe(method(new))]
245        #[unsafe(method_family = new)]
246        pub unsafe fn new() -> Retained<Self>;
247    );
248}