objc2_game_controller/generated/
GCMouseInput.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/// Set this block if you want to be notified when the mouse was moved
11///
12/// Parameter `mouse`: this mouse that is being used for input
13///
14/// Parameter `deltaX`: the value of raw mouse delta along x axis. Not affected by mouse sensitivity settings
15///
16/// Parameter `deltaY`: the value of raw mouse delta along y axis. Not affected by mouse sensitivity settings
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcmousemoved?language=objc)
19#[cfg(all(feature = "GCPhysicalInputProfile", feature = "block2"))]
20pub type GCMouseMoved = *mut block2::DynBlock<dyn Fn(NonNull<GCMouseInput>, c_float, c_float)>;
21
22extern_class!(
23    /// Mouse profile that represent a physical mouse object with two axis cursor, two axis scroll,
24    /// left button, optional right and middle buttons and optional set of auxiliary buttons.
25    ///
26    /// It only provides information about raw mouse movement deltas. For the valid cursor position
27    /// at given point in time, use UIHoverGestureRecognizer and NSEvent.mouseLocation.
28    ///
29    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcmouseinput?language=objc)
30    #[unsafe(super(GCPhysicalInputProfile, NSObject))]
31    #[derive(Debug, PartialEq, Eq, Hash)]
32    #[cfg(feature = "GCPhysicalInputProfile")]
33    pub struct GCMouseInput;
34);
35
36#[cfg(feature = "GCPhysicalInputProfile")]
37extern_conformance!(
38    unsafe impl NSObjectProtocol for GCMouseInput {}
39);
40
41#[cfg(feature = "GCPhysicalInputProfile")]
42impl GCMouseInput {
43    extern_methods!(
44        #[cfg(feature = "block2")]
45        /// # Safety
46        ///
47        /// The returned block's argument 1 must be a valid pointer.
48        #[unsafe(method(mouseMovedHandler))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn mouseMovedHandler(&self) -> GCMouseMoved;
51
52        #[cfg(feature = "block2")]
53        /// Setter for [`mouseMovedHandler`][Self::mouseMovedHandler].
54        ///
55        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
56        ///
57        /// # Safety
58        ///
59        /// `mouse_moved_handler` must be a valid pointer or null.
60        #[unsafe(method(setMouseMovedHandler:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn setMouseMovedHandler(&self, mouse_moved_handler: GCMouseMoved);
63
64        #[cfg(all(
65            feature = "GCControllerDirectionPad",
66            feature = "GCControllerElement",
67            feature = "GCDeviceCursor"
68        ))]
69        /// Scroll is a dpad with undefined range.
70        #[unsafe(method(scroll))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn scroll(&self) -> Retained<GCDeviceCursor>;
73
74        #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
75        /// Mouse buttons that can be used only as digital inputs
76        #[unsafe(method(leftButton))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn leftButton(&self) -> Retained<GCControllerButtonInput>;
79
80        #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
81        #[unsafe(method(rightButton))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn rightButton(&self) -> Option<Retained<GCControllerButtonInput>>;
84
85        #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
86        #[unsafe(method(middleButton))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn middleButton(&self) -> Option<Retained<GCControllerButtonInput>>;
89
90        #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
91        #[unsafe(method(auxiliaryButtons))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn auxiliaryButtons(&self)
94            -> Option<Retained<NSArray<GCControllerButtonInput>>>;
95    );
96}
97
98/// Methods declared on superclass `NSObject`.
99#[cfg(feature = "GCPhysicalInputProfile")]
100impl GCMouseInput {
101    extern_methods!(
102        #[unsafe(method(init))]
103        #[unsafe(method_family = init)]
104        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
105
106        #[unsafe(method(new))]
107        #[unsafe(method_family = new)]
108        pub unsafe fn new() -> Retained<Self>;
109    );
110}