objc2_ui_kit/generated/
UIPointerInteraction.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8
9use crate::*;
10
11extern_class!(
12 #[unsafe(super(NSObject))]
14 #[thread_kind = MainThreadOnly]
15 #[derive(Debug, PartialEq, Eq, Hash)]
16 pub struct UIPointerInteraction;
17);
18
19extern_conformance!(
20 unsafe impl NSObjectProtocol for UIPointerInteraction {}
21);
22
23#[cfg(feature = "UIInteraction")]
24extern_conformance!(
25 unsafe impl UIInteraction for UIPointerInteraction {}
26);
27
28impl UIPointerInteraction {
29 extern_methods!(
30 #[unsafe(method(delegate))]
31 #[unsafe(method_family = none)]
32 pub unsafe fn delegate(
33 &self,
34 ) -> Option<Retained<ProtocolObject<dyn UIPointerInteractionDelegate>>>;
35
36 #[unsafe(method(isEnabled))]
37 #[unsafe(method_family = none)]
38 pub unsafe fn isEnabled(&self) -> bool;
39
40 #[unsafe(method(setEnabled:))]
42 #[unsafe(method_family = none)]
43 pub unsafe fn setEnabled(&self, enabled: bool);
44
45 #[unsafe(method(initWithDelegate:))]
46 #[unsafe(method_family = init)]
47 pub unsafe fn initWithDelegate(
48 this: Allocated<Self>,
49 delegate: Option<&ProtocolObject<dyn UIPointerInteractionDelegate>>,
50 ) -> Retained<Self>;
51
52 #[unsafe(method(invalidate))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn invalidate(&self);
56 );
57}
58
59impl UIPointerInteraction {
61 extern_methods!(
62 #[unsafe(method(init))]
63 #[unsafe(method_family = init)]
64 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
65
66 #[unsafe(method(new))]
67 #[unsafe(method_family = new)]
68 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
69 );
70}
71
72extern_protocol!(
73 pub unsafe trait UIPointerInteractionDelegate:
75 NSObjectProtocol + MainThreadOnly
76 {
77 #[cfg(feature = "UIPointerRegion")]
78 #[optional]
90 #[unsafe(method(pointerInteraction:regionForRequest:defaultRegion:))]
91 #[unsafe(method_family = none)]
92 unsafe fn pointerInteraction_regionForRequest_defaultRegion(
93 &self,
94 interaction: &UIPointerInteraction,
95 request: &UIPointerRegionRequest,
96 default_region: &UIPointerRegion,
97 ) -> Option<Retained<UIPointerRegion>>;
98
99 #[cfg(all(
100 feature = "UIHoverStyle",
101 feature = "UIPointerRegion",
102 feature = "UIPointerStyle"
103 ))]
104 #[optional]
114 #[unsafe(method(pointerInteraction:styleForRegion:))]
115 #[unsafe(method_family = none)]
116 unsafe fn pointerInteraction_styleForRegion(
117 &self,
118 interaction: &UIPointerInteraction,
119 region: &UIPointerRegion,
120 ) -> Option<Retained<UIPointerStyle>>;
121
122 #[cfg(feature = "UIPointerRegion")]
123 #[optional]
132 #[unsafe(method(pointerInteraction:willEnterRegion:animator:))]
133 #[unsafe(method_family = none)]
134 unsafe fn pointerInteraction_willEnterRegion_animator(
135 &self,
136 interaction: &UIPointerInteraction,
137 region: &UIPointerRegion,
138 animator: &ProtocolObject<dyn UIPointerInteractionAnimating>,
139 );
140
141 #[cfg(feature = "UIPointerRegion")]
142 #[optional]
151 #[unsafe(method(pointerInteraction:willExitRegion:animator:))]
152 #[unsafe(method_family = none)]
153 unsafe fn pointerInteraction_willExitRegion_animator(
154 &self,
155 interaction: &UIPointerInteraction,
156 region: &UIPointerRegion,
157 animator: &ProtocolObject<dyn UIPointerInteractionAnimating>,
158 );
159 }
160);
161
162extern_class!(
163 #[unsafe(super(NSObject))]
165 #[thread_kind = MainThreadOnly]
166 #[derive(Debug, PartialEq, Eq, Hash)]
167 pub struct UIPointerRegionRequest;
168);
169
170extern_conformance!(
171 unsafe impl NSObjectProtocol for UIPointerRegionRequest {}
172);
173
174impl UIPointerRegionRequest {
175 extern_methods!(
176 #[cfg(feature = "objc2-core-foundation")]
177 #[unsafe(method(location))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn location(&self) -> CGPoint;
181
182 #[cfg(feature = "UICommand")]
183 #[unsafe(method(modifiers))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn modifiers(&self) -> UIKeyModifierFlags;
187 );
188}
189
190impl UIPointerRegionRequest {
192 extern_methods!(
193 #[unsafe(method(init))]
194 #[unsafe(method_family = init)]
195 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
196
197 #[unsafe(method(new))]
198 #[unsafe(method_family = new)]
199 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
200 );
201}
202
203extern_protocol!(
204 pub unsafe trait UIPointerInteractionAnimating:
206 NSObjectProtocol + MainThreadOnly
207 {
208 #[cfg(feature = "block2")]
209 #[unsafe(method(addAnimations:))]
210 #[unsafe(method_family = none)]
211 unsafe fn addAnimations(&self, animations: &block2::DynBlock<dyn Fn()>);
212
213 #[cfg(feature = "block2")]
214 #[unsafe(method(addCompletion:))]
215 #[unsafe(method_family = none)]
216 unsafe fn addCompletion(&self, completion: &block2::DynBlock<dyn Fn(Bool)>);
217 }
218);