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")]
46extern_conformance!(
47    unsafe impl NSCoding for SCNReferenceNode {}
48);
49
50#[cfg(feature = "SCNNode")]
51extern_conformance!(
52    unsafe impl NSCopying for SCNReferenceNode {}
53);
54
55#[cfg(feature = "SCNNode")]
56unsafe impl CopyingHelper for SCNReferenceNode {
57    type Result = Self;
58}
59
60#[cfg(feature = "SCNNode")]
61extern_conformance!(
62    unsafe impl NSObjectProtocol for SCNReferenceNode {}
63);
64
65#[cfg(feature = "SCNNode")]
66extern_conformance!(
67    unsafe impl NSSecureCoding for SCNReferenceNode {}
68);
69
70#[cfg(all(feature = "SCNAction", feature = "SCNNode"))]
71extern_conformance!(
72    unsafe impl SCNActionable for SCNReferenceNode {}
73);
74
75#[cfg(all(feature = "SCNAnimation", feature = "SCNNode"))]
76extern_conformance!(
77    unsafe impl SCNAnimatable for SCNReferenceNode {}
78);
79
80#[cfg(all(feature = "SCNBoundingVolume", feature = "SCNNode"))]
81extern_conformance!(
82    unsafe impl SCNBoundingVolume for SCNReferenceNode {}
83);
84
85#[cfg(feature = "SCNNode")]
86impl SCNReferenceNode {
87    extern_methods!(
88        /// Creates a reference node with a url.
89        #[unsafe(method(initWithURL:))]
90        #[unsafe(method_family = init)]
91        pub unsafe fn initWithURL(
92            this: Allocated<Self>,
93            reference_url: &NSURL,
94        ) -> Option<Retained<Self>>;
95
96        /// Support coding and decoding via NSKeyedArchiver.
97        ///
98        /// # Safety
99        ///
100        /// `a_decoder` possibly has further requirements.
101        #[unsafe(method(initWithCoder:))]
102        #[unsafe(method_family = init)]
103        pub unsafe fn initWithCoder(
104            this: Allocated<Self>,
105            a_decoder: &NSCoder,
106        ) -> Option<Retained<Self>>;
107
108        /// Creates a reference node with a url.
109        #[unsafe(method(referenceNodeWithURL:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn referenceNodeWithURL(reference_url: &NSURL) -> Option<Retained<Self>>;
112
113        /// Specifies the url to resolve.
114        #[unsafe(method(referenceURL))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn referenceURL(&self) -> Retained<NSURL>;
117
118        /// Setter for [`referenceURL`][Self::referenceURL].
119        ///
120        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
121        #[unsafe(method(setReferenceURL:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn setReferenceURL(&self, reference_url: &NSURL);
124
125        /// Specifies when to load the reference. see SCNReferenceLoadingPolicy above. Defaults to SCNReferenceLoadingPolicyImmediately.
126        #[unsafe(method(loadingPolicy))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn loadingPolicy(&self) -> SCNReferenceLoadingPolicy;
129
130        /// Setter for [`loadingPolicy`][Self::loadingPolicy].
131        #[unsafe(method(setLoadingPolicy:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn setLoadingPolicy(&self, loading_policy: SCNReferenceLoadingPolicy);
134
135        /// Force the reference to be loaded if it hasn't been loaded already. The resolved nodes will be added
136        /// as child nodes of the receiver.
137        #[unsafe(method(load))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn load(&self);
140
141        /// Remove the child nodes and mark as unloaded.
142        #[unsafe(method(unload))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn unload(&self);
145
146        /// Indicates whether the referenced URL has been loaded.
147        #[unsafe(method(isLoaded))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn isLoaded(&self) -> bool;
150    );
151}
152
153/// Methods declared on superclass `SCNNode`.
154#[cfg(feature = "SCNNode")]
155impl SCNReferenceNode {
156    extern_methods!(
157        /// Creates and initializes a node instance.
158        #[unsafe(method(node))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn node() -> Retained<Self>;
161    );
162}
163
164/// Methods declared on superclass `NSObject`.
165#[cfg(feature = "SCNNode")]
166impl SCNReferenceNode {
167    extern_methods!(
168        #[unsafe(method(init))]
169        #[unsafe(method_family = init)]
170        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
171
172        #[unsafe(method(new))]
173        #[unsafe(method_family = new)]
174        pub unsafe fn new() -> Retained<Self>;
175    );
176}