objc2_ui_kit/generated/
UIPointerInteraction.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerinteraction?language=objc)
13    #[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        /// Setter for [`isEnabled`][Self::isEnabled].
41        #[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        /// Call this method to cause the interaction to update the pointer in response to some event.
53        #[unsafe(method(invalidate))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn invalidate(&self);
56    );
57}
58
59/// Methods declared on superclass `NSObject`.
60impl 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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerinteractiondelegate?language=objc)
74    pub unsafe trait UIPointerInteractionDelegate:
75        NSObjectProtocol + MainThreadOnly
76    {
77        #[cfg(feature = "UIPointerRegion")]
78        /// Called as the pointer moves within the interaction's view.
79        ///
80        ///
81        /// Parameter `interaction`: This UIPointerInteraction.
82        ///
83        /// Parameter `request`: Request object describing the pointer's location in the interaction's view.
84        ///
85        /// Parameter `defaultRegion`: Region representing the entire surface of the interaction's view.
86        ///
87        ///
88        /// 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.
89        #[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        /// Called after the interaction receives a new UIPointerRegion from pointerInteraction:regionForRequest:defaultRegion:.
105        ///
106        ///
107        /// Parameter `interaction`: This UIPointerInteraction.
108        ///
109        /// Parameter `region`: The UIPointerRegion for which a style is being requested.
110        ///
111        ///
112        /// Returns: A UIPointerStyle describing the desired hover effect or pointer appearance for the given UIPointerRegion.
113        #[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        /// Called when the pointer enters a given region.
124        ///
125        ///
126        /// Parameter `interaction`: This UIPointerInteraction.
127        ///
128        /// Parameter `region`: The UIPointerRegion the pointer is about to enter.
129        ///
130        /// Parameter `animator`: Region entrance animator. Add animations to run them alongside the pointer's entrance animation.
131        #[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        /// Called when the pointer exists a given region.
143        ///
144        ///
145        /// Parameter `interaction`: This UIPointerInteraction.
146        ///
147        /// Parameter `region`: The UIPointerRegion the pointer is about to exit.
148        ///
149        /// Parameter `animator`: Region exit animator. Add animations to run them alongside the pointer's exit animation.
150        #[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerregionrequest?language=objc)
164    #[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        /// The location of the pointer in the interaction's view's coordinate space.
178        #[unsafe(method(location))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn location(&self) -> CGPoint;
181
182        #[cfg(feature = "UICommand")]
183        /// Key modifier flags representing keyboard keys pressed by the user at the time of this request.
184        #[unsafe(method(modifiers))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn modifiers(&self) -> UIKeyModifierFlags;
187    );
188}
189
190/// Methods declared on superclass `NSObject`.
191impl 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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipointerinteractionanimating?language=objc)
205    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);