objc2_app_kit/generated/
NSDraggingItem.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
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdraggingimagecomponentkey?language=objc)
11// NS_TYPED_EXTENSIBLE_ENUM
12pub type NSDraggingImageComponentKey = NSString;
13
14extern "C" {
15    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdraggingimagecomponenticonkey?language=objc)
16    pub static NSDraggingImageComponentIconKey: &'static NSDraggingImageComponentKey;
17}
18
19extern "C" {
20    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdraggingimagecomponentlabelkey?language=objc)
21    pub static NSDraggingImageComponentLabelKey: &'static NSDraggingImageComponentKey;
22}
23
24extern_class!(
25    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdraggingimagecomponent?language=objc)
26    #[unsafe(super(NSObject))]
27    #[derive(Debug, PartialEq, Eq, Hash)]
28    pub struct NSDraggingImageComponent;
29);
30
31extern_conformance!(
32    unsafe impl NSObjectProtocol for NSDraggingImageComponent {}
33);
34
35impl NSDraggingImageComponent {
36    extern_methods!(
37        #[unsafe(method(draggingImageComponentWithKey:))]
38        #[unsafe(method_family = none)]
39        pub fn draggingImageComponentWithKey(
40            key: &NSDraggingImageComponentKey,
41        ) -> Retained<NSDraggingImageComponent>;
42
43        #[unsafe(method(initWithKey:))]
44        #[unsafe(method_family = init)]
45        pub fn initWithKey(
46            this: Allocated<Self>,
47            key: &NSDraggingImageComponentKey,
48        ) -> Retained<Self>;
49
50        #[unsafe(method(init))]
51        #[unsafe(method_family = init)]
52        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
53
54        #[unsafe(method(key))]
55        #[unsafe(method_family = none)]
56        pub fn key(&self) -> Retained<NSDraggingImageComponentKey>;
57
58        /// Setter for [`key`][Self::key].
59        ///
60        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
61        #[unsafe(method(setKey:))]
62        #[unsafe(method_family = none)]
63        pub fn setKey(&self, key: &NSDraggingImageComponentKey);
64
65        #[unsafe(method(contents))]
66        #[unsafe(method_family = none)]
67        pub fn contents(&self) -> Option<Retained<AnyObject>>;
68
69        /// Setter for [`contents`][Self::contents].
70        ///
71        /// # Safety
72        ///
73        /// `contents` should be of the correct type.
74        #[unsafe(method(setContents:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setContents(&self, contents: Option<&AnyObject>);
77
78        #[unsafe(method(frame))]
79        #[unsafe(method_family = none)]
80        pub fn frame(&self) -> NSRect;
81
82        /// Setter for [`frame`][Self::frame].
83        #[unsafe(method(setFrame:))]
84        #[unsafe(method_family = none)]
85        pub fn setFrame(&self, frame: NSRect);
86    );
87}
88
89/// Methods declared on superclass `NSObject`.
90impl NSDraggingImageComponent {
91    extern_methods!(
92        #[unsafe(method(new))]
93        #[unsafe(method_family = new)]
94        pub unsafe fn new() -> Retained<Self>;
95    );
96}
97
98extern_class!(
99    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdraggingitem?language=objc)
100    #[unsafe(super(NSObject))]
101    #[derive(Debug, PartialEq, Eq, Hash)]
102    pub struct NSDraggingItem;
103);
104
105extern_conformance!(
106    unsafe impl NSObjectProtocol for NSDraggingItem {}
107);
108
109impl NSDraggingItem {
110    extern_methods!(
111        #[cfg(feature = "NSPasteboard")]
112        #[unsafe(method(initWithPasteboardWriter:))]
113        #[unsafe(method_family = init)]
114        pub fn initWithPasteboardWriter(
115            this: Allocated<Self>,
116            pasteboard_writer: &ProtocolObject<dyn NSPasteboardWriting>,
117        ) -> Retained<Self>;
118
119        #[unsafe(method(init))]
120        #[unsafe(method_family = init)]
121        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
122
123        #[unsafe(method(item))]
124        #[unsafe(method_family = none)]
125        pub fn item(&self) -> Retained<AnyObject>;
126
127        #[unsafe(method(draggingFrame))]
128        #[unsafe(method_family = none)]
129        pub fn draggingFrame(&self) -> NSRect;
130
131        /// Setter for [`draggingFrame`][Self::draggingFrame].
132        #[unsafe(method(setDraggingFrame:))]
133        #[unsafe(method_family = none)]
134        pub fn setDraggingFrame(&self, dragging_frame: NSRect);
135
136        #[cfg(feature = "block2")]
137        #[unsafe(method(imageComponentsProvider))]
138        #[unsafe(method_family = none)]
139        pub fn imageComponentsProvider(
140            &self,
141        ) -> *mut block2::DynBlock<dyn Fn() -> NonNull<NSArray<NSDraggingImageComponent>>>;
142
143        #[cfg(feature = "block2")]
144        /// Setter for [`imageComponentsProvider`][Self::imageComponentsProvider].
145        ///
146        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
147        ///
148        /// # Safety
149        ///
150        /// `image_components_provider` block's return must be a valid pointer.
151        #[unsafe(method(setImageComponentsProvider:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn setImageComponentsProvider(
154            &self,
155            image_components_provider: Option<
156                &block2::DynBlock<dyn Fn() -> NonNull<NSArray<NSDraggingImageComponent>>>,
157            >,
158        );
159
160        /// # Safety
161        ///
162        /// `contents` should be of the correct type.
163        #[unsafe(method(setDraggingFrame:contents:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn setDraggingFrame_contents(&self, frame: NSRect, contents: Option<&AnyObject>);
166
167        #[unsafe(method(imageComponents))]
168        #[unsafe(method_family = none)]
169        pub fn imageComponents(&self) -> Option<Retained<NSArray<NSDraggingImageComponent>>>;
170    );
171}
172
173/// Methods declared on superclass `NSObject`.
174impl NSDraggingItem {
175    extern_methods!(
176        #[unsafe(method(new))]
177        #[unsafe(method_family = new)]
178        pub unsafe fn new() -> Retained<Self>;
179    );
180}