objc2_game_kit/generated/
GKAccessPoint.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/gkaccesspointlocation?language=objc)
14// NS_ENUM
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct GKAccessPointLocation(pub NSInteger);
18impl GKAccessPointLocation {
19    #[doc(alias = "GKAccessPointLocationTopLeading")]
20    pub const TopLeading: Self = Self(0);
21    #[doc(alias = "GKAccessPointLocationTopTrailing")]
22    pub const TopTrailing: Self = Self(1);
23    #[doc(alias = "GKAccessPointLocationBottomLeading")]
24    pub const BottomLeading: Self = Self(2);
25    #[doc(alias = "GKAccessPointLocationBottomTrailing")]
26    pub const BottomTrailing: Self = Self(3);
27}
28
29unsafe impl Encode for GKAccessPointLocation {
30    const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for GKAccessPointLocation {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37extern_class!(
38    /// [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkaccesspoint?language=objc)
39    #[unsafe(super(NSObject))]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    pub struct GKAccessPoint;
42);
43
44extern_conformance!(
45    unsafe impl NSObjectProtocol for GKAccessPoint {}
46);
47
48impl GKAccessPoint {
49    extern_methods!(
50        #[unsafe(method(shared))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn shared() -> Retained<GKAccessPoint>;
53
54        /// set this true to enable access point in your app.  Setting this will cause the access point to appear after the notification banner is presented.  If it already was presented it will appear immediately
55        #[unsafe(method(isActive))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn isActive(&self) -> bool;
58
59        /// Setter for [`isActive`][Self::isActive].
60        #[unsafe(method(setActive:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn setActive(&self, active: bool);
63
64        /// set this on tvOS to put the accessPoint into focused mode
65        #[unsafe(method(isFocused))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn isFocused(&self) -> bool;
68
69        /// Setter for [`isFocused`][Self::isFocused].
70        #[unsafe(method(setFocused:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setFocused(&self, focused: bool);
73
74        #[unsafe(method(isVisible))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn isVisible(&self) -> bool;
77
78        /// observable property that indicates when the access point is visible.
79        #[unsafe(method(isPresentingGameCenter))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn isPresentingGameCenter(&self) -> bool;
82
83        /// Set this property to true if you wish to show the highlights for most recent achievement, current rank on default leaderboard, etc
84        #[deprecated = "No longer supported"]
85        #[unsafe(method(showHighlights))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn showHighlights(&self) -> bool;
88
89        /// Setter for [`showHighlights`][Self::showHighlights].
90        #[deprecated = "No longer supported"]
91        #[unsafe(method(setShowHighlights:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setShowHighlights(&self, show_highlights: bool);
94
95        /// These properties control the placement of the widget
96        #[unsafe(method(location))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn location(&self) -> GKAccessPointLocation;
99
100        /// Setter for [`location`][Self::location].
101        #[unsafe(method(setLocation:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn setLocation(&self, location: GKAccessPointLocation);
104
105        /// observable property that contains the current frame needed to display the widget
106        #[unsafe(method(frameInScreenCoordinates))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn frameInScreenCoordinates(&self) -> NSRect;
109
110        #[cfg(feature = "objc2-app-kit")]
111        #[cfg(target_os = "macos")]
112        /// the following is a platform specific window that you wish to have the access point in.  If not set then a best attempt will be made to choose the main window of the app.
113        #[unsafe(method(parentWindow))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn parentWindow(&self, mtm: MainThreadMarker) -> Option<Retained<NSWindow>>;
116
117        #[cfg(feature = "objc2-app-kit")]
118        #[cfg(target_os = "macos")]
119        /// Setter for [`parentWindow`][Self::parentWindow].
120        ///
121        /// This is a [weak property][objc2::topics::weak_property].
122        #[unsafe(method(setParentWindow:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setParentWindow(&self, parent_window: Option<&NSWindow>);
125
126        #[cfg(feature = "block2")]
127        /// this lets the developer trigger the access point as if the user had touched it.  This is useful for games that use controllers or the remote on AppleTV.  the argument lets you specify a specific state (default, profile, achievements, leaderboards) for GameCenterViewController
128        #[unsafe(method(triggerAccessPointWithHandler:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn triggerAccessPointWithHandler(&self, handler: &block2::DynBlock<dyn Fn()>);
131
132        #[cfg(all(feature = "GKGameCenterViewController", feature = "block2"))]
133        #[unsafe(method(triggerAccessPointWithState:handler:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn triggerAccessPointWithState_handler(
136            &self,
137            state: GKGameCenterViewControllerState,
138            handler: &block2::DynBlock<dyn Fn()>,
139        );
140
141        #[cfg(feature = "block2")]
142        #[unsafe(method(triggerAccessPointWithAchievementID:handler:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn triggerAccessPointWithAchievementID_handler(
145            &self,
146            achievement_id: &NSString,
147            handler: Option<&block2::DynBlock<dyn Fn()>>,
148        );
149
150        #[cfg(feature = "block2")]
151        #[unsafe(method(triggerAccessPointWithLeaderboardSetID:handler:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn triggerAccessPointWithLeaderboardSetID_handler(
154            &self,
155            leaderboard_set_id: &NSString,
156            handler: Option<&block2::DynBlock<dyn Fn()>>,
157        );
158
159        #[cfg(all(feature = "GKLeaderboard", feature = "block2"))]
160        #[unsafe(method(triggerAccessPointWithLeaderboardID:playerScope:timeScope:handler:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn triggerAccessPointWithLeaderboardID_playerScope_timeScope_handler(
163            &self,
164            leaderboard_id: &NSString,
165            player_scope: GKLeaderboardPlayerScope,
166            time_scope: GKLeaderboardTimeScope,
167            handler: Option<&block2::DynBlock<dyn Fn()>>,
168        );
169
170        #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer", feature = "block2"))]
171        #[unsafe(method(triggerAccessPointWithPlayer:handler:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn triggerAccessPointWithPlayer_handler(
174            &self,
175            player: &GKPlayer,
176            handler: Option<&block2::DynBlock<dyn Fn()>>,
177        );
178
179        #[cfg(feature = "block2")]
180        /// Displays the view that allows players to engage each other with activities and challenges.
181        #[unsafe(method(triggerAccessPointForPlayTogetherWithHandler:))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn triggerAccessPointForPlayTogetherWithHandler(
184            &self,
185            handler: Option<&block2::DynBlock<dyn Fn()>>,
186        );
187
188        #[cfg(feature = "block2")]
189        /// Displays the view that allows players to engage each other with challenges.
190        #[unsafe(method(triggerAccessPointForChallengesWithHandler:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn triggerAccessPointForChallengesWithHandler(
193            &self,
194            handler: Option<&block2::DynBlock<dyn Fn()>>,
195        );
196
197        #[cfg(feature = "block2")]
198        /// Displays the challenge creation view for the provided challenge definition ID.
199        #[unsafe(method(triggerAccessPointWithChallengeDefinitionID:handler:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn triggerAccessPointWithChallengeDefinitionID_handler(
202            &self,
203            challenge_definition_id: &NSString,
204            handler: Option<&block2::DynBlock<dyn Fn()>>,
205        );
206
207        #[cfg(feature = "block2")]
208        /// Displays the game activity creation view for the provided activity definition ID.
209        #[unsafe(method(triggerAccessPointWithGameActivityDefinitionID:handler:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn triggerAccessPointWithGameActivityDefinitionID_handler(
212            &self,
213            game_activity_definition_id: &NSString,
214            handler: Option<&block2::DynBlock<dyn Fn()>>,
215        );
216
217        #[cfg(all(feature = "GKGameActivity", feature = "block2"))]
218        /// Displays the game activity view for the provided activity instance.
219        #[unsafe(method(triggerAccessPointWithGameActivity:handler:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn triggerAccessPointWithGameActivity_handler(
222            &self,
223            game_activity: &GKGameActivity,
224            handler: Option<&block2::DynBlock<dyn Fn()>>,
225        );
226
227        #[cfg(feature = "block2")]
228        /// Brings up the invite friends view.
229        #[unsafe(method(triggerAccessPointForFriendingWithHandler:))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn triggerAccessPointForFriendingWithHandler(
232            &self,
233            handler: Option<&block2::DynBlock<dyn Fn()>>,
234        );
235    );
236}
237
238/// Methods declared on superclass `NSObject`.
239impl GKAccessPoint {
240    extern_methods!(
241        #[unsafe(method(init))]
242        #[unsafe(method_family = init)]
243        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
244
245        #[unsafe(method(new))]
246        #[unsafe(method_family = new)]
247        pub unsafe fn new() -> Retained<Self>;
248    );
249}