objc2_scene_kit/generated/
SCNView.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/// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnviewoption?language=objc)
16// NS_TYPED_ENUM
17pub type SCNViewOption = NSString;
18
19extern "C" {
20    /// Pass it as the key in the options dictionary given to initWithFrame:options:. The value is a NSNumber wrapping a SCNRenderingAPI. You can also select the preferred rendering API directly from the SCNView inspector in InterfaceBuilder.
21    ///
22    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnpreferredrenderingapikey?language=objc)
23    pub static SCNPreferredRenderingAPIKey: &'static SCNViewOption;
24}
25
26extern "C" {
27    /// The value is directly a id
28    /// <MTLDevice
29    /// >.
30    ///
31    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnpreferreddevicekey?language=objc)
32    pub static SCNPreferredDeviceKey: &'static SCNViewOption;
33}
34
35extern "C" {
36    /// The value is a NSNumber wrapping a BOOL. Defaults to NO.
37    ///
38    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnpreferlowpowerdevicekey?language=objc)
39    pub static SCNPreferLowPowerDeviceKey: &'static SCNViewOption;
40}
41
42extern_protocol!(
43    /// [Apple's documentation](https://developer.apple.com/documentation/scenekit/scncameracontrolconfiguration?language=objc)
44    pub unsafe trait SCNCameraControlConfiguration: NSObjectProtocol {
45        #[unsafe(method(autoSwitchToFreeCamera))]
46        #[unsafe(method_family = none)]
47        unsafe fn autoSwitchToFreeCamera(&self) -> bool;
48
49        /// Setter for [`autoSwitchToFreeCamera`][Self::autoSwitchToFreeCamera].
50        #[unsafe(method(setAutoSwitchToFreeCamera:))]
51        #[unsafe(method_family = none)]
52        unsafe fn setAutoSwitchToFreeCamera(&self, auto_switch_to_free_camera: bool);
53
54        #[unsafe(method(allowsTranslation))]
55        #[unsafe(method_family = none)]
56        unsafe fn allowsTranslation(&self) -> bool;
57
58        /// Setter for [`allowsTranslation`][Self::allowsTranslation].
59        #[unsafe(method(setAllowsTranslation:))]
60        #[unsafe(method_family = none)]
61        unsafe fn setAllowsTranslation(&self, allows_translation: bool);
62
63        #[cfg(feature = "objc2-core-foundation")]
64        #[unsafe(method(flyModeVelocity))]
65        #[unsafe(method_family = none)]
66        unsafe fn flyModeVelocity(&self) -> CGFloat;
67
68        #[cfg(feature = "objc2-core-foundation")]
69        /// Setter for [`flyModeVelocity`][Self::flyModeVelocity].
70        #[unsafe(method(setFlyModeVelocity:))]
71        #[unsafe(method_family = none)]
72        unsafe fn setFlyModeVelocity(&self, fly_mode_velocity: CGFloat);
73
74        #[cfg(feature = "objc2-core-foundation")]
75        #[unsafe(method(panSensitivity))]
76        #[unsafe(method_family = none)]
77        unsafe fn panSensitivity(&self) -> CGFloat;
78
79        #[cfg(feature = "objc2-core-foundation")]
80        /// Setter for [`panSensitivity`][Self::panSensitivity].
81        #[unsafe(method(setPanSensitivity:))]
82        #[unsafe(method_family = none)]
83        unsafe fn setPanSensitivity(&self, pan_sensitivity: CGFloat);
84
85        #[cfg(feature = "objc2-core-foundation")]
86        #[unsafe(method(truckSensitivity))]
87        #[unsafe(method_family = none)]
88        unsafe fn truckSensitivity(&self) -> CGFloat;
89
90        #[cfg(feature = "objc2-core-foundation")]
91        /// Setter for [`truckSensitivity`][Self::truckSensitivity].
92        #[unsafe(method(setTruckSensitivity:))]
93        #[unsafe(method_family = none)]
94        unsafe fn setTruckSensitivity(&self, truck_sensitivity: CGFloat);
95
96        #[cfg(feature = "objc2-core-foundation")]
97        #[unsafe(method(rotationSensitivity))]
98        #[unsafe(method_family = none)]
99        unsafe fn rotationSensitivity(&self) -> CGFloat;
100
101        #[cfg(feature = "objc2-core-foundation")]
102        /// Setter for [`rotationSensitivity`][Self::rotationSensitivity].
103        #[unsafe(method(setRotationSensitivity:))]
104        #[unsafe(method_family = none)]
105        unsafe fn setRotationSensitivity(&self, rotation_sensitivity: CGFloat);
106    }
107);
108
109extern_class!(
110    /// A SCNView is a subclass of NSView that can display a SCNScene
111    ///
112    /// See also [Apple's documentation](https://developer.apple.com/documentation/scenekit/scnview?language=objc)
113    #[unsafe(super(NSView, NSResponder, NSObject))]
114    #[derive(Debug, PartialEq, Eq, Hash)]
115    #[cfg(feature = "objc2-app-kit")]
116    #[cfg(target_os = "macos")]
117    pub struct SCNView;
118);
119
120#[cfg(feature = "objc2-app-kit")]
121#[cfg(target_os = "macos")]
122extern_conformance!(
123    unsafe impl NSAccessibility for SCNView {}
124);
125
126#[cfg(feature = "objc2-app-kit")]
127#[cfg(target_os = "macos")]
128extern_conformance!(
129    unsafe impl NSAccessibilityElementProtocol for SCNView {}
130);
131
132#[cfg(feature = "objc2-app-kit")]
133#[cfg(target_os = "macos")]
134extern_conformance!(
135    unsafe impl NSAnimatablePropertyContainer for SCNView {}
136);
137
138#[cfg(feature = "objc2-app-kit")]
139#[cfg(target_os = "macos")]
140extern_conformance!(
141    unsafe impl NSAppearanceCustomization for SCNView {}
142);
143
144#[cfg(feature = "objc2-app-kit")]
145#[cfg(target_os = "macos")]
146extern_conformance!(
147    unsafe impl NSCoding for SCNView {}
148);
149
150#[cfg(feature = "objc2-app-kit")]
151#[cfg(target_os = "macos")]
152extern_conformance!(
153    unsafe impl NSDraggingDestination for SCNView {}
154);
155
156#[cfg(feature = "objc2-app-kit")]
157#[cfg(target_os = "macos")]
158extern_conformance!(
159    unsafe impl NSObjectProtocol for SCNView {}
160);
161
162#[cfg(feature = "objc2-app-kit")]
163#[cfg(target_os = "macos")]
164extern_conformance!(
165    unsafe impl NSUserInterfaceItemIdentification for SCNView {}
166);
167
168#[cfg(all(feature = "SCNSceneRenderer", feature = "objc2-app-kit"))]
169#[cfg(target_os = "macos")]
170extern_conformance!(
171    unsafe impl SCNSceneRenderer for SCNView {}
172);
173
174#[cfg(all(feature = "SCNTechnique", feature = "objc2-app-kit"))]
175#[cfg(target_os = "macos")]
176extern_conformance!(
177    unsafe impl SCNTechniqueSupport for SCNView {}
178);
179
180#[cfg(feature = "objc2-app-kit")]
181#[cfg(target_os = "macos")]
182impl SCNView {
183    extern_methods!(
184        /// Initializes and returns a newly allocated SCNView object with a specified frame rectangle.
185        ///
186        /// Parameter `frame`: The frame rectangle for the created view object.
187        ///
188        /// Parameter `options`: An optional dictionary. See "View initialization options" above.
189        #[unsafe(method(initWithFrame:options:))]
190        #[unsafe(method_family = init)]
191        pub unsafe fn initWithFrame_options(
192            this: Allocated<Self>,
193            frame: NSRect,
194            options: Option<&NSDictionary<NSString, AnyObject>>,
195        ) -> Retained<Self>;
196
197        #[cfg(feature = "SCNScene")]
198        /// Specifies the scene of the receiver
199        #[unsafe(method(scene))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn scene(&self) -> Option<Retained<SCNScene>>;
202
203        #[cfg(feature = "SCNScene")]
204        /// Setter for [`scene`][Self::scene].
205        #[unsafe(method(setScene:))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn setScene(&self, scene: Option<&SCNScene>);
208
209        /// When set to YES, the view continously redraw at the display link frame rate. When set to NO the view will only redraw when something change or animates in the receiver's scene. Defaults to NO.
210        #[unsafe(method(rendersContinuously))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn rendersContinuously(&self) -> bool;
213
214        /// Setter for [`rendersContinuously`][Self::rendersContinuously].
215        #[unsafe(method(setRendersContinuously:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn setRendersContinuously(&self, renders_continuously: bool);
218
219        /// Specifies the background color of the receiver. Defaults to opaque white.
220        #[unsafe(method(backgroundColor))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
223
224        /// Setter for [`backgroundColor`][Self::backgroundColor].
225        #[unsafe(method(setBackgroundColor:))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
228
229        /// A Boolean value that determines whether the user can manipulate the point of view used to render the scene.
230        ///
231        /// When set to YES, the user can manipulate the current point of view with the mouse or the trackpad. The scene graph and existing cameras won't be modified by this action. The default value of this property is NO.
232        /// Note that the primary purpose of this property is to aid in debugging your application. You may want to implement your own camera controller suitable for your application.
233        /// The built-in camera controller let you:
234        /// - drag the mouse to rotate the camera around the scene
235        /// - drag+cmd to rotate the camera in local space
236        /// - drag+shift to rotate using sticky axis
237        /// - use the scroll wheel or alt+drag the mouse to translate the camera on its local X,Y plan
238        /// - alt+scroll wheel to move the camera forward/backward
239        /// - rotate gesture (trackpad only) to roll the camera (rotation around the Z axis)
240        /// - pinch gesture (trackpad only) move the camera forward/backward
241        /// - alt + pinch gesture (trackpad only) to zoom-in / zoom-out (change the field of view of the camera)
242        #[unsafe(method(allowsCameraControl))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn allowsCameraControl(&self) -> bool;
245
246        /// Setter for [`allowsCameraControl`][Self::allowsCameraControl].
247        #[unsafe(method(setAllowsCameraControl:))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn setAllowsCameraControl(&self, allows_camera_control: bool);
250
251        /// An object describing the current configuration of the event handler which pilot the default camera controller.
252        ///
253        /// This object will be used to configure the event handler when allowCameraControl is set to YES.
254        #[unsafe(method(cameraControlConfiguration))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn cameraControlConfiguration(
257            &self,
258        ) -> Retained<ProtocolObject<dyn SCNCameraControlConfiguration>>;
259
260        #[cfg(feature = "SCNCameraController")]
261        /// Returns the default SCNCameraController used to drive the current point of view when allowCameraController is set to YES.
262        #[unsafe(method(defaultCameraController))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn defaultCameraController(&self) -> Retained<SCNCameraController>;
265
266        /// Draws the contents of the view and returns them as a new image object
267        ///
268        /// This method is thread-safe and may be called at any time.
269        #[unsafe(method(snapshot))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn snapshot(&self) -> Retained<NSImage>;
272
273        /// This action method begins playing the scene at its current location.
274        ///
275        /// Parameter `sender`: The object (such as a button or menu item) sending the message to play the scene.
276        ///
277        /// This method does not do anything if the scene is already playing.
278        #[unsafe(method(play:))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn play(&self, sender: Option<&AnyObject>);
281
282        /// This action method pauses the scene playback.
283        ///
284        /// Parameter `sender`: The object (such as a button or menu item) sending the message to pause the scene.
285        ///
286        /// This method does not do anything if the scene is already paused.
287        #[unsafe(method(pause:))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn pause(&self, sender: Option<&AnyObject>);
290
291        /// This action method stops the scene playback and resets the current time to the start time of the scene.
292        ///
293        /// Parameter `sender`: The object (such as a button or menu item) sending the message to stop playing the scene.
294        #[unsafe(method(stop:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn stop(&self, sender: Option<&AnyObject>);
297
298        /// The rate you want the view to redraw its contents.
299        ///
300        /// When your application sets its preferred frame rate, the view chooses a frame rate as close to that as possible based on the capabilities of the screen the view is displayed on. The actual frame rate chosen is usually a factor of the maximum refresh rate of the screen to provide a consistent frame rate. For example, if the maximum refresh rate of the screen is 60 frames per second, that is also the highest frame rate the view sets as the actual frame rate. However, if you ask for a lower frame rate, it might choose 30, 20, 15 or some other factor to be the actual frame rate. Your application should choose a frame rate that it can consistently maintain.
301        /// The default value is 0 which means the display link will fire at the native cadence of the display hardware.
302        #[unsafe(method(preferredFramesPerSecond))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn preferredFramesPerSecond(&self) -> NSInteger;
305
306        /// Setter for [`preferredFramesPerSecond`][Self::preferredFramesPerSecond].
307        #[unsafe(method(setPreferredFramesPerSecond:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn setPreferredFramesPerSecond(&self, preferred_frames_per_second: NSInteger);
310
311        /// Specifies whether the drawable is resized asynchonously during a live resize operation. Defaults to YES.
312        ///
313        /// If set to YES, the actual viewport size during a live resize can be retrieved using currentViewport (see SCNSceneRenderer.h)
314        #[unsafe(method(drawableResizesAsynchronously))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn drawableResizesAsynchronously(&self) -> bool;
317
318        /// Setter for [`drawableResizesAsynchronously`][Self::drawableResizesAsynchronously].
319        #[unsafe(method(setDrawableResizesAsynchronously:))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn setDrawableResizesAsynchronously(
322            &self,
323            drawable_resizes_asynchronously: bool,
324        );
325
326        #[cfg(feature = "SCNSceneRenderer")]
327        /// Defaults to SCNAntialiasingModeMultisampling4X on macOS and SCNAntialiasingModeNone on iOS.
328        #[unsafe(method(antialiasingMode))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn antialiasingMode(&self) -> SCNAntialiasingMode;
331
332        #[cfg(feature = "SCNSceneRenderer")]
333        /// Setter for [`antialiasingMode`][Self::antialiasingMode].
334        #[unsafe(method(setAntialiasingMode:))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn setAntialiasingMode(&self, antialiasing_mode: SCNAntialiasingMode);
337    );
338}
339
340/// Methods declared on superclass `NSView`.
341#[cfg(feature = "objc2-app-kit")]
342#[cfg(target_os = "macos")]
343impl SCNView {
344    extern_methods!(
345        #[unsafe(method(initWithFrame:))]
346        #[unsafe(method_family = init)]
347        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
348
349        #[unsafe(method(initWithCoder:))]
350        #[unsafe(method_family = init)]
351        pub unsafe fn initWithCoder(
352            this: Allocated<Self>,
353            coder: &NSCoder,
354        ) -> Option<Retained<Self>>;
355    );
356}
357
358/// Methods declared on superclass `NSResponder`.
359#[cfg(feature = "objc2-app-kit")]
360#[cfg(target_os = "macos")]
361impl SCNView {
362    extern_methods!(
363        #[unsafe(method(init))]
364        #[unsafe(method_family = init)]
365        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
366    );
367}
368
369/// Methods declared on superclass `NSObject`.
370#[cfg(feature = "objc2-app-kit")]
371#[cfg(target_os = "macos")]
372impl SCNView {
373    extern_methods!(
374        #[unsafe(method(new))]
375        #[unsafe(method_family = new)]
376        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
377    );
378}