1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use objc2_ui_kit::*;
use crate::*;
extern_protocol!(
/// [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/bedraginteractiondelegate?language=objc)
pub unsafe trait BEDragInteractionDelegate:
UIDragInteractionDelegate + MainThreadOnly
{
#[cfg(feature = "block2")]
/// Called when the drag interaction has begun, to allow the delegate to prepare for the drag session before
/// the system requests drag items through `-dragInteraction:itemsForBeginningSession:`.
///
/// You should call the `completion` block as soon as the drag session is prepared, as to minimize the delay
/// from the user interaction from the drag gesture. There is a system-defined timeout before the drag session is
/// failed if the `completion` is not called in time. The `completion` block returns `YES` if the drag session did
/// prepare successfully prepare, and `NO` otherwise, to allow clients to perform any clean-up if necessary.
#[optional]
#[unsafe(method(dragInteraction:prepareDragSession:completion:))]
#[unsafe(method_family = none)]
unsafe fn dragInteraction_prepareDragSession_completion(
&self,
drag_interaction: &BEDragInteraction,
session: &ProtocolObject<dyn UIDragSession>,
completion: &block2::DynBlock<dyn Fn() -> Bool>,
);
#[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
/// The asynchronous counterpart to `-dragInteraction:itemsForAddingToSession:withTouchAtPoint:` to allow
/// touches on this view to add items to an existing drag session. Please refer to the aforementioned delegate method for its full
/// documentation.
///
/// If this method is implemented, then the `UIDragInteractionDelegate` counterpart method will no longer be called.
///
/// You should call the `completion` block as soon as the items are ready. There is a system-defined
/// timeout before the system will treat the delegate call as returning an empty array. The `completion` block
/// returns `YES` if the drag session did add items to the session successfully, and `NO` otherwise, to allow
/// clients to perform any clean-up if necessary.
#[optional]
#[unsafe(method(dragInteraction:itemsForAddingToSession:forTouchAtPoint:completion:))]
#[unsafe(method_family = none)]
unsafe fn dragInteraction_itemsForAddingToSession_forTouchAtPoint_completion(
&self,
drag_interaction: &BEDragInteraction,
session: &ProtocolObject<dyn UIDragSession>,
point: CGPoint,
completion: &block2::DynBlock<dyn Fn(NonNull<NSArray<UIDragItem>>) -> Bool>,
);
}
);
extern_class!(
/// A `UIDragInteraction` subclass with features specific to browsers to enable asynchronous preparations and behaviours.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/browserenginekit/bedraginteraction?language=objc)
#[unsafe(super(UIDragInteraction, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct BEDragInteraction;
);
extern_conformance!(
unsafe impl NSObjectProtocol for BEDragInteraction {}
);
extern_conformance!(
unsafe impl UIInteraction for BEDragInteraction {}
);
impl BEDragInteraction {
extern_methods!(
/// The object that manages the drag interaction lifecycle.
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn BEDragInteractionDelegate>>>;
/// Creates an drag interaction with the specified delegate.
#[unsafe(method(initWithDelegate:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDelegate(
this: Allocated<Self>,
delegate: &ProtocolObject<dyn BEDragInteractionDelegate>,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `UIDragInteraction`.
impl BEDragInteraction {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}