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 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 fn sourcePoint(&self) -> CGPoint;
65
66 #[unsafe(method(preferredArrowDirection))]
69 #[unsafe(method_family = none)]
70 pub fn preferredArrowDirection(&self) -> UIEditMenuArrowDirection;
71
72 #[unsafe(method(setPreferredArrowDirection:))]
74 #[unsafe(method_family = none)]
75 pub fn setPreferredArrowDirection(
76 &self,
77 preferred_arrow_direction: UIEditMenuArrowDirection,
78 );
79
80 #[cfg(feature = "objc2-core-foundation")]
81 #[unsafe(method(configurationWithIdentifier:sourcePoint:))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn configurationWithIdentifier_sourcePoint(
89 identifier: Option<&ProtocolObject<dyn NSCopying>>,
90 source_point: CGPoint,
91 mtm: MainThreadMarker,
92 ) -> Retained<Self>;
93
94 #[unsafe(method(init))]
95 #[unsafe(method_family = init)]
96 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
97
98 #[unsafe(method(new))]
99 #[unsafe(method_family = new)]
100 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
101 );
102}
103
104extern_class!(
105 #[unsafe(super(NSObject))]
107 #[thread_kind = MainThreadOnly]
108 #[derive(Debug, PartialEq, Eq, Hash)]
109 pub struct UIEditMenuInteraction;
110);
111
112extern_conformance!(
113 unsafe impl NSObjectProtocol for UIEditMenuInteraction {}
114);
115
116#[cfg(feature = "UIInteraction")]
117extern_conformance!(
118 unsafe impl UIInteraction for UIEditMenuInteraction {}
119);
120
121impl UIEditMenuInteraction {
122 extern_methods!(
123 #[unsafe(method(delegate))]
125 #[unsafe(method_family = none)]
126 pub fn delegate(
127 &self,
128 ) -> Option<Retained<ProtocolObject<dyn UIEditMenuInteractionDelegate>>>;
129
130 #[unsafe(method(initWithDelegate:))]
132 #[unsafe(method_family = init)]
133 pub fn initWithDelegate(
134 this: Allocated<Self>,
135 delegate: Option<&ProtocolObject<dyn UIEditMenuInteractionDelegate>>,
136 ) -> Retained<Self>;
137
138 #[unsafe(method(presentEditMenuWithConfiguration:))]
145 #[unsafe(method_family = none)]
146 pub fn presentEditMenuWithConfiguration(&self, configuration: &UIEditMenuConfiguration);
147
148 #[unsafe(method(dismissMenu))]
150 #[unsafe(method_family = none)]
151 pub fn dismissMenu(&self);
152
153 #[unsafe(method(reloadVisibleMenu))]
157 #[unsafe(method_family = none)]
158 pub fn reloadVisibleMenu(&self);
159
160 #[unsafe(method(updateVisibleMenuPositionAnimated:))]
164 #[unsafe(method_family = none)]
165 pub fn updateVisibleMenuPositionAnimated(&self, animated: bool);
166
167 #[cfg(all(
168 feature = "UIResponder",
169 feature = "UIView",
170 feature = "objc2-core-foundation"
171 ))]
172 #[unsafe(method(locationInView:))]
174 #[unsafe(method_family = none)]
175 pub fn locationInView(&self, view: Option<&UIView>) -> CGPoint;
176
177 #[unsafe(method(init))]
178 #[unsafe(method_family = init)]
179 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
180
181 #[unsafe(method(new))]
182 #[unsafe(method_family = new)]
183 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
184 );
185}
186
187extern_protocol!(
188 pub unsafe trait UIEditMenuInteractionAnimating:
190 NSObjectProtocol + MainThreadOnly
191 {
192 #[cfg(feature = "block2")]
193 #[unsafe(method(addAnimations:))]
194 #[unsafe(method_family = none)]
195 fn addAnimations(&self, animations: &block2::DynBlock<dyn Fn()>);
196
197 #[cfg(feature = "block2")]
198 #[unsafe(method(addCompletion:))]
199 #[unsafe(method_family = none)]
200 fn addCompletion(&self, completion: &block2::DynBlock<dyn Fn()>);
201 }
202);
203
204extern_protocol!(
205 pub unsafe trait UIEditMenuInteractionDelegate: NSObjectProtocol {
207 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
208 #[optional]
222 #[unsafe(method(editMenuInteraction:menuForConfiguration:suggestedActions:))]
223 #[unsafe(method_family = none)]
224 fn editMenuInteraction_menuForConfiguration_suggestedActions(
225 &self,
226 interaction: &UIEditMenuInteraction,
227 configuration: &UIEditMenuConfiguration,
228 suggested_actions: &NSArray<UIMenuElement>,
229 ) -> Option<Retained<UIMenu>>;
230
231 #[cfg(feature = "objc2-core-foundation")]
232 #[optional]
248 #[unsafe(method(editMenuInteraction:targetRectForConfiguration:))]
249 #[unsafe(method_family = none)]
250 fn editMenuInteraction_targetRectForConfiguration(
251 &self,
252 interaction: &UIEditMenuInteraction,
253 configuration: &UIEditMenuConfiguration,
254 ) -> CGRect;
255
256 #[optional]
265 #[unsafe(method(editMenuInteraction:willPresentMenuForConfiguration:animator:))]
266 #[unsafe(method_family = none)]
267 fn editMenuInteraction_willPresentMenuForConfiguration_animator(
268 &self,
269 interaction: &UIEditMenuInteraction,
270 configuration: &UIEditMenuConfiguration,
271 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
272 );
273
274 #[optional]
283 #[unsafe(method(editMenuInteraction:willDismissMenuForConfiguration:animator:))]
284 #[unsafe(method_family = none)]
285 fn editMenuInteraction_willDismissMenuForConfiguration_animator(
286 &self,
287 interaction: &UIEditMenuInteraction,
288 configuration: &UIEditMenuConfiguration,
289 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
290 );
291 }
292);