objc2-sprite-kit 0.3.2

Bindings to the SpriteKit 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::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-av-foundation")]
use objc2_av_foundation::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/skvideonode?language=objc)
    #[unsafe(super(SKNode, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
    #[cfg(target_os = "macos")]
    pub struct SKVideoNode;
);

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for SKVideoNode {}
);

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCopying for SKVideoNode {}
);

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
unsafe impl CopyingHelper for SKVideoNode {
    type Result = Self;
}

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for SKVideoNode {}
);

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSSecureCoding for SKVideoNode {}
);

#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl SKVideoNode {
    extern_methods!(
        #[cfg(feature = "objc2-av-foundation")]
        /// Create a video node from an AVPlayer. You can use the AVPlayer to control playback.
        #[unsafe(method(videoNodeWithAVPlayer:))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoNodeWithAVPlayer(
            player: &AVPlayer,
            mtm: MainThreadMarker,
        ) -> Retained<SKVideoNode>;

        /// Create a video node from a file.
        #[deprecated]
        #[unsafe(method(videoNodeWithVideoFileNamed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoNodeWithVideoFileNamed(
            video_file: &NSString,
            mtm: MainThreadMarker,
        ) -> Retained<SKVideoNode>;

        #[unsafe(method(videoNodeWithFileNamed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoNodeWithFileNamed(
            video_file: &NSString,
            mtm: MainThreadMarker,
        ) -> Retained<SKVideoNode>;

        /// Create a video node from a URL.
        #[deprecated]
        #[unsafe(method(videoNodeWithVideoURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoNodeWithVideoURL(
            video_url: &NSURL,
            mtm: MainThreadMarker,
        ) -> Retained<SKVideoNode>;

        #[unsafe(method(videoNodeWithURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoNodeWithURL(
            video_url: &NSURL,
            mtm: MainThreadMarker,
        ) -> Retained<SKVideoNode>;

        #[cfg(feature = "objc2-av-foundation")]
        /// Designated Initializer.
        ///
        /// Initialize a video node from an AVPlayer. You can use the AVPlayer to control playback.
        #[unsafe(method(initWithAVPlayer:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAVPlayer(this: Allocated<Self>, player: &AVPlayer) -> Retained<Self>;

        /// Initialize a video node from a file.
        #[deprecated]
        #[unsafe(method(initWithVideoFileNamed:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithVideoFileNamed(
            this: Allocated<Self>,
            video_file: &NSString,
        ) -> Retained<Self>;

        #[unsafe(method(initWithFileNamed:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFileNamed(
            this: Allocated<Self>,
            video_file: &NSString,
        ) -> Retained<Self>;

        #[deprecated]
        #[unsafe(method(initWithVideoURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithVideoURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;

        #[unsafe(method(initWithURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;

        /// Support coding and decoding via NSKeyedArchiver.
        ///
        /// # Safety
        ///
        /// `a_decoder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            a_decoder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(play))]
        #[unsafe(method_family = none)]
        pub unsafe fn play(&self);

        #[unsafe(method(pause))]
        #[unsafe(method_family = none)]
        pub unsafe fn pause(&self);

        #[cfg(feature = "objc2-core-foundation")]
        /// The display size of the video (in parent's coordinate space)
        #[unsafe(method(size))]
        #[unsafe(method_family = none)]
        pub unsafe fn size(&self) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`size`][Self::size].
        #[unsafe(method(setSize:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSize(&self, size: CGSize);

        #[cfg(feature = "objc2-core-foundation")]
        /// The location in the video that maps to its 'position' in the parent's coordinate space. (0.0-1.0)
        #[unsafe(method(anchorPoint))]
        #[unsafe(method_family = none)]
        pub unsafe fn anchorPoint(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`anchorPoint`][Self::anchorPoint].
        #[unsafe(method(setAnchorPoint:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAnchorPoint(&self, anchor_point: CGPoint);
    );
}

/// Methods declared on superclass `SKNode`.
#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl SKVideoNode {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(node))]
        #[unsafe(method_family = none)]
        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;

        #[unsafe(method(nodeWithFileNamed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn nodeWithFileNamed(
            filename: &NSString,
            mtm: MainThreadMarker,
        ) -> Option<Retained<Self>>;

        /// # Safety
        ///
        /// `classes` generic probably has further requirements.
        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
            filename: &NSString,
            classes: &NSSet<AnyClass>,
            mtm: MainThreadMarker,
        ) -> Result<Retained<Self>, Retained<NSError>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "SKNode", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
impl SKVideoNode {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}