objc2_browser_engine_kit/generated/
BEDragInteraction.rs

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