objc2_game_kit/generated/
GKGameCenterViewController.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13/// [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkgamecenterviewcontrollerstate?language=objc)
14// NS_ENUM
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct GKGameCenterViewControllerState(pub NSInteger);
18impl GKGameCenterViewControllerState {
19    #[doc(alias = "GKGameCenterViewControllerStateDefault")]
20    pub const Default: Self = Self(-1);
21    #[doc(alias = "GKGameCenterViewControllerStateLeaderboards")]
22    pub const Leaderboards: Self = Self(0);
23    #[doc(alias = "GKGameCenterViewControllerStateAchievements")]
24    pub const Achievements: Self = Self(1);
25    #[doc(alias = "GKGameCenterViewControllerStateChallenges")]
26    #[deprecated]
27    pub const Challenges: Self = Self(2);
28    #[doc(alias = "GKGameCenterViewControllerStateLocalPlayerProfile")]
29    pub const LocalPlayerProfile: Self = Self(3);
30    #[doc(alias = "GKGameCenterViewControllerStateDashboard")]
31    pub const Dashboard: Self = Self(4);
32    #[doc(alias = "GKGameCenterViewControllerStateLocalPlayerFriendsList")]
33    pub const LocalPlayerFriendsList: Self = Self(5);
34}
35
36unsafe impl Encode for GKGameCenterViewControllerState {
37    const ENCODING: Encoding = NSInteger::ENCODING;
38}
39
40unsafe impl RefEncode for GKGameCenterViewControllerState {
41    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44extern_class!(
45    /// View controller that provides the standard user interface for leaderboards, achievements, and challenges. Present modally from the top view controller.
46    ///
47    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkgamecenterviewcontroller?language=objc)
48    #[unsafe(super(NSViewController, NSResponder, NSObject))]
49    #[derive(Debug, PartialEq, Eq, Hash)]
50    #[cfg(feature = "objc2-app-kit")]
51    #[cfg(target_os = "macos")]
52    #[deprecated]
53    pub struct GKGameCenterViewController;
54);
55
56#[cfg(all(feature = "GKDialogController", feature = "objc2-app-kit"))]
57#[cfg(target_os = "macos")]
58extern_conformance!(
59    unsafe impl GKViewController for GKGameCenterViewController {}
60);
61
62#[cfg(feature = "objc2-app-kit")]
63#[cfg(target_os = "macos")]
64extern_conformance!(
65    unsafe impl NSCoding for GKGameCenterViewController {}
66);
67
68#[cfg(feature = "objc2-app-kit")]
69#[cfg(target_os = "macos")]
70extern_conformance!(
71    unsafe impl NSEditor for GKGameCenterViewController {}
72);
73
74#[cfg(feature = "objc2-app-kit")]
75#[cfg(target_os = "macos")]
76extern_conformance!(
77    unsafe impl NSObjectProtocol for GKGameCenterViewController {}
78);
79
80#[cfg(feature = "objc2-app-kit")]
81#[cfg(target_os = "macos")]
82extern_conformance!(
83    unsafe impl NSSeguePerforming for GKGameCenterViewController {}
84);
85
86#[cfg(feature = "objc2-app-kit")]
87#[cfg(target_os = "macos")]
88extern_conformance!(
89    unsafe impl NSUserInterfaceItemIdentification for GKGameCenterViewController {}
90);
91
92#[cfg(feature = "objc2-app-kit")]
93#[cfg(target_os = "macos")]
94impl GKGameCenterViewController {
95    extern_methods!();
96}
97
98/// Methods declared on superclass `NSViewController`.
99#[cfg(feature = "objc2-app-kit")]
100#[cfg(target_os = "macos")]
101impl GKGameCenterViewController {
102    extern_methods!(
103        #[unsafe(method(initWithNibName:bundle:))]
104        #[unsafe(method_family = init)]
105        pub unsafe fn initWithNibName_bundle(
106            this: Allocated<Self>,
107            nib_name_or_nil: Option<&NSNibName>,
108            nib_bundle_or_nil: Option<&NSBundle>,
109        ) -> Retained<Self>;
110
111        /// # Safety
112        ///
113        /// `coder` possibly has further requirements.
114        #[unsafe(method(initWithCoder:))]
115        #[unsafe(method_family = init)]
116        pub unsafe fn initWithCoder(
117            this: Allocated<Self>,
118            coder: &NSCoder,
119        ) -> Option<Retained<Self>>;
120    );
121}
122
123/// Methods declared on superclass `NSResponder`.
124#[cfg(feature = "objc2-app-kit")]
125#[cfg(target_os = "macos")]
126impl GKGameCenterViewController {
127    extern_methods!(
128        #[unsafe(method(init))]
129        #[unsafe(method_family = init)]
130        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
131    );
132}
133
134/// Methods declared on superclass `NSObject`.
135#[cfg(feature = "objc2-app-kit")]
136#[cfg(target_os = "macos")]
137impl GKGameCenterViewController {
138    extern_methods!(
139        #[unsafe(method(new))]
140        #[unsafe(method_family = new)]
141        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
142    );
143}
144
145#[cfg(feature = "objc2-app-kit")]
146#[cfg(target_os = "macos")]
147impl GKGameCenterViewController {
148    extern_methods!(
149        #[unsafe(method(gameCenterDelegate))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn gameCenterDelegate(
152            &self,
153        ) -> Option<Retained<ProtocolObject<dyn GKGameCenterControllerDelegate>>>;
154
155        /// Setter for [`gameCenterDelegate`][Self::gameCenterDelegate].
156        ///
157        /// This is a [weak property][objc2::topics::weak_property].
158        #[unsafe(method(setGameCenterDelegate:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn setGameCenterDelegate(
161            &self,
162            game_center_delegate: Option<&ProtocolObject<dyn GKGameCenterControllerDelegate>>,
163        );
164
165        /// Use this to display content associated with the specified state. For example setting the state to GKGameCenterViewControllerStateLeaderboards will display a list of leaderboard sets or leaderboards (if no sets). Setting state to GKGameCenterViewControllerStateAchievements will display a list of achievements.
166        #[unsafe(method(initWithState:))]
167        #[unsafe(method_family = init)]
168        pub unsafe fn initWithState(
169            this: Allocated<Self>,
170            state: GKGameCenterViewControllerState,
171        ) -> Retained<Self>;
172
173        #[cfg(feature = "GKLeaderboard")]
174        /// Use this to display the scores for the specified leaderboardID, player scope and time scope. The time scope is only applicable to classic leaderboards. Recurring leaderboards will always be displayed initially with the results (scores) associated with the current instance of the leaderboard.
175        #[unsafe(method(initWithLeaderboardID:playerScope:timeScope:))]
176        #[unsafe(method_family = init)]
177        pub unsafe fn initWithLeaderboardID_playerScope_timeScope(
178            this: Allocated<Self>,
179            leaderboard_id: &NSString,
180            player_scope: GKLeaderboardPlayerScope,
181            time_scope: GKLeaderboardTimeScope,
182        ) -> Retained<Self>;
183
184        #[cfg(feature = "GKLeaderboard")]
185        /// Use this to display the scores for the specified leaderboard and player scope. Both classic and recurring leaderboards can use this method to initialize the view with their scores.
186        #[unsafe(method(initWithLeaderboard:playerScope:))]
187        #[unsafe(method_family = init)]
188        pub unsafe fn initWithLeaderboard_playerScope(
189            this: Allocated<Self>,
190            leaderboard: &GKLeaderboard,
191            player_scope: GKLeaderboardPlayerScope,
192        ) -> Retained<Self>;
193
194        /// Use this to display the leaderboard sets for the specified leaderboardSetID.
195        #[unsafe(method(initWithLeaderboardSetID:))]
196        #[unsafe(method_family = init)]
197        pub unsafe fn initWithLeaderboardSetID(
198            this: Allocated<Self>,
199            leaderboard_set_id: &NSString,
200        ) -> Retained<Self>;
201
202        /// Use this to display the details associated with the specified achievementID
203        #[unsafe(method(initWithAchievementID:))]
204        #[unsafe(method_family = init)]
205        pub unsafe fn initWithAchievementID(
206            this: Allocated<Self>,
207            achievement_id: &NSString,
208        ) -> Retained<Self>;
209
210        #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
211        /// Use this to display the profile page associated with the specified player.
212        #[unsafe(method(initWithPlayer:))]
213        #[unsafe(method_family = init)]
214        pub unsafe fn initWithPlayer(this: Allocated<Self>, player: &GKPlayer) -> Retained<Self>;
215    );
216}
217
218/// Deprecated.
219#[cfg(feature = "objc2-app-kit")]
220#[cfg(target_os = "macos")]
221impl GKGameCenterViewController {
222    extern_methods!(
223        #[deprecated]
224        #[unsafe(method(viewState))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn viewState(&self) -> GKGameCenterViewControllerState;
227
228        /// Setter for [`viewState`][Self::viewState].
229        #[deprecated]
230        #[unsafe(method(setViewState:))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn setViewState(&self, view_state: GKGameCenterViewControllerState);
233
234        #[cfg(feature = "GKLeaderboard")]
235        #[deprecated]
236        #[unsafe(method(leaderboardTimeScope))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn leaderboardTimeScope(&self) -> GKLeaderboardTimeScope;
239
240        #[cfg(feature = "GKLeaderboard")]
241        /// Setter for [`leaderboardTimeScope`][Self::leaderboardTimeScope].
242        #[deprecated]
243        #[unsafe(method(setLeaderboardTimeScope:))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn setLeaderboardTimeScope(
246            &self,
247            leaderboard_time_scope: GKLeaderboardTimeScope,
248        );
249
250        #[deprecated]
251        #[unsafe(method(leaderboardIdentifier))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn leaderboardIdentifier(&self) -> Option<Retained<NSString>>;
254
255        /// Setter for [`leaderboardIdentifier`][Self::leaderboardIdentifier].
256        #[deprecated]
257        #[unsafe(method(setLeaderboardIdentifier:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn setLeaderboardIdentifier(&self, leaderboard_identifier: Option<&NSString>);
260
261        #[deprecated]
262        #[unsafe(method(leaderboardCategory))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn leaderboardCategory(&self) -> Option<Retained<NSString>>;
265
266        /// Setter for [`leaderboardCategory`][Self::leaderboardCategory].
267        #[deprecated]
268        #[unsafe(method(setLeaderboardCategory:))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn setLeaderboardCategory(&self, leaderboard_category: Option<&NSString>);
271    );
272}
273
274extern_protocol!(
275    /// [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkgamecentercontrollerdelegate?language=objc)
276    #[deprecated]
277    pub unsafe trait GKGameCenterControllerDelegate: NSObjectProtocol {
278        #[cfg(feature = "objc2-app-kit")]
279        #[cfg(target_os = "macos")]
280        #[unsafe(method(gameCenterViewControllerDidFinish:))]
281        #[unsafe(method_family = none)]
282        unsafe fn gameCenterViewControllerDidFinish(
283            &self,
284            game_center_view_controller: &GKGameCenterViewController,
285        );
286    }
287);