objc2_ui_kit/generated/
UIEditMenuInteraction.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIEditMenuArrowDirection(pub NSInteger);
17impl UIEditMenuArrowDirection {
18 #[doc(alias = "UIEditMenuArrowDirectionAutomatic")]
19 pub const Automatic: Self = Self(0);
20 #[doc(alias = "UIEditMenuArrowDirectionUp")]
21 pub const Up: Self = Self(1);
22 #[doc(alias = "UIEditMenuArrowDirectionDown")]
23 pub const Down: Self = Self(2);
24 #[doc(alias = "UIEditMenuArrowDirectionLeft")]
25 pub const Left: Self = Self(3);
26 #[doc(alias = "UIEditMenuArrowDirectionRight")]
27 pub const Right: Self = Self(4);
28}
29
30unsafe impl Encode for UIEditMenuArrowDirection {
31 const ENCODING: Encoding = NSInteger::ENCODING;
32}
33
34unsafe impl RefEncode for UIEditMenuArrowDirection {
35 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38extern_class!(
39 #[unsafe(super(NSObject))]
41 #[thread_kind = MainThreadOnly]
42 #[derive(Debug, PartialEq, Eq, Hash)]
43 pub struct UIEditMenuConfiguration;
44);
45
46extern_conformance!(
47 unsafe impl NSObjectProtocol for UIEditMenuConfiguration {}
48);
49
50impl UIEditMenuConfiguration {
51 extern_methods!(
52 #[unsafe(method(identifier))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn identifier(&self) -> Retained<ProtocolObject<dyn NSCopying>>;
56
57 #[cfg(feature = "objc2-core-foundation")]
58 #[unsafe(method(sourcePoint))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn sourcePoint(&self) -> CGPoint;
65
66 #[unsafe(method(preferredArrowDirection))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn preferredArrowDirection(&self) -> UIEditMenuArrowDirection;
71
72 #[unsafe(method(setPreferredArrowDirection:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn setPreferredArrowDirection(
76 &self,
77 preferred_arrow_direction: UIEditMenuArrowDirection,
78 );
79
80 #[cfg(feature = "objc2-core-foundation")]
81 #[unsafe(method(configurationWithIdentifier:sourcePoint:))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn configurationWithIdentifier_sourcePoint(
85 identifier: Option<&ProtocolObject<dyn NSCopying>>,
86 source_point: CGPoint,
87 mtm: MainThreadMarker,
88 ) -> Retained<Self>;
89
90 #[unsafe(method(init))]
91 #[unsafe(method_family = init)]
92 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
93
94 #[unsafe(method(new))]
95 #[unsafe(method_family = new)]
96 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
97 );
98}
99
100extern_class!(
101 #[unsafe(super(NSObject))]
103 #[thread_kind = MainThreadOnly]
104 #[derive(Debug, PartialEq, Eq, Hash)]
105 pub struct UIEditMenuInteraction;
106);
107
108extern_conformance!(
109 unsafe impl NSObjectProtocol for UIEditMenuInteraction {}
110);
111
112#[cfg(feature = "UIInteraction")]
113extern_conformance!(
114 unsafe impl UIInteraction for UIEditMenuInteraction {}
115);
116
117impl UIEditMenuInteraction {
118 extern_methods!(
119 #[unsafe(method(delegate))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn delegate(
123 &self,
124 ) -> Option<Retained<ProtocolObject<dyn UIEditMenuInteractionDelegate>>>;
125
126 #[unsafe(method(initWithDelegate:))]
128 #[unsafe(method_family = init)]
129 pub unsafe fn initWithDelegate(
130 this: Allocated<Self>,
131 delegate: Option<&ProtocolObject<dyn UIEditMenuInteractionDelegate>>,
132 ) -> Retained<Self>;
133
134 #[unsafe(method(presentEditMenuWithConfiguration:))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn presentEditMenuWithConfiguration(
143 &self,
144 configuration: &UIEditMenuConfiguration,
145 );
146
147 #[unsafe(method(dismissMenu))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn dismissMenu(&self);
151
152 #[unsafe(method(reloadVisibleMenu))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn reloadVisibleMenu(&self);
158
159 #[unsafe(method(updateVisibleMenuPositionAnimated:))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn updateVisibleMenuPositionAnimated(&self, animated: bool);
165
166 #[cfg(all(
167 feature = "UIResponder",
168 feature = "UIView",
169 feature = "objc2-core-foundation"
170 ))]
171 #[unsafe(method(locationInView:))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn locationInView(&self, view: Option<&UIView>) -> CGPoint;
175
176 #[unsafe(method(init))]
177 #[unsafe(method_family = init)]
178 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
179
180 #[unsafe(method(new))]
181 #[unsafe(method_family = new)]
182 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
183 );
184}
185
186extern_protocol!(
187 pub unsafe trait UIEditMenuInteractionAnimating:
189 NSObjectProtocol + MainThreadOnly
190 {
191 #[cfg(feature = "block2")]
192 #[unsafe(method(addAnimations:))]
193 #[unsafe(method_family = none)]
194 unsafe fn addAnimations(&self, animations: &block2::DynBlock<dyn Fn()>);
195
196 #[cfg(feature = "block2")]
197 #[unsafe(method(addCompletion:))]
198 #[unsafe(method_family = none)]
199 unsafe fn addCompletion(&self, completion: &block2::DynBlock<dyn Fn()>);
200 }
201);
202
203extern_protocol!(
204 pub unsafe trait UIEditMenuInteractionDelegate:
206 NSObjectProtocol + MainThreadOnly
207 {
208 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
209 #[optional]
223 #[unsafe(method(editMenuInteraction:menuForConfiguration:suggestedActions:))]
224 #[unsafe(method_family = none)]
225 unsafe fn editMenuInteraction_menuForConfiguration_suggestedActions(
226 &self,
227 interaction: &UIEditMenuInteraction,
228 configuration: &UIEditMenuConfiguration,
229 suggested_actions: &NSArray<UIMenuElement>,
230 ) -> Option<Retained<UIMenu>>;
231
232 #[cfg(feature = "objc2-core-foundation")]
233 #[optional]
249 #[unsafe(method(editMenuInteraction:targetRectForConfiguration:))]
250 #[unsafe(method_family = none)]
251 unsafe fn editMenuInteraction_targetRectForConfiguration(
252 &self,
253 interaction: &UIEditMenuInteraction,
254 configuration: &UIEditMenuConfiguration,
255 ) -> CGRect;
256
257 #[optional]
266 #[unsafe(method(editMenuInteraction:willPresentMenuForConfiguration:animator:))]
267 #[unsafe(method_family = none)]
268 unsafe fn editMenuInteraction_willPresentMenuForConfiguration_animator(
269 &self,
270 interaction: &UIEditMenuInteraction,
271 configuration: &UIEditMenuConfiguration,
272 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
273 );
274
275 #[optional]
284 #[unsafe(method(editMenuInteraction:willDismissMenuForConfiguration:animator:))]
285 #[unsafe(method_family = none)]
286 unsafe fn editMenuInteraction_willDismissMenuForConfiguration_animator(
287 &self,
288 interaction: &UIEditMenuInteraction,
289 configuration: &UIEditMenuConfiguration,
290 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
291 );
292 }
293);