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
46unsafe impl NSObjectProtocol for UIEditMenuConfiguration {}
47
48impl UIEditMenuConfiguration {
49 extern_methods!(
50 #[unsafe(method(identifier))]
52 #[unsafe(method_family = none)]
53 pub unsafe fn identifier(&self) -> Retained<ProtocolObject<dyn NSCopying>>;
54
55 #[cfg(feature = "objc2-core-foundation")]
56 #[unsafe(method(sourcePoint))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn sourcePoint(&self) -> CGPoint;
63
64 #[unsafe(method(preferredArrowDirection))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn preferredArrowDirection(&self) -> UIEditMenuArrowDirection;
69
70 #[unsafe(method(setPreferredArrowDirection:))]
72 #[unsafe(method_family = none)]
73 pub unsafe fn setPreferredArrowDirection(
74 &self,
75 preferred_arrow_direction: UIEditMenuArrowDirection,
76 );
77
78 #[cfg(feature = "objc2-core-foundation")]
79 #[unsafe(method(configurationWithIdentifier:sourcePoint:))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn configurationWithIdentifier_sourcePoint(
83 identifier: Option<&ProtocolObject<dyn NSCopying>>,
84 source_point: CGPoint,
85 mtm: MainThreadMarker,
86 ) -> Retained<Self>;
87
88 #[unsafe(method(init))]
89 #[unsafe(method_family = init)]
90 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
91
92 #[unsafe(method(new))]
93 #[unsafe(method_family = new)]
94 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
95 );
96}
97
98extern_class!(
99 #[unsafe(super(NSObject))]
101 #[thread_kind = MainThreadOnly]
102 #[derive(Debug, PartialEq, Eq, Hash)]
103 pub struct UIEditMenuInteraction;
104);
105
106unsafe impl NSObjectProtocol for UIEditMenuInteraction {}
107
108#[cfg(feature = "UIInteraction")]
109unsafe impl UIInteraction for UIEditMenuInteraction {}
110
111impl UIEditMenuInteraction {
112 extern_methods!(
113 #[unsafe(method(delegate))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn delegate(
117 &self,
118 ) -> Option<Retained<ProtocolObject<dyn UIEditMenuInteractionDelegate>>>;
119
120 #[unsafe(method(initWithDelegate:))]
122 #[unsafe(method_family = init)]
123 pub unsafe fn initWithDelegate(
124 this: Allocated<Self>,
125 delegate: Option<&ProtocolObject<dyn UIEditMenuInteractionDelegate>>,
126 ) -> Retained<Self>;
127
128 #[unsafe(method(presentEditMenuWithConfiguration:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn presentEditMenuWithConfiguration(
137 &self,
138 configuration: &UIEditMenuConfiguration,
139 );
140
141 #[unsafe(method(dismissMenu))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn dismissMenu(&self);
145
146 #[unsafe(method(reloadVisibleMenu))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn reloadVisibleMenu(&self);
152
153 #[unsafe(method(updateVisibleMenuPositionAnimated:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn updateVisibleMenuPositionAnimated(&self, animated: bool);
159
160 #[cfg(all(
161 feature = "UIResponder",
162 feature = "UIView",
163 feature = "objc2-core-foundation"
164 ))]
165 #[unsafe(method(locationInView:))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn locationInView(&self, view: Option<&UIView>) -> CGPoint;
169
170 #[unsafe(method(init))]
171 #[unsafe(method_family = init)]
172 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
173
174 #[unsafe(method(new))]
175 #[unsafe(method_family = new)]
176 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
177 );
178}
179
180extern_protocol!(
181 pub unsafe trait UIEditMenuInteractionAnimating:
183 NSObjectProtocol + MainThreadOnly
184 {
185 #[cfg(feature = "block2")]
186 #[unsafe(method(addAnimations:))]
187 #[unsafe(method_family = none)]
188 unsafe fn addAnimations(&self, animations: &block2::Block<dyn Fn()>);
189
190 #[cfg(feature = "block2")]
191 #[unsafe(method(addCompletion:))]
192 #[unsafe(method_family = none)]
193 unsafe fn addCompletion(&self, completion: &block2::Block<dyn Fn()>);
194 }
195);
196
197extern_protocol!(
198 pub unsafe trait UIEditMenuInteractionDelegate: NSObjectProtocol {
200 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
201 #[optional]
215 #[unsafe(method(editMenuInteraction:menuForConfiguration:suggestedActions:))]
216 #[unsafe(method_family = none)]
217 unsafe fn editMenuInteraction_menuForConfiguration_suggestedActions(
218 &self,
219 interaction: &UIEditMenuInteraction,
220 configuration: &UIEditMenuConfiguration,
221 suggested_actions: &NSArray<UIMenuElement>,
222 ) -> Option<Retained<UIMenu>>;
223
224 #[cfg(feature = "objc2-core-foundation")]
225 #[optional]
241 #[unsafe(method(editMenuInteraction:targetRectForConfiguration:))]
242 #[unsafe(method_family = none)]
243 unsafe fn editMenuInteraction_targetRectForConfiguration(
244 &self,
245 interaction: &UIEditMenuInteraction,
246 configuration: &UIEditMenuConfiguration,
247 ) -> CGRect;
248
249 #[optional]
258 #[unsafe(method(editMenuInteraction:willPresentMenuForConfiguration:animator:))]
259 #[unsafe(method_family = none)]
260 unsafe fn editMenuInteraction_willPresentMenuForConfiguration_animator(
261 &self,
262 interaction: &UIEditMenuInteraction,
263 configuration: &UIEditMenuConfiguration,
264 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
265 );
266
267 #[optional]
276 #[unsafe(method(editMenuInteraction:willDismissMenuForConfiguration:animator:))]
277 #[unsafe(method_family = none)]
278 unsafe fn editMenuInteraction_willDismissMenuForConfiguration_animator(
279 &self,
280 interaction: &UIEditMenuInteraction,
281 configuration: &UIEditMenuConfiguration,
282 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
283 );
284 }
285);