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:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn setMatchmakerDelegate(
97 &self,
98 matchmaker_delegate: Option<&ProtocolObject<dyn GKMatchmakerViewControllerDelegate>>,
99 );
100
101 #[cfg(feature = "GKMatchmaker")]
102 #[unsafe(method(matchRequest))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn matchRequest(&self) -> Retained<GKMatchRequest>;
105
106 #[unsafe(method(isHosted))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn isHosted(&self) -> bool;
110
111 #[unsafe(method(setHosted:))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn setHosted(&self, hosted: bool);
115
116 #[unsafe(method(matchmakingMode))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn matchmakingMode(&self) -> GKMatchmakingMode;
120
121 #[unsafe(method(setMatchmakingMode:))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn setMatchmakingMode(&self, matchmaking_mode: GKMatchmakingMode);
125
126 #[unsafe(method(canStartWithMinimumPlayers))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn canStartWithMinimumPlayers(&self) -> bool;
132
133 #[unsafe(method(setCanStartWithMinimumPlayers:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn setCanStartWithMinimumPlayers(&self, can_start_with_minimum_players: bool);
137
138 #[cfg(feature = "GKMatchmaker")]
139 #[unsafe(method(initWithMatchRequest:))]
141 #[unsafe(method_family = init)]
142 pub unsafe fn initWithMatchRequest(
143 this: Allocated<Self>,
144 request: &GKMatchRequest,
145 ) -> Option<Retained<Self>>;
146
147 #[cfg(feature = "GKMatchmaker")]
148 #[unsafe(method(initWithInvite:))]
150 #[unsafe(method_family = init)]
151 pub unsafe fn initWithInvite(
152 this: Allocated<Self>,
153 invite: &GKInvite,
154 ) -> Option<Retained<Self>>;
155
156 #[cfg(feature = "GKMatch")]
157 #[unsafe(method(addPlayersToMatch:))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn addPlayersToMatch(&self, r#match: &GKMatch);
162
163 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
164 #[unsafe(method(setHostedPlayer:didConnect:))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn setHostedPlayer_didConnect(&self, player: &GKPlayer, connected: bool);
167
168 #[deprecated = "No longer supported."]
170 #[unsafe(method(defaultInvitationMessage))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn defaultInvitationMessage(&self) -> Option<Retained<NSString>>;
173
174 #[deprecated = "No longer supported."]
176 #[unsafe(method(setDefaultInvitationMessage:))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn setDefaultInvitationMessage(
179 &self,
180 default_invitation_message: Option<&NSString>,
181 );
182 );
183}
184
185#[cfg(feature = "objc2-app-kit")]
187#[cfg(target_os = "macos")]
188impl GKMatchmakerViewController {
189 extern_methods!(
190 #[unsafe(method(initWithNibName:bundle:))]
191 #[unsafe(method_family = init)]
192 pub unsafe fn initWithNibName_bundle(
193 this: Allocated<Self>,
194 nib_name_or_nil: Option<&NSNibName>,
195 nib_bundle_or_nil: Option<&NSBundle>,
196 ) -> Retained<Self>;
197
198 #[unsafe(method(initWithCoder:))]
199 #[unsafe(method_family = init)]
200 pub unsafe fn initWithCoder(
201 this: Allocated<Self>,
202 coder: &NSCoder,
203 ) -> Option<Retained<Self>>;
204 );
205}
206
207#[cfg(feature = "objc2-app-kit")]
209#[cfg(target_os = "macos")]
210impl GKMatchmakerViewController {
211 extern_methods!(
212 #[unsafe(method(init))]
213 #[unsafe(method_family = init)]
214 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
215 );
216}
217
218#[cfg(feature = "objc2-app-kit")]
220#[cfg(target_os = "macos")]
221impl GKMatchmakerViewController {
222 extern_methods!(
223 #[unsafe(method(new))]
224 #[unsafe(method_family = new)]
225 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
226 );
227}
228
229#[cfg(feature = "objc2-app-kit")]
231#[cfg(target_os = "macos")]
232impl GKMatchmakerViewController {
233 extern_methods!(
234 #[deprecated]
236 #[unsafe(method(setHostedPlayer:connected:))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn setHostedPlayer_connected(&self, player_id: &NSString, connected: bool);
239
240 #[deprecated]
242 #[unsafe(method(setHostedPlayerReady:))]
243 #[unsafe(method_family = none)]
244 pub unsafe fn setHostedPlayerReady(&self, player_id: &NSString);
245 );
246}
247
248extern_protocol!(
249 pub unsafe trait GKMatchmakerViewControllerDelegate: NSObjectProtocol {
251 #[cfg(feature = "objc2-app-kit")]
252 #[cfg(target_os = "macos")]
253 #[unsafe(method(matchmakerViewControllerWasCancelled:))]
255 #[unsafe(method_family = none)]
256 unsafe fn matchmakerViewControllerWasCancelled(
257 &self,
258 view_controller: &GKMatchmakerViewController,
259 );
260
261 #[cfg(feature = "objc2-app-kit")]
262 #[cfg(target_os = "macos")]
263 #[unsafe(method(matchmakerViewController:didFailWithError:))]
265 #[unsafe(method_family = none)]
266 unsafe fn matchmakerViewController_didFailWithError(
267 &self,
268 view_controller: &GKMatchmakerViewController,
269 error: &NSError,
270 );
271
272 #[cfg(all(feature = "GKMatch", feature = "objc2-app-kit"))]
273 #[cfg(target_os = "macos")]
274 #[optional]
276 #[unsafe(method(matchmakerViewController:didFindMatch:))]
277 #[unsafe(method_family = none)]
278 unsafe fn matchmakerViewController_didFindMatch(
279 &self,
280 view_controller: &GKMatchmakerViewController,
281 r#match: &GKMatch,
282 );
283
284 #[cfg(all(
285 feature = "GKBasePlayer",
286 feature = "GKPlayer",
287 feature = "objc2-app-kit"
288 ))]
289 #[cfg(target_os = "macos")]
290 #[optional]
292 #[unsafe(method(matchmakerViewController:didFindHostedPlayers:))]
293 #[unsafe(method_family = none)]
294 unsafe fn matchmakerViewController_didFindHostedPlayers(
295 &self,
296 view_controller: &GKMatchmakerViewController,
297 players: &NSArray<GKPlayer>,
298 );
299
300 #[cfg(all(
301 feature = "GKBasePlayer",
302 feature = "GKPlayer",
303 feature = "objc2-app-kit"
304 ))]
305 #[cfg(target_os = "macos")]
306 #[optional]
308 #[unsafe(method(matchmakerViewController:hostedPlayerDidAccept:))]
309 #[unsafe(method_family = none)]
310 unsafe fn matchmakerViewController_hostedPlayerDidAccept(
311 &self,
312 view_controller: &GKMatchmakerViewController,
313 player: &GKPlayer,
314 );
315
316 #[cfg(all(
317 feature = "GKBasePlayer",
318 feature = "GKDefines",
319 feature = "GKPlayer",
320 feature = "block2",
321 feature = "objc2-app-kit"
322 ))]
323 #[cfg(target_os = "macos")]
324 #[optional]
327 #[unsafe(method(matchmakerViewController:getMatchPropertiesForRecipient:withCompletionHandler:))]
328 #[unsafe(method_family = none)]
329 unsafe fn matchmakerViewController_getMatchPropertiesForRecipient_withCompletionHandler(
330 &self,
331 view_controller: &GKMatchmakerViewController,
332 recipient: &GKPlayer,
333 completion_handler: &block2::DynBlock<dyn Fn(NonNull<GKMatchProperties>)>,
334 );
335
336 #[cfg(feature = "objc2-app-kit")]
337 #[cfg(target_os = "macos")]
338 #[deprecated]
340 #[optional]
341 #[unsafe(method(matchmakerViewController:didFindPlayers:))]
342 #[unsafe(method_family = none)]
343 unsafe fn matchmakerViewController_didFindPlayers(
344 &self,
345 view_controller: &GKMatchmakerViewController,
346 player_i_ds: &NSArray<NSString>,
347 );
348
349 #[cfg(feature = "objc2-app-kit")]
350 #[cfg(target_os = "macos")]
351 #[deprecated]
352 #[optional]
353 #[unsafe(method(matchmakerViewController:didReceiveAcceptFromHostedPlayer:))]
354 #[unsafe(method_family = none)]
355 unsafe fn matchmakerViewController_didReceiveAcceptFromHostedPlayer(
356 &self,
357 view_controller: &GKMatchmakerViewController,
358 player_id: &NSString,
359 );
360 }
361);