objc2_sprite_kit/generated/
SKNode.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::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15/// Blend modes that the SKNode uses to compose with the framebuffer to produce blended colors.
16///
17/// See also [Apple's documentation](https://developer.apple.com/documentation/spritekit/skblendmode?language=objc)
18// NS_ENUM
19#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct SKBlendMode(pub NSInteger);
22impl SKBlendMode {
23    #[doc(alias = "SKBlendModeAlpha")]
24    pub const Alpha: Self = Self(0);
25    #[doc(alias = "SKBlendModeAdd")]
26    pub const Add: Self = Self(1);
27    #[doc(alias = "SKBlendModeSubtract")]
28    pub const Subtract: Self = Self(2);
29    #[doc(alias = "SKBlendModeMultiply")]
30    pub const Multiply: Self = Self(3);
31    #[doc(alias = "SKBlendModeMultiplyX2")]
32    pub const MultiplyX2: Self = Self(4);
33    #[doc(alias = "SKBlendModeScreen")]
34    pub const Screen: Self = Self(5);
35    #[doc(alias = "SKBlendModeReplace")]
36    pub const Replace: Self = Self(6);
37    #[doc(alias = "SKBlendModeMultiplyAlpha")]
38    pub const MultiplyAlpha: Self = Self(7);
39}
40
41unsafe impl Encode for SKBlendMode {
42    const ENCODING: Encoding = NSInteger::ENCODING;
43}
44
45unsafe impl RefEncode for SKBlendMode {
46    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
47}
48
49/// [Apple's documentation](https://developer.apple.com/documentation/spritekit/sknodefocusbehavior?language=objc)
50// NS_ENUM
51#[repr(transparent)]
52#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
53pub struct SKNodeFocusBehavior(pub NSInteger);
54impl SKNodeFocusBehavior {
55    #[doc(alias = "SKNodeFocusBehaviorNone")]
56    pub const None: Self = Self(0);
57    #[doc(alias = "SKNodeFocusBehaviorOccluding")]
58    pub const Occluding: Self = Self(1);
59    #[doc(alias = "SKNodeFocusBehaviorFocusable")]
60    pub const Focusable: Self = Self(2);
61}
62
63unsafe impl Encode for SKNodeFocusBehavior {
64    const ENCODING: Encoding = NSInteger::ENCODING;
65}
66
67unsafe impl RefEncode for SKNodeFocusBehavior {
68    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
69}
70
71extern_class!(
72    /// [Apple's documentation](https://developer.apple.com/documentation/spritekit/sknode?language=objc)
73    #[unsafe(super(NSResponder, NSObject))]
74    #[derive(Debug, PartialEq, Eq, Hash)]
75    #[cfg(feature = "objc2-app-kit")]
76    #[cfg(target_os = "macos")]
77    pub struct SKNode;
78);
79
80#[cfg(feature = "objc2-app-kit")]
81#[cfg(target_os = "macos")]
82extern_conformance!(
83    unsafe impl NSCoding for SKNode {}
84);
85
86#[cfg(feature = "objc2-app-kit")]
87#[cfg(target_os = "macos")]
88extern_conformance!(
89    unsafe impl NSCopying for SKNode {}
90);
91
92#[cfg(feature = "objc2-app-kit")]
93#[cfg(target_os = "macos")]
94unsafe impl CopyingHelper for SKNode {
95    type Result = Self;
96}
97
98#[cfg(feature = "objc2-app-kit")]
99#[cfg(target_os = "macos")]
100extern_conformance!(
101    unsafe impl NSObjectProtocol for SKNode {}
102);
103
104#[cfg(feature = "objc2-app-kit")]
105#[cfg(target_os = "macos")]
106extern_conformance!(
107    unsafe impl NSSecureCoding for SKNode {}
108);
109
110#[cfg(feature = "objc2-app-kit")]
111#[cfg(target_os = "macos")]
112impl SKNode {
113    extern_methods!(
114        #[unsafe(method(init))]
115        #[unsafe(method_family = init)]
116        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
117
118        /// Support coding and decoding via NSKeyedArchiver.
119        ///
120        /// # Safety
121        ///
122        /// `a_decoder` possibly has further requirements.
123        #[unsafe(method(initWithCoder:))]
124        #[unsafe(method_family = init)]
125        pub unsafe fn initWithCoder(
126            this: Allocated<Self>,
127            a_decoder: &NSCoder,
128        ) -> Option<Retained<Self>>;
129
130        #[unsafe(method(node))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn node(mtm: MainThreadMarker) -> Retained<Self>;
133
134        #[unsafe(method(nodeWithFileNamed:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn nodeWithFileNamed(
137            filename: &NSString,
138            mtm: MainThreadMarker,
139        ) -> Option<Retained<Self>>;
140
141        /// # Safety
142        ///
143        /// `classes` generic probably has further requirements.
144        #[unsafe(method(nodeWithFileNamed:securelyWithClasses:andError:_))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn nodeWithFileNamed_securelyWithClasses_andError(
147            filename: &NSString,
148            classes: &NSSet<AnyClass>,
149            mtm: MainThreadMarker,
150        ) -> Result<Retained<Self>, Retained<NSError>>;
151
152        #[cfg(feature = "objc2-core-foundation")]
153        #[unsafe(method(frame))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn frame(&self) -> CGRect;
156
157        #[cfg(feature = "objc2-core-foundation")]
158        /// Calculates the bounding box including all child nodes in parents coordinate system.
159        #[unsafe(method(calculateAccumulatedFrame))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn calculateAccumulatedFrame(&self) -> CGRect;
162
163        #[cfg(feature = "objc2-core-foundation")]
164        /// The position of the node in the parent's coordinate system
165        #[unsafe(method(position))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn position(&self) -> CGPoint;
168
169        #[cfg(feature = "objc2-core-foundation")]
170        /// Setter for [`position`][Self::position].
171        #[unsafe(method(setPosition:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn setPosition(&self, position: CGPoint);
174
175        #[cfg(feature = "objc2-core-foundation")]
176        /// The z-order of the node (used for ordering). Negative z is "into" the screen, Positive z is "out" of the screen. A greater zPosition will sort in front of a lesser zPosition.
177        #[unsafe(method(zPosition))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn zPosition(&self) -> CGFloat;
180
181        #[cfg(feature = "objc2-core-foundation")]
182        /// Setter for [`zPosition`][Self::zPosition].
183        #[unsafe(method(setZPosition:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn setZPosition(&self, z_position: CGFloat);
186
187        #[cfg(feature = "objc2-core-foundation")]
188        /// The Euler rotation about the z axis (in radians)
189        #[unsafe(method(zRotation))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn zRotation(&self) -> CGFloat;
192
193        #[cfg(feature = "objc2-core-foundation")]
194        /// Setter for [`zRotation`][Self::zRotation].
195        #[unsafe(method(setZRotation:))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn setZRotation(&self, z_rotation: CGFloat);
198
199        #[cfg(feature = "objc2-core-foundation")]
200        /// The scaling in the X axis
201        #[unsafe(method(xScale))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn xScale(&self) -> CGFloat;
204
205        #[cfg(feature = "objc2-core-foundation")]
206        /// Setter for [`xScale`][Self::xScale].
207        #[unsafe(method(setXScale:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn setXScale(&self, x_scale: CGFloat);
210
211        #[cfg(feature = "objc2-core-foundation")]
212        /// The scaling in the Y axis
213        #[unsafe(method(yScale))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn yScale(&self) -> CGFloat;
216
217        #[cfg(feature = "objc2-core-foundation")]
218        /// Setter for [`yScale`][Self::yScale].
219        #[unsafe(method(setYScale:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn setYScale(&self, y_scale: CGFloat);
222
223        #[cfg(feature = "objc2-core-foundation")]
224        /// The speed multiplier applied to all actions run on this node. Inherited by its children.
225        #[unsafe(method(speed))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn speed(&self) -> CGFloat;
228
229        #[cfg(feature = "objc2-core-foundation")]
230        /// Setter for [`speed`][Self::speed].
231        #[unsafe(method(setSpeed:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn setSpeed(&self, speed: CGFloat);
234
235        #[cfg(feature = "objc2-core-foundation")]
236        /// Alpha of this node (multiplied by the output color to give the final result)
237        #[unsafe(method(alpha))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn alpha(&self) -> CGFloat;
240
241        #[cfg(feature = "objc2-core-foundation")]
242        /// Setter for [`alpha`][Self::alpha].
243        #[unsafe(method(setAlpha:))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn setAlpha(&self, alpha: CGFloat);
246
247        /// Controls whether or not the node's actions is updated or paused.
248        #[unsafe(method(isPaused))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn isPaused(&self) -> bool;
251
252        /// Setter for [`isPaused`][Self::isPaused].
253        #[unsafe(method(setPaused:))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn setPaused(&self, paused: bool);
256
257        /// Controls whether or not the node and its children are rendered.
258        #[unsafe(method(isHidden))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn isHidden(&self) -> bool;
261
262        /// Setter for [`isHidden`][Self::isHidden].
263        #[unsafe(method(setHidden:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn setHidden(&self, hidden: bool);
266
267        /// Controls whether or not the node receives touch events
268        #[unsafe(method(isUserInteractionEnabled))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn isUserInteractionEnabled(&self) -> bool;
271
272        /// Setter for [`isUserInteractionEnabled`][Self::isUserInteractionEnabled].
273        #[unsafe(method(setUserInteractionEnabled:))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);
276
277        /// Determines how this node participates in the focus system.  The default is SKNodeFocusBehaviorNone.
278        #[unsafe(method(focusBehavior))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn focusBehavior(&self) -> SKNodeFocusBehavior;
281
282        /// Setter for [`focusBehavior`][Self::focusBehavior].
283        #[unsafe(method(setFocusBehavior:))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn setFocusBehavior(&self, focus_behavior: SKNodeFocusBehavior);
286
287        /// The parent of the node.
288        ///
289        /// If this is nil the node has not been added to another group and is thus the root node of its own graph.
290        #[unsafe(method(parent))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn parent(&self) -> Option<Retained<SKNode>>;
293
294        /// The children of this node.
295        #[unsafe(method(children))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn children(&self) -> Retained<NSArray<SKNode>>;
298
299        /// The client assignable name.
300        ///
301        /// In general, this should be unique among peers in the scene graph.
302        #[unsafe(method(name))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn name(&self) -> Option<Retained<NSString>>;
305
306        /// Setter for [`name`][Self::name].
307        ///
308        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
309        #[unsafe(method(setName:))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn setName(&self, name: Option<&NSString>);
312
313        #[cfg(all(feature = "SKEffectNode", feature = "SKScene"))]
314        /// The scene that the node is currently in.
315        #[unsafe(method(scene))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn scene(&self) -> Option<Retained<SKScene>>;
318
319        #[cfg(feature = "SKPhysicsBody")]
320        /// Physics body attached to the node, with synchronized scale, rotation, and position
321        #[unsafe(method(physicsBody))]
322        #[unsafe(method_family = none)]
323        pub unsafe fn physicsBody(&self) -> Option<Retained<SKPhysicsBody>>;
324
325        #[cfg(feature = "SKPhysicsBody")]
326        /// Setter for [`physicsBody`][Self::physicsBody].
327        #[unsafe(method(setPhysicsBody:))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn setPhysicsBody(&self, physics_body: Option<&SKPhysicsBody>);
330
331        /// An optional dictionary that can be used to store your own data in a node. Defaults to nil.
332        ///
333        /// # Safety
334        ///
335        /// The returned generic should be of the correct type.
336        #[unsafe(method(userData))]
337        #[unsafe(method_family = none)]
338        pub unsafe fn userData(&self) -> Option<Retained<NSMutableDictionary>>;
339
340        /// Setter for [`userData`][Self::userData].
341        ///
342        /// # Safety
343        ///
344        /// `user_data` generic should be of the correct type.
345        #[unsafe(method(setUserData:))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn setUserData(&self, user_data: Option<&NSMutableDictionary>);
348
349        #[cfg(feature = "SKReachConstraints")]
350        /// Kinematic constraints, used in IK solving
351        #[unsafe(method(reachConstraints))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn reachConstraints(&self) -> Option<Retained<SKReachConstraints>>;
354
355        #[cfg(feature = "SKReachConstraints")]
356        /// Setter for [`reachConstraints`][Self::reachConstraints].
357        ///
358        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
359        #[unsafe(method(setReachConstraints:))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn setReachConstraints(&self, reach_constraints: Option<&SKReachConstraints>);
362
363        #[cfg(feature = "SKConstraint")]
364        /// Optional array of SKConstraints
365        /// Constraints are evaluated each frame after actions and physics.
366        /// The node's transform will be changed to satisfy the constraint.
367        #[unsafe(method(constraints))]
368        #[unsafe(method_family = none)]
369        pub unsafe fn constraints(&self) -> Option<Retained<NSArray<SKConstraint>>>;
370
371        #[cfg(feature = "SKConstraint")]
372        /// Setter for [`constraints`][Self::constraints].
373        ///
374        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
375        #[unsafe(method(setConstraints:))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn setConstraints(&self, constraints: Option<&NSArray<SKConstraint>>);
378
379        #[cfg(feature = "SKAttribute")]
380        /// Optional dictionary of SKAttributeValues
381        /// Attributes can be used with custom SKShaders.
382        /// DEPRECATED: Attributes are only available for node classes supporting SKShader (see SKSpriteNode etc.).
383        #[deprecated]
384        #[unsafe(method(attributeValues))]
385        #[unsafe(method_family = none)]
386        pub unsafe fn attributeValues(&self) -> Retained<NSDictionary<NSString, SKAttributeValue>>;
387
388        #[cfg(feature = "SKAttribute")]
389        /// Setter for [`attributeValues`][Self::attributeValues].
390        ///
391        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
392        #[deprecated]
393        #[unsafe(method(setAttributeValues:))]
394        #[unsafe(method_family = none)]
395        pub unsafe fn setAttributeValues(
396            &self,
397            attribute_values: &NSDictionary<NSString, SKAttributeValue>,
398        );
399
400        #[cfg(feature = "SKAttribute")]
401        #[deprecated]
402        #[unsafe(method(valueForAttributeNamed:))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn valueForAttributeNamed(
405            &self,
406            key: &NSString,
407        ) -> Option<Retained<SKAttributeValue>>;
408
409        #[cfg(feature = "SKAttribute")]
410        #[deprecated]
411        #[unsafe(method(setValue:forAttributeNamed:))]
412        #[unsafe(method_family = none)]
413        pub unsafe fn setValue_forAttributeNamed(&self, value: &SKAttributeValue, key: &NSString);
414
415        #[cfg(feature = "objc2-core-foundation")]
416        /// Sets both the x
417        /// &
418        /// y scale
419        ///
420        ///
421        /// Parameter `scale`: the uniform scale to set.
422        #[unsafe(method(setScale:))]
423        #[unsafe(method_family = none)]
424        pub unsafe fn setScale(&self, scale: CGFloat);
425
426        /// Adds a node as a child node of this node
427        ///
428        /// The added node must not have a parent.
429        ///
430        ///
431        /// Parameter `node`: the child node to add.
432        #[unsafe(method(addChild:))]
433        #[unsafe(method_family = none)]
434        pub unsafe fn addChild(&self, node: &SKNode);
435
436        #[unsafe(method(insertChild:atIndex:))]
437        #[unsafe(method_family = none)]
438        pub unsafe fn insertChild_atIndex(&self, node: &SKNode, index: NSInteger);
439
440        #[unsafe(method(removeChildrenInArray:))]
441        #[unsafe(method_family = none)]
442        pub unsafe fn removeChildrenInArray(&self, nodes: &NSArray<SKNode>);
443
444        #[unsafe(method(removeAllChildren))]
445        #[unsafe(method_family = none)]
446        pub unsafe fn removeAllChildren(&self);
447
448        #[unsafe(method(removeFromParent))]
449        #[unsafe(method_family = none)]
450        pub unsafe fn removeFromParent(&self);
451
452        #[unsafe(method(moveToParent:))]
453        #[unsafe(method_family = none)]
454        pub unsafe fn moveToParent(&self, parent: &SKNode);
455
456        #[unsafe(method(childNodeWithName:))]
457        #[unsafe(method_family = none)]
458        pub unsafe fn childNodeWithName(&self, name: &NSString) -> Option<Retained<SKNode>>;
459
460        #[cfg(feature = "block2")]
461        #[unsafe(method(enumerateChildNodesWithName:usingBlock:))]
462        #[unsafe(method_family = none)]
463        pub unsafe fn enumerateChildNodesWithName_usingBlock(
464            &self,
465            name: &NSString,
466            block: &block2::DynBlock<dyn Fn(NonNull<SKNode>, NonNull<Bool>)>,
467        );
468
469        /// Simplified shorthand for enumerateChildNodesWithName that returns an array of the matching nodes.
470        /// This allows subscripting of the form:
471        /// NSArray *childrenMatchingName = node[
472        /// "
473        /// name"]
474        ///
475        /// or even complex like:
476        /// NSArray *siblingsBeginningWithA = node[
477        /// "
478        /// ../a*"]
479        ///
480        ///
481        /// Parameter `name`: An Xpath style path that can include simple regular expressions for matching node names.
482        ///
483        /// See: enumerateChildNodesWithName:usingBlock:
484        #[unsafe(method(objectForKeyedSubscript:))]
485        #[unsafe(method_family = none)]
486        pub unsafe fn objectForKeyedSubscript(&self, name: &NSString) -> Retained<NSArray<SKNode>>;
487
488        #[unsafe(method(inParentHierarchy:))]
489        #[unsafe(method_family = none)]
490        pub unsafe fn inParentHierarchy(&self, parent: &SKNode) -> bool;
491
492        #[cfg(feature = "SKAction")]
493        #[unsafe(method(runAction:))]
494        #[unsafe(method_family = none)]
495        pub unsafe fn runAction(&self, action: &SKAction);
496
497        #[cfg(all(feature = "SKAction", feature = "block2"))]
498        #[unsafe(method(runAction:completion:))]
499        #[unsafe(method_family = none)]
500        pub unsafe fn runAction_completion(
501            &self,
502            action: &SKAction,
503            block: &block2::DynBlock<dyn Fn()>,
504        );
505
506        #[cfg(feature = "SKAction")]
507        #[unsafe(method(runAction:withKey:))]
508        #[unsafe(method_family = none)]
509        pub unsafe fn runAction_withKey(&self, action: &SKAction, key: &NSString);
510
511        #[unsafe(method(hasActions))]
512        #[unsafe(method_family = none)]
513        pub unsafe fn hasActions(&self) -> bool;
514
515        #[cfg(feature = "SKAction")]
516        #[unsafe(method(actionForKey:))]
517        #[unsafe(method_family = none)]
518        pub unsafe fn actionForKey(&self, key: &NSString) -> Option<Retained<SKAction>>;
519
520        #[unsafe(method(removeActionForKey:))]
521        #[unsafe(method_family = none)]
522        pub unsafe fn removeActionForKey(&self, key: &NSString);
523
524        #[unsafe(method(removeAllActions))]
525        #[unsafe(method_family = none)]
526        pub unsafe fn removeAllActions(&self);
527
528        #[cfg(feature = "objc2-core-foundation")]
529        #[unsafe(method(containsPoint:))]
530        #[unsafe(method_family = none)]
531        pub unsafe fn containsPoint(&self, p: CGPoint) -> bool;
532
533        #[cfg(feature = "objc2-core-foundation")]
534        /// Returns the node itself or a child node at the point given.
535        /// If the receiver is returned there is no child node at the given point.
536        ///
537        /// Returns: a child node or self at the given location.
538        #[unsafe(method(nodeAtPoint:))]
539        #[unsafe(method_family = none)]
540        pub unsafe fn nodeAtPoint(&self, p: CGPoint) -> Retained<SKNode>;
541
542        #[cfg(feature = "objc2-core-foundation")]
543        #[unsafe(method(nodesAtPoint:))]
544        #[unsafe(method_family = none)]
545        pub unsafe fn nodesAtPoint(&self, p: CGPoint) -> Retained<NSArray<SKNode>>;
546
547        #[cfg(feature = "objc2-core-foundation")]
548        #[unsafe(method(convertPoint:fromNode:))]
549        #[unsafe(method_family = none)]
550        pub unsafe fn convertPoint_fromNode(&self, point: CGPoint, node: &SKNode) -> CGPoint;
551
552        #[cfg(feature = "objc2-core-foundation")]
553        #[unsafe(method(convertPoint:toNode:))]
554        #[unsafe(method_family = none)]
555        pub unsafe fn convertPoint_toNode(&self, point: CGPoint, node: &SKNode) -> CGPoint;
556
557        #[unsafe(method(intersectsNode:))]
558        #[unsafe(method_family = none)]
559        pub unsafe fn intersectsNode(&self, node: &SKNode) -> bool;
560
561        #[unsafe(method(isEqualToNode:))]
562        #[unsafe(method_family = none)]
563        pub unsafe fn isEqualToNode(&self, node: &SKNode) -> bool;
564    );
565}
566
567/// Methods declared on superclass `NSObject`.
568#[cfg(feature = "objc2-app-kit")]
569#[cfg(target_os = "macos")]
570impl SKNode {
571    extern_methods!(
572        #[unsafe(method(new))]
573        #[unsafe(method_family = new)]
574        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
575    );
576}
577
578mod private_NSEventSKNodeEvent {
579    pub trait Sealed {}
580}
581
582/// Category "SKNodeEvent" on [`NSEvent`].
583#[doc(alias = "SKNodeEvent")]
584pub unsafe trait NSEventSKNodeEvent:
585    ClassType + Sized + private_NSEventSKNodeEvent::Sealed
586{
587    extern_methods!(
588        #[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
589        #[cfg(target_os = "macos")]
590        #[unsafe(method(locationInNode:))]
591        #[unsafe(method_family = none)]
592        unsafe fn locationInNode(&self, node: &SKNode) -> CGPoint;
593    );
594}
595
596#[cfg(feature = "objc2-app-kit")]
597#[cfg(target_os = "macos")]
598impl private_NSEventSKNodeEvent::Sealed for NSEvent {}
599#[cfg(feature = "objc2-app-kit")]
600#[cfg(target_os = "macos")]
601unsafe impl NSEventSKNodeEvent for NSEvent {}