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
62unsafe impl NSObjectProtocol for UIContextMenuInteraction {}
63
64#[cfg(feature = "UIInteraction")]
65unsafe impl UIInteraction for UIContextMenuInteraction {}
66
67impl UIContextMenuInteraction {
68 extern_methods!(
69 #[unsafe(method(delegate))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn delegate(
73 &self,
74 ) -> Option<Retained<ProtocolObject<dyn UIContextMenuInteractionDelegate>>>;
75
76 #[unsafe(method(menuAppearance))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn menuAppearance(&self) -> UIContextMenuInteractionAppearance;
81
82 #[unsafe(method(initWithDelegate:))]
83 #[unsafe(method_family = init)]
84 pub unsafe fn initWithDelegate(
85 this: Allocated<Self>,
86 delegate: &ProtocolObject<dyn UIContextMenuInteractionDelegate>,
87 ) -> Retained<Self>;
88
89 #[unsafe(method(init))]
90 #[unsafe(method_family = init)]
91 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
92
93 #[unsafe(method(new))]
94 #[unsafe(method_family = new)]
95 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
96
97 #[cfg(all(
98 feature = "UIResponder",
99 feature = "UIView",
100 feature = "objc2-core-foundation"
101 ))]
102 #[unsafe(method(locationInView:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn locationInView(&self, view: Option<&UIView>) -> CGPoint;
109
110 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
111 #[unsafe(method(updateVisibleMenuWithBlock:))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn updateVisibleMenuWithBlock(
128 &self,
129 block: &block2::Block<dyn Fn(NonNull<UIMenu>) -> NonNull<UIMenu> + '_>,
130 );
131
132 #[unsafe(method(dismissMenu))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn dismissMenu(&self);
136 );
137}
138
139extern_protocol!(
140 pub unsafe trait UIContextMenuInteractionAnimating:
142 NSObjectProtocol + MainThreadOnly
143 {
144 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
145 #[unsafe(method(previewViewController))]
147 #[unsafe(method_family = none)]
148 unsafe fn previewViewController(&self) -> Option<Retained<UIViewController>>;
149
150 #[cfg(feature = "block2")]
151 #[unsafe(method(addAnimations:))]
152 #[unsafe(method_family = none)]
153 unsafe fn addAnimations(&self, animations: &block2::Block<dyn Fn()>);
154
155 #[cfg(feature = "block2")]
156 #[unsafe(method(addCompletion:))]
157 #[unsafe(method_family = none)]
158 unsafe fn addCompletion(&self, completion: &block2::Block<dyn Fn()>);
159 }
160);
161
162extern_protocol!(
163 pub unsafe trait UIContextMenuInteractionCommitAnimating:
165 UIContextMenuInteractionAnimating + MainThreadOnly
166 {
167 #[unsafe(method(preferredCommitStyle))]
169 #[unsafe(method_family = none)]
170 unsafe fn preferredCommitStyle(&self) -> UIContextMenuInteractionCommitStyle;
171
172 #[unsafe(method(setPreferredCommitStyle:))]
174 #[unsafe(method_family = none)]
175 unsafe fn setPreferredCommitStyle(
176 &self,
177 preferred_commit_style: UIContextMenuInteractionCommitStyle,
178 );
179 }
180);
181
182extern_protocol!(
183 pub unsafe trait UIContextMenuInteractionDelegate:
185 NSObjectProtocol + MainThreadOnly
186 {
187 #[cfg(all(
188 feature = "UIContextMenuConfiguration",
189 feature = "objc2-core-foundation"
190 ))]
191 #[unsafe(method(contextMenuInteraction:configurationForMenuAtLocation:))]
204 #[unsafe(method_family = none)]
205 unsafe fn contextMenuInteraction_configurationForMenuAtLocation(
206 &self,
207 interaction: &UIContextMenuInteraction,
208 location: CGPoint,
209 ) -> Option<Retained<UIContextMenuConfiguration>>;
210
211 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
212 #[optional]
221 #[unsafe(method(contextMenuInteraction:configuration:highlightPreviewForItemWithIdentifier:))]
222 #[unsafe(method_family = none)]
223 unsafe fn contextMenuInteraction_configuration_highlightPreviewForItemWithIdentifier(
224 &self,
225 interaction: &UIContextMenuInteraction,
226 configuration: &UIContextMenuConfiguration,
227 identifier: &ProtocolObject<dyn NSCopying>,
228 ) -> Option<Retained<UITargetedPreview>>;
229
230 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
231 #[optional]
240 #[unsafe(method(contextMenuInteraction:configuration:dismissalPreviewForItemWithIdentifier:))]
241 #[unsafe(method_family = none)]
242 unsafe fn contextMenuInteraction_configuration_dismissalPreviewForItemWithIdentifier(
243 &self,
244 interaction: &UIContextMenuInteraction,
245 configuration: &UIContextMenuConfiguration,
246 identifier: &ProtocolObject<dyn NSCopying>,
247 ) -> Option<Retained<UITargetedPreview>>;
248
249 #[cfg(feature = "UIContextMenuConfiguration")]
250 #[optional]
259 #[unsafe(method(contextMenuInteraction:willPerformPreviewActionForMenuWithConfiguration:animator:))]
260 #[unsafe(method_family = none)]
261 unsafe fn contextMenuInteraction_willPerformPreviewActionForMenuWithConfiguration_animator(
262 &self,
263 interaction: &UIContextMenuInteraction,
264 configuration: &UIContextMenuConfiguration,
265 animator: &ProtocolObject<dyn UIContextMenuInteractionCommitAnimating>,
266 );
267
268 #[cfg(feature = "UIContextMenuConfiguration")]
269 #[optional]
278 #[unsafe(method(contextMenuInteraction:willDisplayMenuForConfiguration:animator:))]
279 #[unsafe(method_family = none)]
280 unsafe fn contextMenuInteraction_willDisplayMenuForConfiguration_animator(
281 &self,
282 interaction: &UIContextMenuInteraction,
283 configuration: &UIContextMenuConfiguration,
284 animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
285 );
286
287 #[cfg(feature = "UIContextMenuConfiguration")]
288 #[optional]
297 #[unsafe(method(contextMenuInteraction:willEndForConfiguration:animator:))]
298 #[unsafe(method_family = none)]
299 unsafe fn contextMenuInteraction_willEndForConfiguration_animator(
300 &self,
301 interaction: &UIContextMenuInteraction,
302 configuration: &UIContextMenuConfiguration,
303 animator: Option<&ProtocolObject<dyn UIContextMenuInteractionAnimating>>,
304 );
305
306 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
307 #[deprecated]
314 #[optional]
315 #[unsafe(method(contextMenuInteraction:previewForHighlightingMenuWithConfiguration:))]
316 #[unsafe(method_family = none)]
317 unsafe fn contextMenuInteraction_previewForHighlightingMenuWithConfiguration(
318 &self,
319 interaction: &UIContextMenuInteraction,
320 configuration: &UIContextMenuConfiguration,
321 ) -> Option<Retained<UITargetedPreview>>;
322
323 #[cfg(all(feature = "UIContextMenuConfiguration", feature = "UITargetedPreview"))]
324 #[deprecated]
336 #[optional]
337 #[unsafe(method(contextMenuInteraction:previewForDismissingMenuWithConfiguration:))]
338 #[unsafe(method_family = none)]
339 unsafe fn contextMenuInteraction_previewForDismissingMenuWithConfiguration(
340 &self,
341 interaction: &UIContextMenuInteraction,
342 configuration: &UIContextMenuConfiguration,
343 ) -> Option<Retained<UITargetedPreview>>;
344 }
345);