objc2_app_kit/generated/
NSPasteboardItem.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[unsafe(super(NSObject))]
13 #[derive(Debug, PartialEq, Eq, Hash)]
14 pub struct NSPasteboardItem;
15);
16
17unsafe impl NSObjectProtocol for NSPasteboardItem {}
18
19#[cfg(feature = "NSPasteboard")]
20unsafe impl NSPasteboardReading for NSPasteboardItem {}
21
22#[cfg(feature = "NSPasteboard")]
23unsafe impl NSPasteboardWriting for NSPasteboardItem {}
24
25impl NSPasteboardItem {
26 extern_methods!(
27 #[cfg(feature = "NSPasteboard")]
28 #[unsafe(method(types))]
29 #[unsafe(method_family = none)]
30 pub unsafe fn types(&self) -> Retained<NSArray<NSPasteboardType>>;
31
32 #[cfg(feature = "NSPasteboard")]
33 #[unsafe(method(availableTypeFromArray:))]
34 #[unsafe(method_family = none)]
35 pub unsafe fn availableTypeFromArray(
36 &self,
37 types: &NSArray<NSPasteboardType>,
38 ) -> Option<Retained<NSPasteboardType>>;
39
40 #[cfg(feature = "NSPasteboard")]
41 #[unsafe(method(setDataProvider:forTypes:))]
42 #[unsafe(method_family = none)]
43 pub unsafe fn setDataProvider_forTypes(
44 &self,
45 data_provider: &ProtocolObject<dyn NSPasteboardItemDataProvider>,
46 types: &NSArray<NSPasteboardType>,
47 ) -> bool;
48
49 #[cfg(feature = "NSPasteboard")]
50 #[unsafe(method(setData:forType:))]
51 #[unsafe(method_family = none)]
52 pub unsafe fn setData_forType(&self, data: &NSData, r#type: &NSPasteboardType) -> bool;
53
54 #[cfg(feature = "NSPasteboard")]
55 #[unsafe(method(setString:forType:))]
56 #[unsafe(method_family = none)]
57 pub unsafe fn setString_forType(
58 &self,
59 string: &NSString,
60 r#type: &NSPasteboardType,
61 ) -> bool;
62
63 #[cfg(feature = "NSPasteboard")]
64 #[unsafe(method(setPropertyList:forType:))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn setPropertyList_forType(
67 &self,
68 property_list: &AnyObject,
69 r#type: &NSPasteboardType,
70 ) -> bool;
71
72 #[cfg(feature = "NSPasteboard")]
73 #[unsafe(method(dataForType:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn dataForType(&self, r#type: &NSPasteboardType) -> Option<Retained<NSData>>;
76
77 #[cfg(feature = "NSPasteboard")]
78 #[unsafe(method(stringForType:))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn stringForType(&self, r#type: &NSPasteboardType)
81 -> Option<Retained<NSString>>;
82
83 #[cfg(feature = "NSPasteboard")]
84 #[unsafe(method(propertyListForType:))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn propertyListForType(
87 &self,
88 r#type: &NSPasteboardType,
89 ) -> Option<Retained<AnyObject>>;
90 );
91}
92
93impl NSPasteboardItem {
95 extern_methods!(
96 #[unsafe(method(init))]
97 #[unsafe(method_family = init)]
98 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
99
100 #[unsafe(method(new))]
101 #[unsafe(method_family = new)]
102 pub unsafe fn new() -> Retained<Self>;
103 );
104}
105
106extern_protocol!(
107 pub unsafe trait NSPasteboardItemDataProvider: NSObjectProtocol {
109 #[cfg(feature = "NSPasteboard")]
110 #[unsafe(method(pasteboard:item:provideDataForType:))]
111 #[unsafe(method_family = none)]
112 unsafe fn pasteboard_item_provideDataForType(
113 &self,
114 pasteboard: Option<&NSPasteboard>,
115 item: &NSPasteboardItem,
116 r#type: &NSPasteboardType,
117 );
118
119 #[cfg(feature = "NSPasteboard")]
120 #[optional]
121 #[unsafe(method(pasteboardFinishedWithDataProvider:))]
122 #[unsafe(method_family = none)]
123 unsafe fn pasteboardFinishedWithDataProvider(&self, pasteboard: &NSPasteboard);
124 }
125);