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::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GKMatchmakingMode(pub NSInteger);
impl GKMatchmakingMode {
#[doc(alias = "GKMatchmakingModeDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "GKMatchmakingModeNearbyOnly")]
pub const NearbyOnly: Self = Self(1);
#[doc(alias = "GKMatchmakingModeAutomatchOnly")]
pub const AutomatchOnly: Self = Self(2);
#[doc(alias = "GKMatchmakingModeInviteOnly")]
pub const InviteOnly: Self = Self(3);
}
unsafe impl Encode for GKMatchmakingMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for GKMatchmakingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSViewController, NSResponder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
pub struct GKMatchmakerViewController;
);
#[cfg(all(feature = "GKDialogController", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
unsafe impl GKViewController for GKMatchmakerViewController {}
);
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
unsafe impl NSCoding for GKMatchmakerViewController {}
);
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
unsafe impl NSEditor for GKMatchmakerViewController {}
);
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
unsafe impl NSObjectProtocol for GKMatchmakerViewController {}
);
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
unsafe impl NSSeguePerforming for GKMatchmakerViewController {}
);
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for GKMatchmakerViewController {}
);
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl GKMatchmakerViewController {
extern_methods!(
#[unsafe(method(matchmakerDelegate))]
#[unsafe(method_family = none)]
pub unsafe fn matchmakerDelegate(
&self,
) -> Option<Retained<ProtocolObject<dyn GKMatchmakerViewControllerDelegate>>>;
#[unsafe(method(setMatchmakerDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setMatchmakerDelegate(
&self,
matchmaker_delegate: Option<&ProtocolObject<dyn GKMatchmakerViewControllerDelegate>>,
);
#[cfg(feature = "GKMatchmaker")]
#[unsafe(method(matchRequest))]
#[unsafe(method_family = none)]
pub unsafe fn matchRequest(&self) -> Retained<GKMatchRequest>;
#[unsafe(method(isHosted))]
#[unsafe(method_family = none)]
pub unsafe fn isHosted(&self) -> bool;
#[unsafe(method(setHosted:))]
#[unsafe(method_family = none)]
pub unsafe fn setHosted(&self, hosted: bool);
#[unsafe(method(matchmakingMode))]
#[unsafe(method_family = none)]
pub unsafe fn matchmakingMode(&self) -> GKMatchmakingMode;
#[unsafe(method(setMatchmakingMode:))]
#[unsafe(method_family = none)]
pub unsafe fn setMatchmakingMode(&self, matchmaking_mode: GKMatchmakingMode);
#[unsafe(method(canStartWithMinimumPlayers))]
#[unsafe(method_family = none)]
pub unsafe fn canStartWithMinimumPlayers(&self) -> bool;
#[unsafe(method(setCanStartWithMinimumPlayers:))]
#[unsafe(method_family = none)]
pub unsafe fn setCanStartWithMinimumPlayers(&self, can_start_with_minimum_players: bool);
#[cfg(feature = "GKMatchmaker")]
#[unsafe(method(initWithMatchRequest:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithMatchRequest(
this: Allocated<Self>,
request: &GKMatchRequest,
) -> Option<Retained<Self>>;
#[cfg(feature = "GKMatchmaker")]
#[unsafe(method(initWithInvite:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithInvite(
this: Allocated<Self>,
invite: &GKInvite,
) -> Option<Retained<Self>>;
#[cfg(feature = "GKMatch")]
#[unsafe(method(addPlayersToMatch:))]
#[unsafe(method_family = none)]
pub unsafe fn addPlayersToMatch(&self, r#match: &GKMatch);
#[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
#[unsafe(method(setHostedPlayer:didConnect:))]
#[unsafe(method_family = none)]
pub unsafe fn setHostedPlayer_didConnect(&self, player: &GKPlayer, connected: bool);
#[deprecated = "No longer supported."]
#[unsafe(method(defaultInvitationMessage))]
#[unsafe(method_family = none)]
pub unsafe fn defaultInvitationMessage(&self) -> Option<Retained<NSString>>;
#[deprecated = "No longer supported."]
#[unsafe(method(setDefaultInvitationMessage:))]
#[unsafe(method_family = none)]
pub unsafe fn setDefaultInvitationMessage(
&self,
default_invitation_message: Option<&NSString>,
);
);
}
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl GKMatchmakerViewController {
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>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl GKMatchmakerViewController {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl GKMatchmakerViewController {
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 GKMatchmakerViewController {
extern_methods!(
#[deprecated]
#[unsafe(method(setHostedPlayer:connected:))]
#[unsafe(method_family = none)]
pub unsafe fn setHostedPlayer_connected(&self, player_id: &NSString, connected: bool);
#[deprecated]
#[unsafe(method(setHostedPlayerReady:))]
#[unsafe(method_family = none)]
pub unsafe fn setHostedPlayerReady(&self, player_id: &NSString);
);
}
extern_protocol!(
pub unsafe trait GKMatchmakerViewControllerDelegate: NSObjectProtocol {
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
#[unsafe(method(matchmakerViewControllerWasCancelled:))]
#[unsafe(method_family = none)]
unsafe fn matchmakerViewControllerWasCancelled(
&self,
view_controller: &GKMatchmakerViewController,
);
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
#[unsafe(method(matchmakerViewController:didFailWithError:))]
#[unsafe(method_family = none)]
unsafe fn matchmakerViewController_didFailWithError(
&self,
view_controller: &GKMatchmakerViewController,
error: &NSError,
);
#[cfg(all(feature = "GKMatch", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
#[optional]
#[unsafe(method(matchmakerViewController:didFindMatch:))]
#[unsafe(method_family = none)]
unsafe fn matchmakerViewController_didFindMatch(
&self,
view_controller: &GKMatchmakerViewController,
r#match: &GKMatch,
);
#[cfg(all(
feature = "GKBasePlayer",
feature = "GKPlayer",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[unsafe(method(matchmakerViewController:didFindHostedPlayers:))]
#[unsafe(method_family = none)]
unsafe fn matchmakerViewController_didFindHostedPlayers(
&self,
view_controller: &GKMatchmakerViewController,
players: &NSArray<GKPlayer>,
);
#[cfg(all(
feature = "GKBasePlayer",
feature = "GKPlayer",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[unsafe(method(matchmakerViewController:hostedPlayerDidAccept:))]
#[unsafe(method_family = none)]
unsafe fn matchmakerViewController_hostedPlayerDidAccept(
&self,
view_controller: &GKMatchmakerViewController,
player: &GKPlayer,
);
#[cfg(all(
feature = "GKBasePlayer",
feature = "GKDefines",
feature = "GKPlayer",
feature = "block2",
feature = "objc2-app-kit"
))]
#[cfg(target_os = "macos")]
#[optional]
#[unsafe(method(matchmakerViewController:getMatchPropertiesForRecipient:withCompletionHandler:))]
#[unsafe(method_family = none)]
unsafe fn matchmakerViewController_getMatchPropertiesForRecipient_withCompletionHandler(
&self,
view_controller: &GKMatchmakerViewController,
recipient: &GKPlayer,
completion_handler: &block2::DynBlock<dyn Fn(NonNull<GKMatchProperties>)>,
);
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
#[deprecated]
#[optional]
#[unsafe(method(matchmakerViewController:didFindPlayers:))]
#[unsafe(method_family = none)]
unsafe fn matchmakerViewController_didFindPlayers(
&self,
view_controller: &GKMatchmakerViewController,
player_i_ds: &NSArray<NSString>,
);
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
#[deprecated]
#[optional]
#[unsafe(method(matchmakerViewController:didReceiveAcceptFromHostedPlayer:))]
#[unsafe(method_family = none)]
unsafe fn matchmakerViewController_didReceiveAcceptFromHostedPlayer(
&self,
view_controller: &GKMatchmakerViewController,
player_id: &NSString,
);
}
);