objc2_game_controller/generated/GCMouse.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern "C" {
10 /// Use these constants with NSNotificationCenter to listen to connection and disconnection events.
11 ///
12 /// Use GCMouseDidConnectNotification for observing connections of mice.
13 /// Use GCMouserDidDisconnectNotification for observing disconnections of mice.
14 ///
15 /// Connections and disconnections of mice will also be reflected in the mice array
16 /// of the GCMouse class.
17 ///
18 /// The 'object' property of the notification will contain the GCMouse that was connected or disconnected.
19 /// For example:
20 ///
21 /// - (void)controllerDidConnect:(NSNotification *)note {
22 ///
23 /// GCMouse *mouse = note.object;
24 ///
25 /// ....
26 /// }
27 ///
28 ///
29 /// See: NSNotificationCenter
30 ///
31 /// See: GCMouse.mice
32 ///
33 /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcmousedidconnectnotification?language=objc)
34 pub static GCMouseDidConnectNotification: &'static NSString;
35}
36
37extern "C" {
38 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcmousediddisconnectnotification?language=objc)
39 pub static GCMouseDidDisconnectNotification: &'static NSString;
40}
41
42extern "C" {
43 /// Use these constants with NSNotificationCenter to listen to a controller becoming the most recently used mouse.
44 /// This is a good time to swap out UI to match the new current mouse, and unregister any handlers with
45 /// the old current controller.
46 ///
47 /// The 'object' property of the notification will contain the GCMouse that became the current one.
48 /// For example:
49 ///
50 /// - (void)mouseDidBecomeCurrent:(NSNotification *)note {
51 ///
52 /// GCMouse *mouse = note.object;
53 ///
54 /// ...
55 /// }
56 ///
57 /// See: NSNotificationCenter
58 ///
59 /// See: GCMouse.mice
60 ///
61 /// See: GCMouse.current
62 ///
63 /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcmousedidbecomecurrentnotification?language=objc)
64 pub static GCMouseDidBecomeCurrentNotification: &'static NSString;
65}
66
67extern "C" {
68 /// [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcmousedidstopbeingcurrentnotification?language=objc)
69 pub static GCMouseDidStopBeingCurrentNotification: &'static NSString;
70}
71
72extern_class!(
73 /// Mice are available to an application that links to GameController.framework. There are 2 ways to access mice
74 /// paired to the system. Adopt both to ensure the best user experience:
75 ///
76 /// 1: Querying for the current array of mice using [GCMouse mice]
77 /// 2: Registering for Connection/Disconnection notifications from NSNotificationCenter.
78 ///
79 /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcmouse?language=objc)
80 #[unsafe(super(NSObject))]
81 #[derive(Debug, PartialEq, Eq, Hash)]
82 pub struct GCMouse;
83);
84
85#[cfg(feature = "GCDevice")]
86unsafe impl GCDevice for GCMouse {}
87
88unsafe impl NSObjectProtocol for GCMouse {}
89
90impl GCMouse {
91 extern_methods!(
92 #[cfg(all(feature = "GCMouseInput", feature = "GCPhysicalInputProfile"))]
93 /// Unlike GCController GCMouse supports only one input profile
94 /// Profile contains mouse buttons, scroll wheel and pointer delta.
95 #[unsafe(method(mouseInput))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn mouseInput(&self) -> Option<Retained<GCMouseInput>>;
98
99 /// The most recently used mouse device. If a user actuates a mouse input, that mouse will become the current one.
100 ///
101 /// See: GCMouseDidBecomeCurrentNotification
102 ///
103 /// See: GCMouseDidStopBeingCurrentNotification
104 #[unsafe(method(current))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn current() -> Option<Retained<GCMouse>>;
107
108 #[unsafe(method(mice))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn mice() -> Retained<NSArray<GCMouse>>;
111 );
112}
113
114/// Methods declared on superclass `NSObject`.
115impl GCMouse {
116 extern_methods!(
117 #[unsafe(method(init))]
118 #[unsafe(method_family = init)]
119 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
120
121 #[unsafe(method(new))]
122 #[unsafe(method_family = new)]
123 pub unsafe fn new() -> Retained<Self>;
124 );
125}