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