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 unsafe fn delegate(
77 &self,
78 ) -> Option<Retained<ProtocolObject<dyn UIContextMenuInteractionDelegate>>>;
79
80 #[unsafe(method(menuAppearance))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn menuAppearance(&self) -> UIContextMenuInteractionAppearance;
85
86 #[unsafe(method(initWithDelegate:))]
87 #[unsafe(method_family = init)]
88 pub unsafe 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 unsafe fn locationInView(&self, view: Option<&UIView>) -> CGPoint;
113
114 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
115 #[unsafe(method(updateVisibleMenuWithBlock:))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn updateVisibleMenuWithBlock(
132 &self,
133 block: &block2::DynBlock<dyn Fn(NonNull<UIMenu>) -> NonNull<UIMenu> + '_>,
134 );
135
136 #[unsafe(method(dismissMenu))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn dismissMenu(&self);
140 );
141}
142
143extern_protocol!(
144 pub unsafe trait UIContextMenuInteractionAnimating:
146 NSObjectProtocol + MainThreadOnly
147 {
148 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
149 #[unsafe(method(previewViewController))]
151 #[unsafe(method_family = none)]
152 unsafe fn previewViewController(&self) -> Option<Retained<UIViewController>>;
153
154 #[cfg(feature = "block2")]
155 #[unsafe(method(addAnimations:))]
156 #[unsafe(method_family = none)]
157 unsafe fn addAnimations(&self, animations: &block2::DynBlock<dyn Fn()>);
158
159 #[cfg(feature = "block2")]
160 #[unsafe(method(addCompletion:))]
161 #[unsafe(method_family = none)]
162 unsafe fn addCompletion(&self, completion: &block2::DynBlock<dyn Fn()>);
163 }
164);
165
166extern_protocol!(
167 pub unsafe trait UIContextMenuInteractionCommitAnimating:
169 UIContextMenuInteractionAnimating + MainThreadOnly
170 {
171 #[unsafe(method(preferredCommitStyle))]
173 #[unsafe(method_family = none)]
174 unsafe fn preferredCommitStyle(&self) -> UIContextMenuInteractionCommitStyle;
175
176 #[unsafe(method(setPreferredCommitStyle:))]
178 #[unsafe(method_family = none)]
179 unsafe fn setPreferredCommitStyle(
180 &self,
181 preferred_commit_style: UIContextMenuInteractionCommitStyle,
182 );
183 }
184);
185
186extern_protocol!(
187 pub unsafe trait UIContextMenuInteractionDelegate:
189 NSObjectProtocol + MainThreadOnly
190 {
191 #[cfg(all(
192 feature = "UIContextMenuConfiguration",
193 feature = "objc2-core-foundation"
194 ))]
195 #[unsafe(method(contextMenuInteraction:configurationForMenuAtLocation:))]
208 #[unsafe(method_family = none)]
209 unsafe fn contextMenuInteraction_configurationForMenuAtLocation(
210 &self,
211 interaction: &UIContextMenuInteraction,
212 location: CGPoint,
213 ) -> Option<Retained<UIContextMenuConfiguration>>;
214
215 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
216 #[optional]
225 #[unsafe(method(contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:))]
226 #[unsafe(method_family = none)]
227 unsafe fn contextMenuInteraction_configuration_highlightPreviewForItemWithIdentifier(
228 &self,
229 interaction: &UIContextMenuInteraction,
230 configuration: &UIContextMenuConfiguration,
231 identifier: &ProtocolObject<dyn NSCopying>,
232 ) -> Option<Retained<UITargetedPreview>>;
233
234 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
235 #[optional]
244 #[unsafe(method(contextMenuInteraction:configuration:dismissalPreviewForItemWithIdentifier:))]
245 #[unsafe(method_family = none)]
246 unsafe fn contextMenuInteraction_configuration_dismissalPreviewForItemWithIdentifier(
247 &self,
248 interaction: &UIContextMenuInteraction,
249 configuration: &UIContextMenuConfiguration,
250 identifier: &ProtocolObject<dyn NSCopying>,
251 ) -> Option<Retained<UITargetedPreview>>;
252
253 #[cfg(feature = "UIContextMenuConfiguration")]
254 #[optional]
263 #[unsafe(method(contextMenuInteraction:willPerformPreviewActionForMenuWithConfiguration:animator:))]
264 #[unsafe(method_family = none)]
265 unsafe fn contextMenuInteraction_willPerformPreviewActionForMenuWithConfiguration_animator(
266 &self,
267 interaction: &UIContextMenuInteraction,
268 configuration: &UIContextMenuConfiguration,
269 animator: &ProtocolObject<dyn UIContextMenuInteractionCommitAnimating>,
270 );
271
272 #[cfg(feature = "UIContextMenuConfiguration")]
273 #[optional]
282 #[unsafe(method(contextMenuInteraction:willDisplayMenuForConfiguration:animator:))]
283 #[unsafe(method_family = none)]
284 unsafe fn contextMenuInteraction_willDisplayMenuForConfiguration_animator(
285 &self,
286 interaction: &UIContextMenuInteraction,
287 configuration: &UIContextMenuConfiguration,
288 animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
289 );
290
291 #[cfg(feature = "UIContextMenuConfiguration")]
292 #[optional]
301 #[unsafe(method(contextMenuInteraction:willEndForConfiguration:animator:))]
302 #[unsafe(method_family = none)]
303 unsafe fn contextMenuInteraction_willEndForConfiguration_animator(
304 &self,
305 interaction: &UIContextMenuInteraction,
306 configuration: &UIContextMenuConfiguration,
307 animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
308 );
309
310 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
311 #[deprecated]
318 #[optional]
319 #[unsafe(method(contextMenuInteraction:previewForHighlightingMenuWithConfiguration:))]
320 #[unsafe(method_family = none)]
321 unsafe fn contextMenuInteraction_previewForHighlightingMenuWithConfiguration(
322 &self,
323 interaction: &UIContextMenuInteraction,
324 configuration: &UIContextMenuConfiguration,
325 ) -> Option<Retained<UITargetedPreview>>;
326
327 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
328 #[deprecated]
340 #[optional]
341 #[unsafe(method(contextMenuInteraction:previewForDismissingMenuWithConfiguration:))]
342 #[unsafe(method_family = none)]
343 unsafe fn contextMenuInteraction_previewForDismissingMenuWithConfiguration(
344 &self,
345 interaction: &UIContextMenuInteraction,
346 configuration: &UIContextMenuConfiguration,
347 ) -> Option<Retained<UITargetedPreview>>;
348 }
349);