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
//! 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::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidragitem?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIDragItem;
);
extern_conformance!(
unsafe impl NSObjectProtocol for UIDragItem {}
);
impl UIDragItem {
extern_methods!(
#[unsafe(method(initWithItemProvider:))]
#[unsafe(method_family = init)]
pub fn initWithItemProvider(
this: Allocated<Self>,
item_provider: &NSItemProvider,
) -> Retained<Self>;
#[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>;
#[unsafe(method(itemProvider))]
#[unsafe(method_family = none)]
pub fn itemProvider(&self) -> Retained<NSItemProvider>;
/// Use `localObject` to attach additional information to
/// this drag item, visible only inside the app that started the drag.
#[unsafe(method(localObject))]
#[unsafe(method_family = none)]
pub fn localObject(&self) -> Option<Retained<AnyObject>>;
/// Setter for [`localObject`][Self::localObject].
///
/// # Safety
///
/// `local_object` should be of the correct type.
#[unsafe(method(setLocalObject:))]
#[unsafe(method_family = none)]
pub unsafe fn setLocalObject(&self, local_object: Option<&AnyObject>);
#[cfg(all(feature = "UIDragPreview", feature = "block2"))]
/// Use `previewProvider` to change the preview for an item.
///
/// Each item is usually given a preview when the drag begins,
/// either by the UIDragInteractionDelegate's `-dragInteraction:previewForLiftingItem:session:`
/// method, or by creating a preview from the dragging view.
///
/// During the drag, applications may attempt to change the item's preview,
/// by setting `previewProvider` to a block that returns a preview.
/// It will be called when and if the system requests it.
///
/// To use the default preview, set `previewProvider` to nil.
/// To hide the preview, set `previewProvider` to a block that returns nil.
#[unsafe(method(previewProvider))]
#[unsafe(method_family = none)]
pub fn previewProvider(&self) -> *mut block2::DynBlock<dyn Fn() -> *mut UIDragPreview>;
#[cfg(all(feature = "UIDragPreview", feature = "block2"))]
/// Setter for [`previewProvider`][Self::previewProvider].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
///
/// # Safety
///
/// `preview_provider` block's return must be a valid pointer or null.
#[unsafe(method(setPreviewProvider:))]
#[unsafe(method_family = none)]
pub unsafe fn setPreviewProvider(
&self,
preview_provider: Option<&block2::DynBlock<dyn Fn() -> *mut UIDragPreview>>,
);
/// Requests for the drop preview to be updated if an active drop animation is in progress, and can handle updates.
/// If no active drop animation is in progress for the specified item, then nothing happens.
#[unsafe(method(setNeedsDropPreviewUpdate))]
#[unsafe(method_family = none)]
pub fn setNeedsDropPreviewUpdate(&self);
);
}