objc2_game_kit/generated/
GKMatchmakerViewController.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 GKMatchmakingMode(pub NSInteger);
18impl GKMatchmakingMode {
19 #[doc(alias = "GKMatchmakingModeDefault")]
20 pub const Default: Self = Self(0);
21 #[doc(alias = "GKMatchmakingModeNearbyOnly")]
22 pub const NearbyOnly: Self = Self(1);
23 #[doc(alias = "GKMatchmakingModeAutomatchOnly")]
24 pub const AutomatchOnly: Self = Self(2);
25 #[doc(alias = "GKMatchmakingModeInviteOnly")]
26 pub const InviteOnly: Self = Self(3);
27}
28
29unsafe impl Encode for GKMatchmakingMode {
30 const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for GKMatchmakingMode {
34 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37extern_class!(
38 #[unsafe(super(NSViewController, NSResponder, NSObject))]
40 #[derive(Debug, PartialEq, Eq, Hash)]
41 #[cfg(feature = "objc2-app-kit")]
42 #[cfg(target_os = "macos")]
43 pub struct GKMatchmakerViewController;
44);
45
46#[cfg(all(feature = "GKDialogController", feature = "objc2-app-kit"))]
47#[cfg(target_os = "macos")]
48extern_conformance!(
49 unsafe impl GKViewController for GKMatchmakerViewController {}
50);
51
52#[cfg(feature = "objc2-app-kit")]
53#[cfg(target_os = "macos")]
54extern_conformance!(
55 unsafe impl NSCoding for GKMatchmakerViewController {}
56);
57
58#[cfg(feature = "objc2-app-kit")]
59#[cfg(target_os = "macos")]
60extern_conformance!(
61 unsafe impl NSEditor for GKMatchmakerViewController {}
62);
63
64#[cfg(feature = "objc2-app-kit")]
65#[cfg(target_os = "macos")]
66extern_conformance!(
67 unsafe impl NSObjectProtocol for GKMatchmakerViewController {}
68);
69
70#[cfg(feature = "objc2-app-kit")]
71#[cfg(target_os = "macos")]
72extern_conformance!(
73 unsafe impl NSSeguePerforming for GKMatchmakerViewController {}
74);
75
76#[cfg(feature = "objc2-app-kit")]
77#[cfg(target_os = "macos")]
78extern_conformance!(
79 unsafe impl NSUserInterfaceItemIdentification for GKMatchmakerViewController {}
80);
81
82#[cfg(feature = "objc2-app-kit")]
83#[cfg(target_os = "macos")]
84impl GKMatchmakerViewController {
85 extern_methods!(
86 #[unsafe(method(matchmakerDelegate))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn matchmakerDelegate(
89 &self,
90 ) -> Option<Retained<ProtocolObject<dyn GKMatchmakerViewControllerDelegate>>>;
91
92 #[unsafe(method(setMatchmakerDelegate:))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn setMatchmakerDelegate(
98 &self,
99 matchmaker_delegate: Option<&ProtocolObject<dyn GKMatchmakerViewControllerDelegate>>,
100 );
101
102 #[cfg(feature = "GKMatchmaker")]
103 #[unsafe(method(matchRequest))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn matchRequest(&self) -> Retained<GKMatchRequest>;
106
107 #[unsafe(method(isHosted))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn isHosted(&self) -> bool;
111
112 #[unsafe(method(setHosted:))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn setHosted(&self, hosted: bool);
116
117 #[unsafe(method(matchmakingMode))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn matchmakingMode(&self) -> GKMatchmakingMode;
121
122 #[unsafe(method(setMatchmakingMode:))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn setMatchmakingMode(&self, matchmaking_mode: GKMatchmakingMode);
126
127 #[unsafe(method(canStartWithMinimumPlayers))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn canStartWithMinimumPlayers(&self) -> bool;
133
134 #[unsafe(method(setCanStartWithMinimumPlayers:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn setCanStartWithMinimumPlayers(&self, can_start_with_minimum_players: bool);
138
139 #[cfg(feature = "GKMatchmaker")]
140 #[unsafe(method(initWithMatchRequest:))]
142 #[unsafe(method_family = init)]
143 pub unsafe fn initWithMatchRequest(
144 this: Allocated<Self>,
145 request: &GKMatchRequest,
146 ) -> Option<Retained<Self>>;
147
148 #[cfg(feature = "GKMatchmaker")]
149 #[unsafe(method(initWithInvite:))]
151 #[unsafe(method_family = init)]
152 pub unsafe fn initWithInvite(
153 this: Allocated<Self>,
154 invite: &GKInvite,
155 ) -> Option<Retained<Self>>;
156
157 #[cfg(feature = "GKMatch")]
158 #[unsafe(method(addPlayersToMatch:))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn addPlayersToMatch(&self, r#match: &GKMatch);
163
164 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
165 #[unsafe(method(setHostedPlayer:didConnect:))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn setHostedPlayer_didConnect(&self, player: &GKPlayer, connected: bool);
168
169 #[deprecated = "No longer supported."]
171 #[unsafe(method(defaultInvitationMessage))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn defaultInvitationMessage(&self) -> Option<Retained<NSString>>;
174
175 #[deprecated = "No longer supported."]
179 #[unsafe(method(setDefaultInvitationMessage:))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn setDefaultInvitationMessage(
182 &self,
183 default_invitation_message: Option<&NSString>,
184 );
185 );
186}
187
188#[cfg(feature = "objc2-app-kit")]
190#[cfg(target_os = "macos")]
191impl GKMatchmakerViewController {
192 extern_methods!(
193 #[unsafe(method(initWithNibName:bundle:))]
194 #[unsafe(method_family = init)]
195 pub unsafe fn initWithNibName_bundle(
196 this: Allocated<Self>,
197 nib_name_or_nil: Option<&NSNibName>,
198 nib_bundle_or_nil: Option<&NSBundle>,
199 ) -> Retained<Self>;
200
201 #[unsafe(method(initWithCoder:))]
205 #[unsafe(method_family = init)]
206 pub unsafe fn initWithCoder(
207 this: Allocated<Self>,
208 coder: &NSCoder,
209 ) -> Option<Retained<Self>>;
210 );
211}
212
213#[cfg(feature = "objc2-app-kit")]
215#[cfg(target_os = "macos")]
216impl GKMatchmakerViewController {
217 extern_methods!(
218 #[unsafe(method(init))]
219 #[unsafe(method_family = init)]
220 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
221 );
222}
223
224#[cfg(feature = "objc2-app-kit")]
226#[cfg(target_os = "macos")]
227impl GKMatchmakerViewController {
228 extern_methods!(
229 #[unsafe(method(new))]
230 #[unsafe(method_family = new)]
231 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
232 );
233}
234
235#[cfg(feature = "objc2-app-kit")]
237#[cfg(target_os = "macos")]
238impl GKMatchmakerViewController {
239 extern_methods!(
240 #[deprecated]
242 #[unsafe(method(setHostedPlayer:connected:))]
243 #[unsafe(method_family = none)]
244 pub unsafe fn setHostedPlayer_connected(&self, player_id: &NSString, connected: bool);
245
246 #[deprecated]
248 #[unsafe(method(setHostedPlayerReady:))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn setHostedPlayerReady(&self, player_id: &NSString);
251 );
252}
253
254extern_protocol!(
255 pub unsafe trait GKMatchmakerViewControllerDelegate: NSObjectProtocol {
257 #[cfg(feature = "objc2-app-kit")]
258 #[cfg(target_os = "macos")]
259 #[unsafe(method(matchmakerViewControllerWasCancelled:))]
261 #[unsafe(method_family = none)]
262 unsafe fn matchmakerViewControllerWasCancelled(
263 &self,
264 view_controller: &GKMatchmakerViewController,
265 );
266
267 #[cfg(feature = "objc2-app-kit")]
268 #[cfg(target_os = "macos")]
269 #[unsafe(method(matchmakerViewController:didFailWithError:))]
271 #[unsafe(method_family = none)]
272 unsafe fn matchmakerViewController_didFailWithError(
273 &self,
274 view_controller: &GKMatchmakerViewController,
275 error: &NSError,
276 );
277
278 #[cfg(all(feature = "GKMatch", feature = "objc2-app-kit"))]
279 #[cfg(target_os = "macos")]
280 #[optional]
282 #[unsafe(method(matchmakerViewController:didFindMatch:))]
283 #[unsafe(method_family = none)]
284 unsafe fn matchmakerViewController_didFindMatch(
285 &self,
286 view_controller: &GKMatchmakerViewController,
287 r#match: &GKMatch,
288 );
289
290 #[cfg(all(
291 feature = "GKBasePlayer",
292 feature = "GKPlayer",
293 feature = "objc2-app-kit"
294 ))]
295 #[cfg(target_os = "macos")]
296 #[optional]
298 #[unsafe(method(matchmakerViewController:didFindHostedPlayers:))]
299 #[unsafe(method_family = none)]
300 unsafe fn matchmakerViewController_didFindHostedPlayers(
301 &self,
302 view_controller: &GKMatchmakerViewController,
303 players: &NSArray<GKPlayer>,
304 );
305
306 #[cfg(all(
307 feature = "GKBasePlayer",
308 feature = "GKPlayer",
309 feature = "objc2-app-kit"
310 ))]
311 #[cfg(target_os = "macos")]
312 #[optional]
314 #[unsafe(method(matchmakerViewController:hostedPlayerDidAccept:))]
315 #[unsafe(method_family = none)]
316 unsafe fn matchmakerViewController_hostedPlayerDidAccept(
317 &self,
318 view_controller: &GKMatchmakerViewController,
319 player: &GKPlayer,
320 );
321
322 #[cfg(all(
323 feature = "GKBasePlayer",
324 feature = "GKDefines",
325 feature = "GKPlayer",
326 feature = "block2",
327 feature = "objc2-app-kit"
328 ))]
329 #[cfg(target_os = "macos")]
330 #[optional]
333 #[unsafe(method(matchmakerViewController:getMatchPropertiesForRecipient:withCompletionHandler:))]
334 #[unsafe(method_family = none)]
335 unsafe fn matchmakerViewController_getMatchPropertiesForRecipient_withCompletionHandler(
336 &self,
337 view_controller: &GKMatchmakerViewController,
338 recipient: &GKPlayer,
339 completion_handler: &block2::DynBlock<dyn Fn(NonNull<GKMatchProperties>)>,
340 );
341
342 #[cfg(feature = "objc2-app-kit")]
343 #[cfg(target_os = "macos")]
344 #[deprecated]
346 #[optional]
347 #[unsafe(method(matchmakerViewController:didFindPlayers:))]
348 #[unsafe(method_family = none)]
349 unsafe fn matchmakerViewController_didFindPlayers(
350 &self,
351 view_controller: &GKMatchmakerViewController,
352 player_i_ds: &NSArray<NSString>,
353 );
354
355 #[cfg(feature = "objc2-app-kit")]
356 #[cfg(target_os = "macos")]
357 #[deprecated]
358 #[optional]
359 #[unsafe(method(matchmakerViewController:didReceiveAcceptFromHostedPlayer:))]
360 #[unsafe(method_family = none)]
361 unsafe fn matchmakerViewController_didReceiveAcceptFromHostedPlayer(
362 &self,
363 view_controller: &GKMatchmakerViewController,
364 player_id: &NSString,
365 );
366 }
367);