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