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::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// View controller to manage turn-based matches, invite friends and perform automatching. Present modally from the top view controller.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkturnbasedmatchmakerviewcontroller?language=objc)
    #[unsafe(super(NSViewController, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    pub struct GKTurnBasedMatchmakerViewController;
);

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

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

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSEditor for GKTurnBasedMatchmakerViewController {}
);

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

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSSeguePerforming for GKTurnBasedMatchmakerViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for GKTurnBasedMatchmakerViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl GKTurnBasedMatchmakerViewController {
    extern_methods!();
}

/// Methods declared on superclass `NSViewController`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl GKTurnBasedMatchmakerViewController {
    extern_methods!(
        #[unsafe(method(initWithNibName:bundle:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSNibName>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

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

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

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl GKTurnBasedMatchmakerViewController {
    extern_methods!(
        #[unsafe(method(turnBasedMatchmakerDelegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn turnBasedMatchmakerDelegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn GKTurnBasedMatchmakerViewControllerDelegate>>>;

        /// Setter for [`turnBasedMatchmakerDelegate`][Self::turnBasedMatchmakerDelegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setTurnBasedMatchmakerDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTurnBasedMatchmakerDelegate(
            &self,
            turn_based_matchmaker_delegate: Option<
                &ProtocolObject<dyn GKTurnBasedMatchmakerViewControllerDelegate>,
            >,
        );

        #[unsafe(method(showExistingMatches))]
        #[unsafe(method_family = none)]
        pub unsafe fn showExistingMatches(&self) -> bool;

        /// Setter for [`showExistingMatches`][Self::showExistingMatches].
        #[unsafe(method(setShowExistingMatches:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShowExistingMatches(&self, show_existing_matches: bool);

        #[cfg(feature = "GKMatchmakerViewController")]
        /// This controls the mode of matchmaking to support in the UI (all, nearby only, automatch only, invite only). Throws an exception if you can not set to the desired mode (due to restrictions)
        #[unsafe(method(matchmakingMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn matchmakingMode(&self) -> GKMatchmakingMode;

        #[cfg(feature = "GKMatchmakerViewController")]
        /// Setter for [`matchmakingMode`][Self::matchmakingMode].
        #[unsafe(method(setMatchmakingMode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMatchmakingMode(&self, matchmaking_mode: GKMatchmakingMode);

        #[cfg(feature = "GKMatchmaker")]
        #[unsafe(method(initWithMatchRequest:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithMatchRequest(
            this: Allocated<Self>,
            request: &GKMatchRequest,
        ) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkturnbasedmatchmakerviewcontrollerdelegate?language=objc)
    pub unsafe trait GKTurnBasedMatchmakerViewControllerDelegate: NSObjectProtocol {
        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        /// The user has cancelled
        #[unsafe(method(turnBasedMatchmakerViewControllerWasCancelled:))]
        #[unsafe(method_family = none)]
        unsafe fn turnBasedMatchmakerViewControllerWasCancelled(
            &self,
            view_controller: &GKTurnBasedMatchmakerViewController,
        );

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        /// Matchmaking has failed with an error
        #[unsafe(method(turnBasedMatchmakerViewController:didFailWithError:))]
        #[unsafe(method_family = none)]
        unsafe fn turnBasedMatchmakerViewController_didFailWithError(
            &self,
            view_controller: &GKTurnBasedMatchmakerViewController,
            error: &NSError,
        );

        #[cfg(all(feature = "GKTurnBasedMatch", feature = "objc2-app-kit"))]
        #[cfg(target_os = "macos")]
        #[deprecated]
        #[optional]
        #[unsafe(method(turnBasedMatchmakerViewController:didFindMatch:))]
        #[unsafe(method_family = none)]
        unsafe fn turnBasedMatchmakerViewController_didFindMatch(
            &self,
            view_controller: &GKTurnBasedMatchmakerViewController,
            r#match: &GKTurnBasedMatch,
        );

        #[cfg(all(feature = "GKTurnBasedMatch", feature = "objc2-app-kit"))]
        #[cfg(target_os = "macos")]
        #[deprecated]
        #[optional]
        #[unsafe(method(turnBasedMatchmakerViewController:playerQuitForMatch:))]
        #[unsafe(method_family = none)]
        unsafe fn turnBasedMatchmakerViewController_playerQuitForMatch(
            &self,
            view_controller: &GKTurnBasedMatchmakerViewController,
            r#match: &GKTurnBasedMatch,
        );
    }
);