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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use crate::*;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerinteraction?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIPointerInteraction;
);
extern_conformance!(
unsafe impl NSObjectProtocol for UIPointerInteraction {}
);
#[cfg(feature = "UIInteraction")]
extern_conformance!(
unsafe impl UIInteraction for UIPointerInteraction {}
);
impl UIPointerInteraction {
extern_methods!(
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn UIPointerInteractionDelegate>>>;
#[unsafe(method(isEnabled))]
#[unsafe(method_family = none)]
pub fn isEnabled(&self) -> bool;
/// Setter for [`isEnabled`][Self::isEnabled].
#[unsafe(method(setEnabled:))]
#[unsafe(method_family = none)]
pub fn setEnabled(&self, enabled: bool);
#[unsafe(method(initWithDelegate:))]
#[unsafe(method_family = init)]
pub fn initWithDelegate(
this: Allocated<Self>,
delegate: Option<&ProtocolObject<dyn UIPointerInteractionDelegate>>,
) -> Retained<Self>;
/// Call this method to cause the interaction to update the pointer in response to some event.
#[unsafe(method(invalidate))]
#[unsafe(method_family = none)]
pub fn invalidate(&self);
);
}
/// Methods declared on superclass `NSObject`.
impl UIPointerInteraction {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerinteractiondelegate?language=objc)
pub unsafe trait UIPointerInteractionDelegate:
NSObjectProtocol + MainThreadOnly
{
#[cfg(feature = "UIPointerRegion")]
/// Called as the pointer moves within the interaction's view.
///
///
/// Parameter `interaction`: This UIPointerInteraction.
///
/// Parameter `request`: Request object describing the pointer's location in the interaction's view.
///
/// Parameter `defaultRegion`: Region representing the entire surface of the interaction's view.
///
///
/// Returns: A UIPointerRegion in which to apply a pointer style. Return nil to indicate that this interaction should not customize the pointer for the current location.
#[optional]
#[unsafe(method(pointerInteraction:regionForRequest:defaultRegion:))]
#[unsafe(method_family = none)]
fn pointerInteraction_regionForRequest_defaultRegion(
&self,
interaction: &UIPointerInteraction,
request: &UIPointerRegionRequest,
default_region: &UIPointerRegion,
) -> Option<Retained<UIPointerRegion>>;
#[cfg(all(
feature = "UIHoverStyle",
feature = "UIPointerRegion",
feature = "UIPointerStyle"
))]
/// Called after the interaction receives a new UIPointerRegion from pointerInteraction:regionForRequest:defaultRegion:.
///
///
/// Parameter `interaction`: This UIPointerInteraction.
///
/// Parameter `region`: The UIPointerRegion for which a style is being requested.
///
///
/// Returns: A UIPointerStyle describing the desired hover effect or pointer appearance for the given UIPointerRegion.
#[optional]
#[unsafe(method(pointerInteraction:styleForRegion:))]
#[unsafe(method_family = none)]
fn pointerInteraction_styleForRegion(
&self,
interaction: &UIPointerInteraction,
region: &UIPointerRegion,
) -> Option<Retained<UIPointerStyle>>;
#[cfg(feature = "UIPointerRegion")]
/// Called when the pointer enters a given region.
///
///
/// Parameter `interaction`: This UIPointerInteraction.
///
/// Parameter `region`: The UIPointerRegion the pointer is about to enter.
///
/// Parameter `animator`: Region entrance animator. Add animations to run them alongside the pointer's entrance animation.
#[optional]
#[unsafe(method(pointerInteraction:willEnterRegion:animator:))]
#[unsafe(method_family = none)]
fn pointerInteraction_willEnterRegion_animator(
&self,
interaction: &UIPointerInteraction,
region: &UIPointerRegion,
animator: &ProtocolObject<dyn UIPointerInteractionAnimating>,
);
#[cfg(feature = "UIPointerRegion")]
/// Called when the pointer exists a given region.
///
///
/// Parameter `interaction`: This UIPointerInteraction.
///
/// Parameter `region`: The UIPointerRegion the pointer is about to exit.
///
/// Parameter `animator`: Region exit animator. Add animations to run them alongside the pointer's exit animation.
#[optional]
#[unsafe(method(pointerInteraction:willExitRegion:animator:))]
#[unsafe(method_family = none)]
fn pointerInteraction_willExitRegion_animator(
&self,
interaction: &UIPointerInteraction,
region: &UIPointerRegion,
animator: &ProtocolObject<dyn UIPointerInteractionAnimating>,
);
}
);
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerregionrequest?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIPointerRegionRequest;
);
extern_conformance!(
unsafe impl NSObjectProtocol for UIPointerRegionRequest {}
);
impl UIPointerRegionRequest {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// The location of the pointer in the interaction's view's coordinate space.
#[unsafe(method(location))]
#[unsafe(method_family = none)]
pub fn location(&self) -> CGPoint;
#[cfg(feature = "UICommand")]
/// Key modifier flags representing keyboard keys pressed by the user at the time of this request.
#[unsafe(method(modifiers))]
#[unsafe(method_family = none)]
pub fn modifiers(&self) -> UIKeyModifierFlags;
);
}
/// Methods declared on superclass `NSObject`.
impl UIPointerRegionRequest {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerinteractionanimating?language=objc)
pub unsafe trait UIPointerInteractionAnimating:
NSObjectProtocol + MainThreadOnly
{
#[cfg(feature = "block2")]
#[unsafe(method(addAnimations:))]
#[unsafe(method_family = none)]
fn addAnimations(&self, animations: &block2::DynBlock<dyn Fn()>);
#[cfg(feature = "block2")]
#[unsafe(method(addCompletion:))]
#[unsafe(method_family = none)]
fn addCompletion(&self, completion: &block2::DynBlock<dyn Fn(Bool)>);
}
);