objc2_ui_kit/generated/
UIDragItem.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidragitem?language=objc)
12    #[unsafe(super(NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct UIDragItem;
16);
17
18unsafe impl NSObjectProtocol for UIDragItem {}
19
20impl UIDragItem {
21    extern_methods!(
22        #[unsafe(method(initWithItemProvider:))]
23        #[unsafe(method_family = init)]
24        pub unsafe fn initWithItemProvider(
25            this: Allocated<Self>,
26            item_provider: &NSItemProvider,
27        ) -> Retained<Self>;
28
29        #[unsafe(method(init))]
30        #[unsafe(method_family = init)]
31        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
32
33        #[unsafe(method(new))]
34        #[unsafe(method_family = new)]
35        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
36
37        #[unsafe(method(itemProvider))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn itemProvider(&self) -> Retained<NSItemProvider>;
40
41        /// Use `localObject` to attach additional information to
42        /// this drag item, visible only inside the app that started the drag.
43        #[unsafe(method(localObject))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn localObject(&self) -> Option<Retained<AnyObject>>;
46
47        /// Setter for [`localObject`][Self::localObject].
48        #[unsafe(method(setLocalObject:))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn setLocalObject(&self, local_object: Option<&AnyObject>);
51
52        #[cfg(all(feature = "UIDragPreview", feature = "block2"))]
53        /// Use `previewProvider` to change the preview for an item.
54        ///
55        /// Each item is usually given a preview when the drag begins,
56        /// either by the UIDragInteractionDelegate's `-dragInteraction:previewForLiftingItem:session:`
57        /// method, or by creating a preview from the dragging view.
58        ///
59        /// During the drag, applications may attempt to change the item's preview,
60        /// by setting `previewProvider` to a block that returns a preview.
61        /// It will be called when and if the system requests it.
62        ///
63        /// To use the default preview, set `previewProvider` to nil.
64        /// To hide the preview, set `previewProvider` to a block that returns nil.
65        #[unsafe(method(previewProvider))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn previewProvider(&self) -> *mut block2::Block<dyn Fn() -> *mut UIDragPreview>;
68
69        #[cfg(all(feature = "UIDragPreview", feature = "block2"))]
70        /// Setter for [`previewProvider`][Self::previewProvider].
71        #[unsafe(method(setPreviewProvider:))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn setPreviewProvider(
74            &self,
75            preview_provider: Option<&block2::Block<dyn Fn() -> *mut UIDragPreview>>,
76        );
77
78        /// Requests for the drop preview to be updated if an active drop animation is in progress, and can handle updates.
79        /// If no active drop animation is in progress for the specified item, then nothing happens.
80        #[unsafe(method(setNeedsDropPreviewUpdate))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn setNeedsDropPreviewUpdate(&self);
83    );
84}