objc2-tv-ml-kit 0.3.2

Bindings to the TVMLKit framework
Documentation
//! 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvelementeventtype?language=objc)
// NS_ENUM
#[deprecated = "Please use SwiftUI or UIKit"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TVElementEventType(pub NSInteger);
impl TVElementEventType {
    #[doc(alias = "TVElementEventTypePlay")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Play: Self = Self(1);
    #[doc(alias = "TVElementEventTypeSelect")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Select: Self = Self(2);
    #[doc(alias = "TVElementEventTypeHoldSelect")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const HoldSelect: Self = Self(3);
    #[doc(alias = "TVElementEventTypeHighlight")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Highlight: Self = Self(4);
    #[doc(alias = "TVElementEventTypeChange")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Change: Self = Self(5);
}

unsafe impl Encode for TVElementEventType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for TVElementEventType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvelementupdatetype?language=objc)
// NS_ENUM
#[deprecated = "Please use SwiftUI or UIKit"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TVElementUpdateType(pub NSInteger);
impl TVElementUpdateType {
    #[doc(alias = "TVElementUpdateTypeNone")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const None: Self = Self(0);
    /// Signifies that one of the elements in the subtree is updated without
    /// affecting the order of immediate children.
    #[doc(alias = "TVElementUpdateTypeSubtree")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Subtree: Self = Self(1);
    /// Signifies that style property on view elements could have changed as
    /// a result of reevaluating media queries.
    #[doc(alias = "TVElementUpdateTypeStyles")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Styles: Self = Self(2);
    /// Signifies that the order of children is updated due to addition,
    /// removal or replacement of child nodes.
    #[doc(alias = "TVElementUpdateTypeChildren")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Children: Self = Self(3);
    /// Signifies that the node itself and its subtree is modified.
    #[doc(alias = "TVElementUpdateTypeSelf")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Node: Self = Self(4);
}

unsafe impl Encode for TVElementUpdateType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for TVElementUpdateType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// Properties of TVViewElement that can be reset by the client to their
/// default values. These properties communicate a message from the DOM, as opposed to
/// define the model, which the client should reset after their values have been
/// read.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvelementresettableproperty?language=objc)
// NS_ENUM
#[deprecated = "Please use SwiftUI or UIKit"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TVElementResettableProperty(pub NSInteger);
impl TVElementResettableProperty {
    /// Maps to updateType property.
    #[doc(alias = "TVElementResettablePropertyUpdateType")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const UpdateType: Self = Self(0);
    /// Maps to autoHighlightIdentifier.
    #[doc(alias = "TVElementResettablePropertyAutoHighlightIdentifier")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const AutoHighlightIdentifier: Self = Self(1);
}

unsafe impl Encode for TVElementResettableProperty {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for TVElementResettableProperty {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// TVViewElement represents a read only DOM node along with it's
    /// attributes and aggregated style. This model object is traversed
    /// by the factory to construct view/view controllers, to render templates.
    /// View/View controllers should use the avaliable dispatch API's to
    /// send user events to JavaScript.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvviewelement?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub struct TVViewElement;
);

extern_conformance!(
    unsafe impl NSCopying for TVViewElement {}
);

unsafe impl CopyingHelper for TVViewElement {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for TVViewElement {}
);

impl TVViewElement {
    extern_methods!(
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(elementIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn elementIdentifier(&self) -> Retained<NSString>;

        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(elementName))]
        #[unsafe(method_family = none)]
        pub unsafe fn elementName(&self) -> Retained<NSString>;

        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(parentViewElement))]
        #[unsafe(method_family = none)]
        pub unsafe fn parentViewElement(&self) -> Option<Retained<TVViewElement>>;

        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(childViewElements))]
        #[unsafe(method_family = none)]
        pub unsafe fn childViewElements(&self) -> Option<Retained<NSArray<TVViewElement>>>;

        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(attributes))]
        #[unsafe(method_family = none)]
        pub unsafe fn attributes(&self) -> Option<Retained<NSDictionary<NSString, NSString>>>;

        #[cfg(feature = "TVViewElementStyle")]
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(style))]
        #[unsafe(method_family = none)]
        pub unsafe fn style(&self) -> Option<Retained<TVViewElementStyle>>;

        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(autoHighlightIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn autoHighlightIdentifier(&self) -> Option<Retained<NSString>>;

        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(isDisabled))]
        #[unsafe(method_family = none)]
        pub unsafe fn isDisabled(&self) -> bool;

        /// Setter for [`isDisabled`][Self::isDisabled].
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(setDisabled:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDisabled(&self, disabled: bool);

        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(updateType))]
        #[unsafe(method_family = none)]
        pub unsafe fn updateType(&self) -> TVElementUpdateType;

        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(elementData))]
        #[unsafe(method_family = none)]
        pub unsafe fn elementData(&self) -> Retained<NSDictionary<NSString, AnyObject>>;

        /// Resets the property to its default value. This API can be used to reset
        /// a resettable property to its default value after the changes have been read.
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(resetProperty:))]
        #[unsafe(method_family = none)]
        pub unsafe fn resetProperty(&self, resettable_property: TVElementResettableProperty);

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `extra_info` generic should be of the correct type.
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(dispatchEventOfType:canBubble:cancellable:extraInfo:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dispatchEventOfType_canBubble_cancellable_extraInfo_completion(
            &self,
            r#type: TVElementEventType,
            can_bubble: bool,
            is_cancellable: bool,
            extra_info: Option<&NSDictionary<NSString, AnyObject>>,
            completion: Option<&block2::DynBlock<dyn Fn(Bool, Bool)>>,
        );

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `extra_info` generic should be of the correct type.
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(dispatchEventWithName:canBubble:cancellable:extraInfo:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dispatchEventWithName_canBubble_cancellable_extraInfo_completion(
            &self,
            event_name: &NSString,
            can_bubble: bool,
            is_cancellable: bool,
            extra_info: Option<&NSDictionary<NSString, AnyObject>>,
            completion: Option<&block2::DynBlock<dyn Fn(Bool, Bool)>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl TVViewElement {
    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>;
    );
}