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
19unsafe impl NSObjectProtocol for UIPointerInteraction {}
20
21#[cfg(feature = "UIInteraction")]
22unsafe impl UIInteraction for UIPointerInteraction {}
23
24impl UIPointerInteraction {
25 extern_methods!(
26 #[unsafe(method(delegate))]
27 #[unsafe(method_family = none)]
28 pub unsafe fn delegate(
29 &self,
30 ) -> Option<Retained<ProtocolObject<dyn UIPointerInteractionDelegate>>>;
31
32 #[unsafe(method(isEnabled))]
33 #[unsafe(method_family = none)]
34 pub unsafe fn isEnabled(&self) -> bool;
35
36 #[unsafe(method(setEnabled:))]
38 #[unsafe(method_family = none)]
39 pub unsafe fn setEnabled(&self, enabled: bool);
40
41 #[unsafe(method(initWithDelegate:))]
42 #[unsafe(method_family = init)]
43 pub unsafe fn initWithDelegate(
44 this: Allocated<Self>,
45 delegate: Option<&ProtocolObject<dyn UIPointerInteractionDelegate>>,
46 ) -> Retained<Self>;
47
48 #[unsafe(method(invalidate))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn invalidate(&self);
52 );
53}
54
55impl UIPointerInteraction {
57 extern_methods!(
58 #[unsafe(method(init))]
59 #[unsafe(method_family = init)]
60 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
61
62 #[unsafe(method(new))]
63 #[unsafe(method_family = new)]
64 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
65 );
66}
67
68extern_protocol!(
69 pub unsafe trait UIPointerInteractionDelegate:
71 NSObjectProtocol + MainThreadOnly
72 {
73 #[cfg(feature = "UIPointerRegion")]
74 #[optional]
86 #[unsafe(method(pointerInteraction:regionForRequest:defaultRegion:))]
87 #[unsafe(method_family = none)]
88 unsafe fn pointerInteraction_regionForRequest_defaultRegion(
89 &self,
90 interaction: &UIPointerInteraction,
91 request: &UIPointerRegionRequest,
92 default_region: &UIPointerRegion,
93 ) -> Option<Retained<UIPointerRegion>>;
94
95 #[cfg(all(
96 feature = "UIHoverStyle",
97 feature = "UIPointerRegion",
98 feature = "UIPointerStyle"
99 ))]
100 #[optional]
110 #[unsafe(method(pointerInteraction:styleForRegion:))]
111 #[unsafe(method_family = none)]
112 unsafe fn pointerInteraction_styleForRegion(
113 &self,
114 interaction: &UIPointerInteraction,
115 region: &UIPointerRegion,
116 ) -> Option<Retained<UIPointerStyle>>;
117
118 #[cfg(feature = "UIPointerRegion")]
119 #[optional]
128 #[unsafe(method(pointerInteraction:willEnterRegion:animator:))]
129 #[unsafe(method_family = none)]
130 unsafe fn pointerInteraction_willEnterRegion_animator(
131 &self,
132 interaction: &UIPointerInteraction,
133 region: &UIPointerRegion,
134 animator: &ProtocolObject<dyn UIPointerInteractionAnimating>,
135 );
136
137 #[cfg(feature = "UIPointerRegion")]
138 #[optional]
147 #[unsafe(method(pointerInteraction:willExitRegion:animator:))]
148 #[unsafe(method_family = none)]
149 unsafe fn pointerInteraction_willExitRegion_animator(
150 &self,
151 interaction: &UIPointerInteraction,
152 region: &UIPointerRegion,
153 animator: &ProtocolObject<dyn UIPointerInteractionAnimating>,
154 );
155 }
156);
157
158extern_class!(
159 #[unsafe(super(NSObject))]
161 #[thread_kind = MainThreadOnly]
162 #[derive(Debug, PartialEq, Eq, Hash)]
163 pub struct UIPointerRegionRequest;
164);
165
166unsafe impl NSObjectProtocol for UIPointerRegionRequest {}
167
168impl UIPointerRegionRequest {
169 extern_methods!(
170 #[cfg(feature = "objc2-core-foundation")]
171 #[unsafe(method(location))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn location(&self) -> CGPoint;
175
176 #[cfg(feature = "UICommand")]
177 #[unsafe(method(modifiers))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn modifiers(&self) -> UIKeyModifierFlags;
181 );
182}
183
184impl UIPointerRegionRequest {
186 extern_methods!(
187 #[unsafe(method(init))]
188 #[unsafe(method_family = init)]
189 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
190
191 #[unsafe(method(new))]
192 #[unsafe(method_family = new)]
193 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
194 );
195}
196
197extern_protocol!(
198 pub unsafe trait UIPointerInteractionAnimating:
200 NSObjectProtocol + MainThreadOnly
201 {
202 #[cfg(feature = "block2")]
203 #[unsafe(method(addAnimations:))]
204 #[unsafe(method_family = none)]
205 unsafe fn addAnimations(&self, animations: &block2::Block<dyn Fn()>);
206
207 #[cfg(feature = "block2")]
208 #[unsafe(method(addCompletion:))]
209 #[unsafe(method_family = none)]
210 unsafe fn addCompletion(&self, completion: &block2::Block<dyn Fn(Bool)>);
211 }
212);