objc2_ui_kit/generated/
UIContextMenuInteraction.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 UIContextMenuInteractionCommitStyle(pub NSInteger);
17impl UIContextMenuInteractionCommitStyle {
18 #[doc(alias = "UIContextMenuInteractionCommitStyleDismiss")]
19 pub const Dismiss: Self = Self(0);
20 #[doc(alias = "UIContextMenuInteractionCommitStylePop")]
21 pub const Pop: Self = Self(1);
22}
23
24unsafe impl Encode for UIContextMenuInteractionCommitStyle {
25 const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for UIContextMenuInteractionCommitStyle {
29 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct UIContextMenuInteractionAppearance(pub NSInteger);
37impl UIContextMenuInteractionAppearance {
38 #[doc(alias = "UIContextMenuInteractionAppearanceUnknown")]
39 pub const Unknown: Self = Self(0);
40 #[doc(alias = "UIContextMenuInteractionAppearanceRich")]
41 pub const Rich: Self = Self(1);
42 #[doc(alias = "UIContextMenuInteractionAppearanceCompact")]
43 pub const Compact: Self = Self(2);
44}
45
46unsafe impl Encode for UIContextMenuInteractionAppearance {
47 const ENCODING: Encoding = NSInteger::ENCODING;
48}
49
50unsafe impl RefEncode for UIContextMenuInteractionAppearance {
51 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54extern_class!(
55 #[unsafe(super(NSObject))]
57 #[thread_kind = MainThreadOnly]
58 #[derive(Debug, PartialEq, Eq, Hash)]
59 pub struct UIContextMenuInteraction;
60);
61
62extern_conformance!(
63 unsafe impl NSObjectProtocol for UIContextMenuInteraction {}
64);
65
66#[cfg(feature = "UIInteraction")]
67extern_conformance!(
68 unsafe impl UIInteraction for UIContextMenuInteraction {}
69);
70
71impl UIContextMenuInteraction {
72 extern_methods!(
73 #[unsafe(method(delegate))]
75 #[unsafe(method_family = none)]
76 pub fn delegate(
77 &self,
78 ) -> Option<Retained<ProtocolObject<dyn UIContextMenuInteractionDelegate>>>;
79
80 #[unsafe(method(menuAppearance))]
83 #[unsafe(method_family = none)]
84 pub fn menuAppearance(&self) -> UIContextMenuInteractionAppearance;
85
86 #[unsafe(method(initWithDelegate:))]
87 #[unsafe(method_family = init)]
88 pub fn initWithDelegate(
89 this: Allocated<Self>,
90 delegate: &ProtocolObject<dyn UIContextMenuInteractionDelegate>,
91 ) -> Retained<Self>;
92
93 #[unsafe(method(init))]
94 #[unsafe(method_family = init)]
95 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
96
97 #[unsafe(method(new))]
98 #[unsafe(method_family = new)]
99 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
100
101 #[cfg(all(
102 feature = "UIResponder",
103 feature = "UIView",
104 feature = "objc2-core-foundation"
105 ))]
106 #[unsafe(method(locationInView:))]
111 #[unsafe(method_family = none)]
112 pub fn locationInView(&self, view: Option<&UIView>) -> CGPoint;
113
114 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
115 #[unsafe(method(updateVisibleMenuWithBlock:))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn updateVisibleMenuWithBlock(
136 &self,
137 block: &block2::DynBlock<dyn Fn(NonNull<UIMenu>) -> NonNull<UIMenu> + '_>,
138 );
139
140 #[unsafe(method(dismissMenu))]
142 #[unsafe(method_family = none)]
143 pub fn dismissMenu(&self);
144 );
145}
146
147extern_protocol!(
148 pub unsafe trait UIContextMenuInteractionAnimating:
150 NSObjectProtocol + MainThreadOnly
151 {
152 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
153 #[unsafe(method(previewViewController))]
155 #[unsafe(method_family = none)]
156 fn previewViewController(&self) -> Option<Retained<UIViewController>>;
157
158 #[cfg(feature = "block2")]
159 #[unsafe(method(addAnimations:))]
160 #[unsafe(method_family = none)]
161 fn addAnimations(&self, animations: &block2::DynBlock<dyn Fn()>);
162
163 #[cfg(feature = "block2")]
164 #[unsafe(method(addCompletion:))]
165 #[unsafe(method_family = none)]
166 fn addCompletion(&self, completion: &block2::DynBlock<dyn Fn()>);
167 }
168);
169
170extern_protocol!(
171 pub unsafe trait UIContextMenuInteractionCommitAnimating:
173 UIContextMenuInteractionAnimating + MainThreadOnly
174 {
175 #[unsafe(method(preferredCommitStyle))]
177 #[unsafe(method_family = none)]
178 fn preferredCommitStyle(&self) -> UIContextMenuInteractionCommitStyle;
179
180 #[unsafe(method(setPreferredCommitStyle:))]
182 #[unsafe(method_family = none)]
183 fn setPreferredCommitStyle(
184 &self,
185 preferred_commit_style: UIContextMenuInteractionCommitStyle,
186 );
187 }
188);
189
190extern_protocol!(
191 pub unsafe trait UIContextMenuInteractionDelegate:
193 NSObjectProtocol + MainThreadOnly
194 {
195 #[cfg(all(
196 feature = "UIContextMenuConfiguration",
197 feature = "objc2-core-foundation"
198 ))]
199 #[unsafe(method(contextMenuInteraction:configurationForMenuAtLocation:))]
212 #[unsafe(method_family = none)]
213 fn contextMenuInteraction_configurationForMenuAtLocation(
214 &self,
215 interaction: &UIContextMenuInteraction,
216 location: CGPoint,
217 ) -> Option<Retained<UIContextMenuConfiguration>>;
218
219 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
220 #[optional]
233 #[unsafe(method(contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:))]
234 #[unsafe(method_family = none)]
235 unsafe fn contextMenuInteraction_configuration_highlightPreviewForItemWithIdentifier(
236 &self,
237 interaction: &UIContextMenuInteraction,
238 configuration: &UIContextMenuConfiguration,
239 identifier: &ProtocolObject<dyn NSCopying>,
240 ) -> Option<Retained<UITargetedPreview>>;
241
242 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
243 #[optional]
256 #[unsafe(method(contextMenuInteraction:configuration:dismissalPreviewForItemWithIdentifier:))]
257 #[unsafe(method_family = none)]
258 unsafe fn contextMenuInteraction_configuration_dismissalPreviewForItemWithIdentifier(
259 &self,
260 interaction: &UIContextMenuInteraction,
261 configuration: &UIContextMenuConfiguration,
262 identifier: &ProtocolObject<dyn NSCopying>,
263 ) -> Option<Retained<UITargetedPreview>>;
264
265 #[cfg(feature = "UIContextMenuConfiguration")]
266 #[optional]
275 #[unsafe(method(contextMenuInteraction:willPerformPreviewActionForMenuWithConfiguration:animator:))]
276 #[unsafe(method_family = none)]
277 fn contextMenuInteraction_willPerformPreviewActionForMenuWithConfiguration_animator(
278 &self,
279 interaction: &UIContextMenuInteraction,
280 configuration: &UIContextMenuConfiguration,
281 animator: &ProtocolObject<dyn UIContextMenuInteractionCommitAnimating>,
282 );
283
284 #[cfg(feature = "UIContextMenuConfiguration")]
285 #[optional]
294 #[unsafe(method(contextMenuInteraction:willDisplayMenuForConfiguration:animator:))]
295 #[unsafe(method_family = none)]
296 fn contextMenuInteraction_willDisplayMenuForConfiguration_animator(
297 &self,
298 interaction: &UIContextMenuInteraction,
299 configuration: &UIContextMenuConfiguration,
300 animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
301 );
302
303 #[cfg(feature = "UIContextMenuConfiguration")]
304 #[optional]
313 #[unsafe(method(contextMenuInteraction:willEndForConfiguration:animator:))]
314 #[unsafe(method_family = none)]
315 fn contextMenuInteraction_willEndForConfiguration_animator(
316 &self,
317 interaction: &UIContextMenuInteraction,
318 configuration: &UIContextMenuConfiguration,
319 animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
320 );
321
322 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
323 #[deprecated]
330 #[optional]
331 #[unsafe(method(contextMenuInteraction:previewForHighlightingMenuWithConfiguration:))]
332 #[unsafe(method_family = none)]
333 fn contextMenuInteraction_previewForHighlightingMenuWithConfiguration(
334 &self,
335 interaction: &UIContextMenuInteraction,
336 configuration: &UIContextMenuConfiguration,
337 ) -> Option<Retained<UITargetedPreview>>;
338
339 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
340 #[deprecated]
352 #[optional]
353 #[unsafe(method(contextMenuInteraction:previewForDismissingMenuWithConfiguration:))]
354 #[unsafe(method_family = none)]
355 fn contextMenuInteraction_previewForDismissingMenuWithConfiguration(
356 &self,
357 interaction: &UIContextMenuInteraction,
358 configuration: &UIContextMenuConfiguration,
359 ) -> Option<Retained<UITargetedPreview>>;
360 }
361);