objc2-watch-kit 0.3.2

Bindings to the WatchKit 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/watchkit/wkaudiofileplayerstatus?language=objc)
// NS_ENUM
#[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKAudioFilePlayerStatus(pub NSInteger);
impl WKAudioFilePlayerStatus {
    #[doc(alias = "WKAudioFilePlayerStatusUnknown")]
    #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
    pub const Unknown: Self = Self(0);
    #[doc(alias = "WKAudioFilePlayerStatusReadyToPlay")]
    #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
    pub const ReadyToPlay: Self = Self(1);
    #[doc(alias = "WKAudioFilePlayerStatusFailed")]
    #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
    pub const Failed: Self = Self(2);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkaudiofileplayer?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
    pub struct WKAudioFilePlayer;
);

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

impl WKAudioFilePlayer {
    extern_methods!(
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "WKAudioFilePlayerItem")]
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(playerWithPlayerItem:))]
        #[unsafe(method_family = none)]
        pub unsafe fn playerWithPlayerItem(item: &WKAudioFilePlayerItem) -> Retained<Self>;

        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(play))]
        #[unsafe(method_family = none)]
        pub unsafe fn play(&self);

        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(pause))]
        #[unsafe(method_family = none)]
        pub unsafe fn pause(&self);

        #[cfg(feature = "WKAudioFilePlayerItem")]
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(replaceCurrentItemWithPlayerItem:))]
        #[unsafe(method_family = none)]
        pub unsafe fn replaceCurrentItemWithPlayerItem(&self, item: Option<&WKAudioFilePlayerItem>);

        #[cfg(feature = "WKAudioFilePlayerItem")]
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(currentItem))]
        #[unsafe(method_family = none)]
        pub unsafe fn currentItem(&self) -> Option<Retained<WKAudioFilePlayerItem>>;

        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(status))]
        #[unsafe(method_family = none)]
        pub unsafe fn status(&self) -> WKAudioFilePlayerStatus;

        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(error))]
        #[unsafe(method_family = none)]
        pub unsafe fn error(&self) -> Option<Retained<NSError>>;

        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(rate))]
        #[unsafe(method_family = none)]
        pub unsafe fn rate(&self) -> c_float;

        /// Setter for [`rate`][Self::rate].
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(setRate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRate(&self, rate: c_float);

        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(currentTime))]
        #[unsafe(method_family = none)]
        pub unsafe fn currentTime(&self) -> NSTimeInterval;
    );
}

/// Methods declared on superclass `NSObject`.
impl WKAudioFilePlayer {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// WatchKit corollary to AVFoundation AVQueuePlayer class
    ///
    ///
    /// This class provides the functionality of AVQueuePlayer for Watch OS apps. Only file-based assets are allowed.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkaudiofilequeueplayer?language=objc)
    #[unsafe(super(WKAudioFilePlayer, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
    pub struct WKAudioFileQueuePlayer;
);

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

impl WKAudioFileQueuePlayer {
    extern_methods!(
        #[cfg(feature = "WKAudioFilePlayerItem")]
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(queuePlayerWithItems:))]
        #[unsafe(method_family = none)]
        pub unsafe fn queuePlayerWithItems(
            items: &NSArray<WKAudioFilePlayerItem>,
        ) -> Retained<Self>;

        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(advanceToNextItem))]
        #[unsafe(method_family = none)]
        pub unsafe fn advanceToNextItem(&self);

        #[cfg(feature = "WKAudioFilePlayerItem")]
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(appendItem:))]
        #[unsafe(method_family = none)]
        pub unsafe fn appendItem(&self, item: &WKAudioFilePlayerItem);

        #[cfg(feature = "WKAudioFilePlayerItem")]
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(removeItem:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeItem(&self, item: &WKAudioFilePlayerItem);

        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(removeAllItems))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeAllItems(&self);

        #[cfg(feature = "WKAudioFilePlayerItem")]
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(items))]
        #[unsafe(method_family = none)]
        pub unsafe fn items(&self) -> Retained<NSArray<WKAudioFilePlayerItem>>;
    );
}

/// Methods declared on superclass `WKAudioFilePlayer`.
impl WKAudioFileQueuePlayer {
    extern_methods!(
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "WKAudioFilePlayerItem")]
        #[deprecated = "Use AVFoundation's AVPlayer and AVQueuePlayer instead"]
        #[unsafe(method(playerWithPlayerItem:))]
        #[unsafe(method_family = none)]
        pub unsafe fn playerWithPlayerItem(item: &WKAudioFilePlayerItem) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl WKAudioFileQueuePlayer {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}