objc2_scene_kit/generated/
SCNReferenceNode.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// Controls whenever to load the reference node.
11///
12/// When the load policy is set to SCNReferenceLoadingPolicyImmediately, the reference is loaded immediately when the SCNReferenceNode is unarchived.
13/// When the load policy is set to SCNReferenceLoadingPolicyOnDemand the reference is never loaded until "load" is explicitly invoked.
14///
15/// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnreferenceloadingpolicy?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct SCNReferenceLoadingPolicy(pub NSInteger);
20impl SCNReferenceLoadingPolicy {
21    #[doc(alias = "SCNReferenceLoadingPolicyImmediate")]
22    pub const Immediate: Self = Self(0);
23    #[doc(alias = "SCNReferenceLoadingPolicyOnDemand")]
24    pub const OnDemand: Self = Self(1);
25}
26
27unsafe impl Encode for SCNReferenceLoadingPolicy {
28    const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for SCNReferenceLoadingPolicy {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36    /// Node that references an external file.
37    ///
38    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnreferencenode?language=objc)
39    #[unsafe(super(SCNNode, NSObject))]
40    #[derive(Debug, PartialEq, Eq, Hash)]
41    #[cfg(feature = "SCNNode")]
42    pub struct SCNReferenceNode;
43);
44
45#[cfg(feature = "SCNNode")]
46unsafe impl NSCoding for SCNReferenceNode {}
47
48#[cfg(feature = "SCNNode")]
49unsafe impl NSCopying for SCNReferenceNode {}
50
51#[cfg(feature = "SCNNode")]
52unsafe impl CopyingHelper for SCNReferenceNode {
53    type Result = Self;
54}
55
56#[cfg(feature = "SCNNode")]
57unsafe impl NSObjectProtocol for SCNReferenceNode {}
58
59#[cfg(feature = "SCNNode")]
60unsafe impl NSSecureCoding for SCNReferenceNode {}
61
62#[cfg(all(feature = "SCNAction", feature = "SCNNode"))]
63unsafe impl SCNActionable for SCNReferenceNode {}
64
65#[cfg(all(feature = "SCNAnimation", feature = "SCNNode"))]
66unsafe impl SCNAnimatable for SCNReferenceNode {}
67
68#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNNode"))]
69unsafe impl SCNBoundingVolume for SCNReferenceNode {}
70
71#[cfg(feature = "SCNNode")]
72impl SCNReferenceNode {
73    extern_methods!(
74        /// Creates a reference node with a url.
75        #[unsafe(method(initWithURL:))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn initWithURL(
78            this: Allocated<Self>,
79            reference_url: &NSURL,
80        ) -> Option<Retained<Self>>;
81
82        /// Support coding and decoding via NSKeyedArchiver.
83        #[unsafe(method(initWithCoder:))]
84        #[unsafe(method_family = init)]
85        pub unsafe fn initWithCoder(
86            this: Allocated<Self>,
87            a_decoder: &NSCoder,
88        ) -> Option<Retained<Self>>;
89
90        /// Creates a reference node with a url.
91        #[unsafe(method(referenceNodeWithURL:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn referenceNodeWithURL(reference_url: &NSURL) -> Option<Retained<Self>>;
94
95        /// Specifies the url to resolve.
96        #[unsafe(method(referenceURL))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn referenceURL(&self) -> Retained<NSURL>;
99
100        /// Setter for [`referenceURL`][Self::referenceURL].
101        #[unsafe(method(setReferenceURL:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn setReferenceURL(&self, reference_url: &NSURL);
104
105        /// Specifies when to load the reference. see SCNReferenceLoadingPolicy above. Defaults to SCNReferenceLoadingPolicyImmediately.
106        #[unsafe(method(loadingPolicy))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn loadingPolicy(&self) -> SCNReferenceLoadingPolicy;
109
110        /// Setter for [`loadingPolicy`][Self::loadingPolicy].
111        #[unsafe(method(setLoadingPolicy:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setLoadingPolicy(&self, loading_policy: SCNReferenceLoadingPolicy);
114
115        /// Force the reference to be loaded if it hasn't been loaded already. The resolved nodes will be added
116        /// as child nodes of the receiver.
117        #[unsafe(method(load))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn load(&self);
120
121        /// Remove the child nodes and mark as unloaded.
122        #[unsafe(method(unload))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn unload(&self);
125
126        /// Indicates whether the referenced URL has been loaded.
127        #[unsafe(method(isLoaded))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn isLoaded(&self) -> bool;
130    );
131}
132
133/// Methods declared on superclass `SCNNode`.
134#[cfg(feature = "SCNNode")]
135impl SCNReferenceNode {
136    extern_methods!(
137        /// Creates and initializes a node instance.
138        #[unsafe(method(node))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn node() -> Retained<Self>;
141    );
142}
143
144/// Methods declared on superclass `NSObject`.
145#[cfg(feature = "SCNNode")]
146impl SCNReferenceNode {
147    extern_methods!(
148        #[unsafe(method(init))]
149        #[unsafe(method_family = init)]
150        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
151
152        #[unsafe(method(new))]
153        #[unsafe(method_family = new)]
154        pub unsafe fn new() -> Retained<Self>;
155    );
156}