objc2_game_kit/generated/
GKGameCenterViewController.rs1use 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#[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 pub const Challenges: Self = Self(2);
27 #[doc(alias = "GKGameCenterViewControllerStateLocalPlayerProfile")]
28 pub const LocalPlayerProfile: Self = Self(3);
29 #[doc(alias = "GKGameCenterViewControllerStateDashboard")]
30 pub const Dashboard: Self = Self(4);
31 #[doc(alias = "GKGameCenterViewControllerStateLocalPlayerFriendsList")]
32 pub const LocalPlayerFriendsList: Self = Self(5);
33}
34
35unsafe impl Encode for GKGameCenterViewControllerState {
36 const ENCODING: Encoding = NSInteger::ENCODING;
37}
38
39unsafe impl RefEncode for GKGameCenterViewControllerState {
40 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
41}
42
43extern_class!(
44 #[unsafe(super(NSViewController, NSResponder, NSObject))]
46 #[derive(Debug, PartialEq, Eq, Hash)]
47 #[cfg(feature = "objc2-app-kit")]
48 #[cfg(target_os = "macos")]
49 pub struct GKGameCenterViewController;
50);
51
52#[cfg(all(feature = "GKDialogController", feature = "objc2-app-kit"))]
53#[cfg(target_os = "macos")]
54extern_conformance!(
55 unsafe impl GKViewController for GKGameCenterViewController {}
56);
57
58#[cfg(feature = "objc2-app-kit")]
59#[cfg(target_os = "macos")]
60extern_conformance!(
61 unsafe impl NSCoding for GKGameCenterViewController {}
62);
63
64#[cfg(feature = "objc2-app-kit")]
65#[cfg(target_os = "macos")]
66extern_conformance!(
67 unsafe impl NSEditor for GKGameCenterViewController {}
68);
69
70#[cfg(feature = "objc2-app-kit")]
71#[cfg(target_os = "macos")]
72extern_conformance!(
73 unsafe impl NSObjectProtocol for GKGameCenterViewController {}
74);
75
76#[cfg(feature = "objc2-app-kit")]
77#[cfg(target_os = "macos")]
78extern_conformance!(
79 unsafe impl NSSeguePerforming for GKGameCenterViewController {}
80);
81
82#[cfg(feature = "objc2-app-kit")]
83#[cfg(target_os = "macos")]
84extern_conformance!(
85 unsafe impl NSUserInterfaceItemIdentification for GKGameCenterViewController {}
86);
87
88#[cfg(feature = "objc2-app-kit")]
89#[cfg(target_os = "macos")]
90impl GKGameCenterViewController {
91 extern_methods!();
92}
93
94#[cfg(feature = "objc2-app-kit")]
96#[cfg(target_os = "macos")]
97impl GKGameCenterViewController {
98 extern_methods!(
99 #[unsafe(method(initWithNibName:bundle:))]
100 #[unsafe(method_family = init)]
101 pub unsafe fn initWithNibName_bundle(
102 this: Allocated<Self>,
103 nib_name_or_nil: Option<&NSNibName>,
104 nib_bundle_or_nil: Option<&NSBundle>,
105 ) -> Retained<Self>;
106
107 #[unsafe(method(initWithCoder:))]
108 #[unsafe(method_family = init)]
109 pub unsafe fn initWithCoder(
110 this: Allocated<Self>,
111 coder: &NSCoder,
112 ) -> Option<Retained<Self>>;
113 );
114}
115
116#[cfg(feature = "objc2-app-kit")]
118#[cfg(target_os = "macos")]
119impl GKGameCenterViewController {
120 extern_methods!(
121 #[unsafe(method(init))]
122 #[unsafe(method_family = init)]
123 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
124 );
125}
126
127#[cfg(feature = "objc2-app-kit")]
129#[cfg(target_os = "macos")]
130impl GKGameCenterViewController {
131 extern_methods!(
132 #[unsafe(method(new))]
133 #[unsafe(method_family = new)]
134 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
135 );
136}
137
138#[cfg(feature = "objc2-app-kit")]
139#[cfg(target_os = "macos")]
140impl GKGameCenterViewController {
141 extern_methods!(
142 #[unsafe(method(gameCenterDelegate))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn gameCenterDelegate(
145 &self,
146 ) -> Option<Retained<ProtocolObject<dyn GKGameCenterControllerDelegate>>>;
147
148 #[unsafe(method(setGameCenterDelegate:))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn setGameCenterDelegate(
153 &self,
154 game_center_delegate: Option<&ProtocolObject<dyn GKGameCenterControllerDelegate>>,
155 );
156
157 #[unsafe(method(initWithState:))]
159 #[unsafe(method_family = init)]
160 pub unsafe fn initWithState(
161 this: Allocated<Self>,
162 state: GKGameCenterViewControllerState,
163 ) -> Retained<Self>;
164
165 #[cfg(feature = "GKLeaderboard")]
166 #[unsafe(method(initWithLeaderboardID:playerScope:timeScope:))]
168 #[unsafe(method_family = init)]
169 pub unsafe fn initWithLeaderboardID_playerScope_timeScope(
170 this: Allocated<Self>,
171 leaderboard_id: &NSString,
172 player_scope: GKLeaderboardPlayerScope,
173 time_scope: GKLeaderboardTimeScope,
174 ) -> Retained<Self>;
175
176 #[cfg(feature = "GKLeaderboard")]
177 #[unsafe(method(initWithLeaderboard:playerScope:))]
179 #[unsafe(method_family = init)]
180 pub unsafe fn initWithLeaderboard_playerScope(
181 this: Allocated<Self>,
182 leaderboard: &GKLeaderboard,
183 player_scope: GKLeaderboardPlayerScope,
184 ) -> Retained<Self>;
185
186 #[unsafe(method(initWithLeaderboardSetID:))]
188 #[unsafe(method_family = init)]
189 pub unsafe fn initWithLeaderboardSetID(
190 this: Allocated<Self>,
191 leaderboard_set_id: &NSString,
192 ) -> Retained<Self>;
193
194 #[unsafe(method(initWithAchievementID:))]
196 #[unsafe(method_family = init)]
197 pub unsafe fn initWithAchievementID(
198 this: Allocated<Self>,
199 achievement_id: &NSString,
200 ) -> Retained<Self>;
201
202 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
203 #[unsafe(method(initWithPlayer:))]
205 #[unsafe(method_family = init)]
206 pub unsafe fn initWithPlayer(this: Allocated<Self>, player: &GKPlayer) -> Retained<Self>;
207 );
208}
209
210#[cfg(feature = "objc2-app-kit")]
212#[cfg(target_os = "macos")]
213impl GKGameCenterViewController {
214 extern_methods!(
215 #[deprecated]
216 #[unsafe(method(viewState))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn viewState(&self) -> GKGameCenterViewControllerState;
219
220 #[deprecated]
222 #[unsafe(method(setViewState:))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn setViewState(&self, view_state: GKGameCenterViewControllerState);
225
226 #[cfg(feature = "GKLeaderboard")]
227 #[deprecated]
228 #[unsafe(method(leaderboardTimeScope))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn leaderboardTimeScope(&self) -> GKLeaderboardTimeScope;
231
232 #[cfg(feature = "GKLeaderboard")]
233 #[deprecated]
235 #[unsafe(method(setLeaderboardTimeScope:))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn setLeaderboardTimeScope(
238 &self,
239 leaderboard_time_scope: GKLeaderboardTimeScope,
240 );
241
242 #[deprecated]
243 #[unsafe(method(leaderboardIdentifier))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn leaderboardIdentifier(&self) -> Option<Retained<NSString>>;
246
247 #[deprecated]
249 #[unsafe(method(setLeaderboardIdentifier:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn setLeaderboardIdentifier(&self, leaderboard_identifier: Option<&NSString>);
252
253 #[deprecated]
254 #[unsafe(method(leaderboardCategory))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn leaderboardCategory(&self) -> Option<Retained<NSString>>;
257
258 #[deprecated]
260 #[unsafe(method(setLeaderboardCategory:))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn setLeaderboardCategory(&self, leaderboard_category: Option<&NSString>);
263 );
264}
265
266extern_protocol!(
267 pub unsafe trait GKGameCenterControllerDelegate: NSObjectProtocol {
269 #[cfg(feature = "objc2-app-kit")]
270 #[cfg(target_os = "macos")]
271 #[unsafe(method(gameCenterViewControllerDidFinish:))]
272 #[unsafe(method_family = none)]
273 unsafe fn gameCenterViewControllerDidFinish(
274 &self,
275 game_center_view_controller: &GKGameCenterViewController,
276 );
277 }
278);