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::Block<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")]
37unsafe impl NSObjectProtocol for GCMouseInput {}
38
39#[cfg(feature = "GCPhysicalInputProfile")]
40impl GCMouseInput {
41    extern_methods!(
42        #[cfg(feature = "block2")]
43        #[unsafe(method(mouseMovedHandler))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn mouseMovedHandler(&self) -> GCMouseMoved;
46
47        #[cfg(feature = "block2")]
48        /// Setter for [`mouseMovedHandler`][Self::mouseMovedHandler].
49        #[unsafe(method(setMouseMovedHandler:))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn setMouseMovedHandler(&self, mouse_moved_handler: GCMouseMoved);
52
53        #[cfg(all(
54            feature = "GCControllerDirectionPad",
55            feature = "GCControllerElement",
56            feature = "GCDeviceCursor"
57        ))]
58        /// Scroll is a dpad with undefined range.
59        #[unsafe(method(scroll))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn scroll(&self) -> Retained<GCDeviceCursor>;
62
63        #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
64        /// Mouse buttons that can be used only as digital inputs
65        #[unsafe(method(leftButton))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn leftButton(&self) -> Retained<GCControllerButtonInput>;
68
69        #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
70        #[unsafe(method(rightButton))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn rightButton(&self) -> Option<Retained<GCControllerButtonInput>>;
73
74        #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
75        #[unsafe(method(middleButton))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn middleButton(&self) -> Option<Retained<GCControllerButtonInput>>;
78
79        #[cfg(all(feature = "GCControllerButtonInput", feature = "GCControllerElement"))]
80        #[unsafe(method(auxiliaryButtons))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn auxiliaryButtons(&self)
83            -> Option<Retained<NSArray<GCControllerButtonInput>>>;
84    );
85}
86
87/// Methods declared on superclass `NSObject`.
88#[cfg(feature = "GCPhysicalInputProfile")]
89impl GCMouseInput {
90    extern_methods!(
91        #[unsafe(method(init))]
92        #[unsafe(method_family = init)]
93        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
94
95        #[unsafe(method(new))]
96        #[unsafe(method_family = new)]
97        pub unsafe fn new() -> Retained<Self>;
98    );
99}