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