objc2-game-kit 0.3.2

Bindings to the GameKit 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/gamekit/gkvoicechatplayerstate?language=objc)
// NS_ENUM
#[deprecated = "No longer supported"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GKVoiceChatPlayerState(pub NSInteger);
impl GKVoiceChatPlayerState {
    #[doc(alias = "GKVoiceChatPlayerConnected")]
    #[deprecated = "No longer supported"]
    pub const Connected: Self = Self(0);
    #[doc(alias = "GKVoiceChatPlayerDisconnected")]
    #[deprecated = "No longer supported"]
    pub const Disconnected: Self = Self(1);
    #[doc(alias = "GKVoiceChatPlayerSpeaking")]
    #[deprecated = "No longer supported"]
    pub const Speaking: Self = Self(2);
    #[doc(alias = "GKVoiceChatPlayerSilent")]
    #[deprecated = "No longer supported"]
    pub const Silent: Self = Self(3);
    #[doc(alias = "GKVoiceChatPlayerConnecting")]
    #[deprecated = "No longer supported"]
    pub const Connecting: Self = Self(4);
}

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

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

extern_class!(
    /// GKVoiceChat represents an instance of a named voice communications channel
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkvoicechat?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "No longer supported"]
    pub struct GKVoiceChat;
);

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

impl GKVoiceChat {
    extern_methods!(
        #[deprecated = "No longer supported"]
        #[unsafe(method(start))]
        #[unsafe(method_family = none)]
        pub unsafe fn start(&self);

        /// start receiving audio from the chat
        #[deprecated = "No longer supported"]
        #[unsafe(method(stop))]
        #[unsafe(method_family = none)]
        pub unsafe fn stop(&self);

        #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
        /// stop receiving audio from the chat
        #[deprecated = "No longer supported"]
        #[unsafe(method(setPlayer:muted:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPlayer_muted(&self, player: &GKPlayer, is_muted: bool);

        #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer", feature = "block2"))]
        /// # Safety
        ///
        /// The returned block's argument 1 must be a valid pointer.
        #[deprecated = "No longer supported"]
        #[unsafe(method(playerVoiceChatStateDidChangeHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn playerVoiceChatStateDidChangeHandler(
            &self,
        ) -> NonNull<block2::DynBlock<dyn Fn(NonNull<GKPlayer>, GKVoiceChatPlayerState)>>;

        #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer", feature = "block2"))]
        /// Setter for [`playerVoiceChatStateDidChangeHandler`][Self::playerVoiceChatStateDidChangeHandler].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated = "No longer supported"]
        #[unsafe(method(setPlayerVoiceChatStateDidChangeHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPlayerVoiceChatStateDidChangeHandler(
            &self,
            player_voice_chat_state_did_change_handler: &block2::DynBlock<
                dyn Fn(NonNull<GKPlayer>, GKVoiceChatPlayerState),
            >,
        );

        #[deprecated = "No longer supported"]
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub unsafe fn name(&self) -> Retained<NSString>;

        #[deprecated = "No longer supported"]
        #[unsafe(method(isActive))]
        #[unsafe(method_family = none)]
        pub unsafe fn isActive(&self) -> bool;

        /// Setter for [`isActive`][Self::isActive].
        #[deprecated = "No longer supported"]
        #[unsafe(method(setActive:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActive(&self, active: bool);

        #[deprecated = "No longer supported"]
        #[unsafe(method(volume))]
        #[unsafe(method_family = none)]
        pub unsafe fn volume(&self) -> c_float;

        /// Setter for [`volume`][Self::volume].
        #[deprecated = "No longer supported"]
        #[unsafe(method(setVolume:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setVolume(&self, volume: c_float);

        #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
        #[deprecated = "No longer supported"]
        #[unsafe(method(players))]
        #[unsafe(method_family = none)]
        pub unsafe fn players(&self) -> Retained<NSArray<GKPlayer>>;

        #[deprecated = "No longer supported"]
        #[unsafe(method(isVoIPAllowed))]
        #[unsafe(method_family = none)]
        pub unsafe fn isVoIPAllowed() -> bool;
    );
}

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

/// Deprecated.
#[deprecated = "No longer supported"]
impl GKVoiceChat {
    extern_methods!(
        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// The returned block's argument 1 must be a valid pointer.
        #[deprecated]
        #[unsafe(method(playerStateUpdateHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn playerStateUpdateHandler(
            &self,
        ) -> NonNull<block2::DynBlock<dyn Fn(NonNull<NSString>, GKVoiceChatPlayerState)>>;

        #[cfg(feature = "block2")]
        /// Setter for [`playerStateUpdateHandler`][Self::playerStateUpdateHandler].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[deprecated]
        #[unsafe(method(setPlayerStateUpdateHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPlayerStateUpdateHandler(
            &self,
            player_state_update_handler: &block2::DynBlock<
                dyn Fn(NonNull<NSString>, GKVoiceChatPlayerState),
            >,
        );
    );
}

/// Obsoleted.
#[deprecated = "No longer supported"]
impl GKVoiceChat {
    extern_methods!(
        /// * This property is obsolete. **
        #[deprecated]
        #[unsafe(method(playerIDs))]
        #[unsafe(method_family = none)]
        pub unsafe fn playerIDs(&self) -> Option<Retained<NSArray<NSString>>>;

        /// * This method is obsolete. It will never be invoked and its implementation does nothing**
        #[deprecated]
        #[unsafe(method(setMute:forPlayer:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMute_forPlayer(&self, is_muted: bool, player_id: &NSString);
    );
}