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        #[unsafe(method(initWithCoder:))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn initWithCoder(
100            this: Allocated<Self>,
101            a_decoder: &NSCoder,
102        ) -> Option<Retained<Self>>;
103
104        /// Creates a reference node with a url.
105        #[unsafe(method(referenceNodeWithURL:))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn referenceNodeWithURL(reference_url: &NSURL) -> Option<Retained<Self>>;
108
109        /// Specifies the url to resolve.
110        #[unsafe(method(referenceURL))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn referenceURL(&self) -> Retained<NSURL>;
113
114        /// Setter for [`referenceURL`][Self::referenceURL].
115        #[unsafe(method(setReferenceURL:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setReferenceURL(&self, reference_url: &NSURL);
118
119        /// Specifies when to load the reference. see SCNReferenceLoadingPolicy above. Defaults to SCNReferenceLoadingPolicyImmediately.
120        #[unsafe(method(loadingPolicy))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn loadingPolicy(&self) -> SCNReferenceLoadingPolicy;
123
124        /// Setter for [`loadingPolicy`][Self::loadingPolicy].
125        #[unsafe(method(setLoadingPolicy:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setLoadingPolicy(&self, loading_policy: SCNReferenceLoadingPolicy);
128
129        /// Force the reference to be loaded if it hasn't been loaded already. The resolved nodes will be added
130        /// as child nodes of the receiver.
131        #[unsafe(method(load))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn load(&self);
134
135        /// Remove the child nodes and mark as unloaded.
136        #[unsafe(method(unload))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn unload(&self);
139
140        /// Indicates whether the referenced URL has been loaded.
141        #[unsafe(method(isLoaded))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn isLoaded(&self) -> bool;
144    );
145}
146
147/// Methods declared on superclass `SCNNode`.
148#[cfg(feature = "SCNNode")]
149impl SCNReferenceNode {
150    extern_methods!(
151        /// Creates and initializes a node instance.
152        #[unsafe(method(node))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn node() -> Retained<Self>;
155    );
156}
157
158/// Methods declared on superclass `NSObject`.
159#[cfg(feature = "SCNNode")]
160impl SCNReferenceNode {
161    extern_methods!(
162        #[unsafe(method(init))]
163        #[unsafe(method_family = init)]
164        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
165
166        #[unsafe(method(new))]
167        #[unsafe(method_family = new)]
168        pub unsafe fn new() -> Retained<Self>;
169    );
170}