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
31unsafe impl NSObjectProtocol for NSDraggingImageComponent {}
32
33impl NSDraggingImageComponent {
34    extern_methods!(
35        #[unsafe(method(draggingImageComponentWithKey:))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn draggingImageComponentWithKey(
38            key: &NSDraggingImageComponentKey,
39        ) -> Retained<NSDraggingImageComponent>;
40
41        #[unsafe(method(initWithKey:))]
42        #[unsafe(method_family = init)]
43        pub unsafe fn initWithKey(
44            this: Allocated<Self>,
45            key: &NSDraggingImageComponentKey,
46        ) -> Retained<Self>;
47
48        #[unsafe(method(init))]
49        #[unsafe(method_family = init)]
50        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
51
52        #[unsafe(method(key))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn key(&self) -> Retained<NSDraggingImageComponentKey>;
55
56        /// Setter for [`key`][Self::key].
57        #[unsafe(method(setKey:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn setKey(&self, key: &NSDraggingImageComponentKey);
60
61        #[unsafe(method(contents))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn contents(&self) -> Option<Retained<AnyObject>>;
64
65        /// Setter for [`contents`][Self::contents].
66        #[unsafe(method(setContents:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setContents(&self, contents: Option<&AnyObject>);
69
70        #[unsafe(method(frame))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn frame(&self) -> NSRect;
73
74        /// Setter for [`frame`][Self::frame].
75        #[unsafe(method(setFrame:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn setFrame(&self, frame: NSRect);
78    );
79}
80
81/// Methods declared on superclass `NSObject`.
82impl NSDraggingImageComponent {
83    extern_methods!(
84        #[unsafe(method(new))]
85        #[unsafe(method_family = new)]
86        pub unsafe fn new() -> Retained<Self>;
87    );
88}
89
90extern_class!(
91    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdraggingitem?language=objc)
92    #[unsafe(super(NSObject))]
93    #[derive(Debug, PartialEq, Eq, Hash)]
94    pub struct NSDraggingItem;
95);
96
97unsafe impl NSObjectProtocol for NSDraggingItem {}
98
99impl NSDraggingItem {
100    extern_methods!(
101        #[cfg(feature = "NSPasteboard")]
102        #[unsafe(method(initWithPasteboardWriter:))]
103        #[unsafe(method_family = init)]
104        pub unsafe fn initWithPasteboardWriter(
105            this: Allocated<Self>,
106            pasteboard_writer: &ProtocolObject<dyn NSPasteboardWriting>,
107        ) -> Retained<Self>;
108
109        #[unsafe(method(init))]
110        #[unsafe(method_family = init)]
111        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
112
113        #[unsafe(method(item))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn item(&self) -> Retained<AnyObject>;
116
117        #[unsafe(method(draggingFrame))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn draggingFrame(&self) -> NSRect;
120
121        /// Setter for [`draggingFrame`][Self::draggingFrame].
122        #[unsafe(method(setDraggingFrame:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setDraggingFrame(&self, dragging_frame: NSRect);
125
126        #[cfg(feature = "block2")]
127        #[unsafe(method(imageComponentsProvider))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn imageComponentsProvider(
130            &self,
131        ) -> *mut block2::Block<dyn Fn() -> NonNull<NSArray<NSDraggingImageComponent>>>;
132
133        #[cfg(feature = "block2")]
134        /// Setter for [`imageComponentsProvider`][Self::imageComponentsProvider].
135        #[unsafe(method(setImageComponentsProvider:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setImageComponentsProvider(
138            &self,
139            image_components_provider: Option<
140                &block2::Block<dyn Fn() -> NonNull<NSArray<NSDraggingImageComponent>>>,
141            >,
142        );
143
144        #[unsafe(method(setDraggingFrame:contents:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn setDraggingFrame_contents(&self, frame: NSRect, contents: Option<&AnyObject>);
147
148        #[unsafe(method(imageComponents))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn imageComponents(&self)
151            -> Option<Retained<NSArray<NSDraggingImageComponent>>>;
152    );
153}
154
155/// Methods declared on superclass `NSObject`.
156impl NSDraggingItem {
157    extern_methods!(
158        #[unsafe(method(new))]
159        #[unsafe(method_family = new)]
160        pub unsafe fn new() -> Retained<Self>;
161    );
162}