objc2_ui_kit/generated/
UIPasteboard.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/uikit/uipasteboardname?language=objc)
11// NS_TYPED_EXTENSIBLE_ENUM
12pub type UIPasteboardName = NSString;
13
14extern "C" {
15    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardnamegeneral?language=objc)
16    pub static UIPasteboardNameGeneral: &'static UIPasteboardName;
17}
18
19extern "C" {
20    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardnamefind?language=objc)
21    pub static UIPasteboardNameFind: &'static NSString;
22}
23
24/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpattern?language=objc)
25// NS_TYPED_ENUM
26pub type UIPasteboardDetectionPattern = NSString;
27
28extern "C" {
29    /// NSString value, suitable for implementing "Paste and Go"
30    ///
31    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatternprobableweburl?language=objc)
32    pub static UIPasteboardDetectionPatternProbableWebURL: &'static UIPasteboardDetectionPattern;
33}
34
35extern "C" {
36    /// NSString value, suitable for implementing "Paste and Search"
37    ///
38    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatternprobablewebsearch?language=objc)
39    pub static UIPasteboardDetectionPatternProbableWebSearch: &'static UIPasteboardDetectionPattern;
40}
41
42extern "C" {
43    /// NSNumber value
44    ///
45    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatternnumber?language=objc)
46    pub static UIPasteboardDetectionPatternNumber: &'static UIPasteboardDetectionPattern;
47}
48
49extern "C" {
50    /// Array of DDMatchLink values
51    ///
52    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatternlink?language=objc)
53    pub static UIPasteboardDetectionPatternLink: &'static UIPasteboardDetectionPattern;
54}
55
56extern "C" {
57    /// Array of DDMatchPhoneNumber values
58    ///
59    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatternphonenumber?language=objc)
60    pub static UIPasteboardDetectionPatternPhoneNumber: &'static UIPasteboardDetectionPattern;
61}
62
63extern "C" {
64    /// Array of DDMatchEmailAddress values
65    ///
66    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatternemailaddress?language=objc)
67    pub static UIPasteboardDetectionPatternEmailAddress: &'static UIPasteboardDetectionPattern;
68}
69
70extern "C" {
71    /// Array of DDMatchAddress values
72    ///
73    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatternpostaladdress?language=objc)
74    pub static UIPasteboardDetectionPatternPostalAddress: &'static UIPasteboardDetectionPattern;
75}
76
77extern "C" {
78    /// Array of DDMatchCalendarEvent values
79    ///
80    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatterncalendarevent?language=objc)
81    pub static UIPasteboardDetectionPatternCalendarEvent: &'static UIPasteboardDetectionPattern;
82}
83
84extern "C" {
85    /// Array of DDMatchShipmentTrackingNumber values
86    ///
87    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatternshipmenttrackingnumber?language=objc)
88    pub static UIPasteboardDetectionPatternShipmentTrackingNumber:
89        &'static UIPasteboardDetectionPattern;
90}
91
92extern "C" {
93    /// Array of DDMatchFlightNumber values
94    ///
95    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatternflightnumber?language=objc)
96    pub static UIPasteboardDetectionPatternFlightNumber: &'static UIPasteboardDetectionPattern;
97}
98
99extern "C" {
100    /// Array of DDMatchMoneyAmount values
101    ///
102    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboarddetectionpatternmoneyamount?language=objc)
103    pub static UIPasteboardDetectionPatternMoneyAmount: &'static UIPasteboardDetectionPattern;
104}
105
106/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardoption?language=objc)
107// NS_TYPED_ENUM
108pub type UIPasteboardOption = NSString;
109
110extern "C" {
111    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardoptionexpirationdate?language=objc)
112    pub static UIPasteboardOptionExpirationDate: &'static UIPasteboardOption;
113}
114
115extern "C" {
116    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardoptionlocalonly?language=objc)
117    pub static UIPasteboardOptionLocalOnly: &'static UIPasteboardOption;
118}
119
120extern_class!(
121    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboard?language=objc)
122    #[unsafe(super(NSObject))]
123    #[derive(Debug, PartialEq, Eq, Hash)]
124    pub struct UIPasteboard;
125);
126
127unsafe impl Send for UIPasteboard {}
128
129unsafe impl Sync for UIPasteboard {}
130
131extern_conformance!(
132    unsafe impl NSObjectProtocol for UIPasteboard {}
133);
134
135impl UIPasteboard {
136    extern_methods!(
137        #[unsafe(method(generalPasteboard))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn generalPasteboard() -> Retained<UIPasteboard>;
140
141        #[unsafe(method(pasteboardWithName:create:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn pasteboardWithName_create(
144            pasteboard_name: &UIPasteboardName,
145            create: bool,
146        ) -> Option<Retained<UIPasteboard>>;
147
148        #[unsafe(method(pasteboardWithUniqueName))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn pasteboardWithUniqueName() -> Retained<UIPasteboard>;
151
152        #[unsafe(method(name))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn name(&self) -> Retained<UIPasteboardName>;
155
156        #[unsafe(method(removePasteboardWithName:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn removePasteboardWithName(pasteboard_name: &UIPasteboardName);
159
160        #[unsafe(method(isPersistent))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn isPersistent(&self) -> bool;
163
164        #[deprecated = "Do not set persistence on pasteboards. This property is set automatically."]
165        #[unsafe(method(setPersistent:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn setPersistent(&self, persistent: bool);
168
169        #[unsafe(method(changeCount))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn changeCount(&self) -> NSInteger;
172
173        #[unsafe(method(itemProviders))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn itemProviders(&self) -> Retained<NSArray<NSItemProvider>>;
176
177        /// Setter for [`itemProviders`][Self::itemProviders].
178        #[unsafe(method(setItemProviders:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn setItemProviders(&self, item_providers: &NSArray<NSItemProvider>);
181
182        #[unsafe(method(setItemProviders:localOnly:expirationDate:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn setItemProviders_localOnly_expirationDate(
185            &self,
186            item_providers: &NSArray<NSItemProvider>,
187            local_only: bool,
188            expiration_date: Option<&NSDate>,
189        );
190
191        #[unsafe(method(setObjects:))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn setObjects(
194            &self,
195            objects: &NSArray<ProtocolObject<dyn NSItemProviderWriting>>,
196        );
197
198        #[unsafe(method(setObjects:localOnly:expirationDate:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn setObjects_localOnly_expirationDate(
201            &self,
202            objects: &NSArray<ProtocolObject<dyn NSItemProviderWriting>>,
203            local_only: bool,
204            expiration_date: Option<&NSDate>,
205        );
206
207        #[unsafe(method(pasteboardTypes))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn pasteboardTypes(&self) -> Retained<NSArray<NSString>>;
210
211        #[unsafe(method(containsPasteboardTypes:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn containsPasteboardTypes(&self, pasteboard_types: &NSArray<NSString>) -> bool;
214
215        #[unsafe(method(dataForPasteboardType:))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn dataForPasteboardType(
218            &self,
219            pasteboard_type: &NSString,
220        ) -> Option<Retained<NSData>>;
221
222        #[unsafe(method(valueForPasteboardType:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn valueForPasteboardType(
225            &self,
226            pasteboard_type: &NSString,
227        ) -> Option<Retained<AnyObject>>;
228
229        #[unsafe(method(setValue:forPasteboardType:))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn setValue_forPasteboardType(
232            &self,
233            value: &AnyObject,
234            pasteboard_type: &NSString,
235        );
236
237        #[unsafe(method(setData:forPasteboardType:))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn setData_forPasteboardType(&self, data: &NSData, pasteboard_type: &NSString);
240
241        #[unsafe(method(numberOfItems))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn numberOfItems(&self) -> NSInteger;
244
245        #[unsafe(method(pasteboardTypesForItemSet:))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn pasteboardTypesForItemSet(
248            &self,
249            item_set: Option<&NSIndexSet>,
250        ) -> Option<Retained<NSArray<NSArray<NSString>>>>;
251
252        #[unsafe(method(containsPasteboardTypes:inItemSet:))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn containsPasteboardTypes_inItemSet(
255            &self,
256            pasteboard_types: &NSArray<NSString>,
257            item_set: Option<&NSIndexSet>,
258        ) -> bool;
259
260        #[unsafe(method(itemSetWithPasteboardTypes:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn itemSetWithPasteboardTypes(
263            &self,
264            pasteboard_types: &NSArray<NSString>,
265        ) -> Option<Retained<NSIndexSet>>;
266
267        #[unsafe(method(valuesForPasteboardType:inItemSet:))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn valuesForPasteboardType_inItemSet(
270            &self,
271            pasteboard_type: &NSString,
272            item_set: Option<&NSIndexSet>,
273        ) -> Option<Retained<NSArray>>;
274
275        #[unsafe(method(dataForPasteboardType:inItemSet:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn dataForPasteboardType_inItemSet(
278            &self,
279            pasteboard_type: &NSString,
280            item_set: Option<&NSIndexSet>,
281        ) -> Option<Retained<NSArray<NSData>>>;
282
283        #[unsafe(method(items))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn items(&self) -> Retained<NSArray<NSDictionary<NSString, AnyObject>>>;
286
287        /// Setter for [`items`][Self::items].
288        #[unsafe(method(setItems:))]
289        #[unsafe(method_family = none)]
290        pub unsafe fn setItems(&self, items: &NSArray<NSDictionary<NSString, AnyObject>>);
291
292        #[unsafe(method(addItems:))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn addItems(&self, items: &NSArray<NSDictionary<NSString, AnyObject>>);
295
296        #[unsafe(method(setItems:options:))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn setItems_options(
299            &self,
300            items: &NSArray<NSDictionary<NSString, AnyObject>>,
301            options: &NSDictionary<UIPasteboardOption, AnyObject>,
302        );
303
304        #[unsafe(method(string))]
305        #[unsafe(method_family = none)]
306        pub unsafe fn string(&self) -> Option<Retained<NSString>>;
307
308        /// Setter for [`string`][Self::string].
309        #[unsafe(method(setString:))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn setString(&self, string: Option<&NSString>);
312
313        #[unsafe(method(strings))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn strings(&self) -> Option<Retained<NSArray<NSString>>>;
316
317        /// Setter for [`strings`][Self::strings].
318        #[unsafe(method(setStrings:))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn setStrings(&self, strings: Option<&NSArray<NSString>>);
321
322        #[unsafe(method(URL))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
325
326        /// Setter for [`URL`][Self::URL].
327        #[unsafe(method(setURL:))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn setURL(&self, url: Option<&NSURL>);
330
331        #[unsafe(method(URLs))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn URLs(&self) -> Option<Retained<NSArray<NSURL>>>;
334
335        /// Setter for [`URLs`][Self::URLs].
336        #[unsafe(method(setURLs:))]
337        #[unsafe(method_family = none)]
338        pub unsafe fn setURLs(&self, ur_ls: Option<&NSArray<NSURL>>);
339
340        #[cfg(feature = "UIImage")]
341        #[unsafe(method(image))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
344
345        #[cfg(feature = "UIImage")]
346        /// Setter for [`image`][Self::image].
347        #[unsafe(method(setImage:))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn setImage(&self, image: Option<&UIImage>);
350
351        #[cfg(feature = "UIImage")]
352        #[unsafe(method(images))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn images(&self) -> Option<Retained<NSArray<UIImage>>>;
355
356        #[cfg(feature = "UIImage")]
357        /// Setter for [`images`][Self::images].
358        #[unsafe(method(setImages:))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn setImages(&self, images: Option<&NSArray<UIImage>>);
361
362        #[cfg(feature = "UIColor")]
363        #[unsafe(method(color))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn color(&self) -> Option<Retained<UIColor>>;
366
367        #[cfg(feature = "UIColor")]
368        /// Setter for [`color`][Self::color].
369        #[unsafe(method(setColor:))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn setColor(&self, color: Option<&UIColor>);
372
373        #[cfg(feature = "UIColor")]
374        #[unsafe(method(colors))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn colors(&self) -> Option<Retained<NSArray<UIColor>>>;
377
378        #[cfg(feature = "UIColor")]
379        /// Setter for [`colors`][Self::colors].
380        #[unsafe(method(setColors:))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn setColors(&self, colors: Option<&NSArray<UIColor>>);
383
384        #[unsafe(method(hasStrings))]
385        #[unsafe(method_family = none)]
386        pub unsafe fn hasStrings(&self) -> bool;
387
388        #[unsafe(method(hasURLs))]
389        #[unsafe(method_family = none)]
390        pub unsafe fn hasURLs(&self) -> bool;
391
392        #[unsafe(method(hasImages))]
393        #[unsafe(method_family = none)]
394        pub unsafe fn hasImages(&self) -> bool;
395
396        #[unsafe(method(hasColors))]
397        #[unsafe(method_family = none)]
398        pub unsafe fn hasColors(&self) -> bool;
399
400        #[cfg(feature = "block2")]
401        /// Detects patterns in the first pasteboard item.
402        ///
403        ///
404        /// Parameter `patterns`: Detect only these patterns.
405        ///
406        /// Parameter `completionHandler`: Receives which patterns were detected, or an error.
407        #[unsafe(method(detectPatternsForPatterns:completionHandler:))]
408        #[unsafe(method_family = none)]
409        pub unsafe fn detectPatternsForPatterns_completionHandler(
410            &self,
411            patterns: &NSSet<UIPasteboardDetectionPattern>,
412            completion_handler: &block2::DynBlock<
413                dyn Fn(*mut NSSet<UIPasteboardDetectionPattern>, *mut NSError),
414            >,
415        );
416
417        #[cfg(feature = "block2")]
418        /// Detects patterns in the specified pasteboard items.
419        ///
420        ///
421        /// Parameter `patterns`: Detect only these patterns.
422        ///
423        /// Parameter `itemSet`: Specifies which pasteboard items by their position. Nil means all items.
424        ///
425        /// Parameter `completionHandler`: Receives which patterns were detected per item specified,
426        /// or an error.
427        #[unsafe(method(detectPatternsForPatterns:inItemSet:completionHandler:))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn detectPatternsForPatterns_inItemSet_completionHandler(
430            &self,
431            patterns: &NSSet<UIPasteboardDetectionPattern>,
432            item_set: Option<&NSIndexSet>,
433            completion_handler: &block2::DynBlock<
434                dyn Fn(*mut NSArray<NSSet<UIPasteboardDetectionPattern>>, *mut NSError),
435            >,
436        );
437
438        #[cfg(feature = "block2")]
439        /// Detects patterns and corresponding values in the first pasteboard item.
440        ///
441        ///
442        /// Parameter `patterns`: Detect only these patterns.
443        ///
444        /// Parameter `completionHandler`: Receives which patterns and values were detected, or an error.
445        #[unsafe(method(detectValuesForPatterns:completionHandler:))]
446        #[unsafe(method_family = none)]
447        pub unsafe fn detectValuesForPatterns_completionHandler(
448            &self,
449            patterns: &NSSet<UIPasteboardDetectionPattern>,
450            completion_handler: &block2::DynBlock<
451                dyn Fn(*mut NSDictionary<UIPasteboardDetectionPattern, AnyObject>, *mut NSError),
452            >,
453        );
454
455        #[cfg(feature = "block2")]
456        /// Detects patterns and corresponding values in the specified pasteboard items.
457        ///
458        ///
459        /// Parameter `patterns`: Detect only these patterns.
460        ///
461        /// Parameter `itemSet`: Specifies which pasteboard items by their position. Nil means all items.
462        ///
463        /// Parameter `completionHandler`: Receives which patterns and values were detected per item specified,
464        /// or an error.
465        #[unsafe(method(detectValuesForPatterns:inItemSet:completionHandler:))]
466        #[unsafe(method_family = none)]
467        pub unsafe fn detectValuesForPatterns_inItemSet_completionHandler(
468            &self,
469            patterns: &NSSet<UIPasteboardDetectionPattern>,
470            item_set: Option<&NSIndexSet>,
471            completion_handler: &block2::DynBlock<
472                dyn Fn(
473                    *mut NSArray<NSDictionary<UIPasteboardDetectionPattern, AnyObject>>,
474                    *mut NSError,
475                ),
476            >,
477        );
478    );
479}
480
481/// Methods declared on superclass `NSObject`.
482impl UIPasteboard {
483    extern_methods!(
484        #[unsafe(method(init))]
485        #[unsafe(method_family = init)]
486        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
487
488        #[unsafe(method(new))]
489        #[unsafe(method_family = new)]
490        pub unsafe fn new() -> Retained<Self>;
491    );
492}
493
494extern "C" {
495    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardchangednotification?language=objc)
496    pub static UIPasteboardChangedNotification: &'static NSNotificationName;
497}
498
499extern "C" {
500    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardchangedtypesaddedkey?language=objc)
501    pub static UIPasteboardChangedTypesAddedKey: &'static NSString;
502}
503
504extern "C" {
505    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardchangedtypesremovedkey?language=objc)
506    pub static UIPasteboardChangedTypesRemovedKey: &'static NSString;
507}
508
509extern "C" {
510    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardremovednotification?language=objc)
511    pub static UIPasteboardRemovedNotification: &'static NSNotificationName;
512}
513
514extern "C" {
515    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardtypeliststring?language=objc)
516    pub static UIPasteboardTypeListString: &'static NSArray<NSString>;
517}
518
519extern "C" {
520    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardtypelisturl?language=objc)
521    pub static UIPasteboardTypeListURL: &'static NSArray<NSString>;
522}
523
524extern "C" {
525    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardtypelistimage?language=objc)
526    pub static UIPasteboardTypeListImage: &'static NSArray<NSString>;
527}
528
529extern "C" {
530    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardtypelistcolor?language=objc)
531    pub static UIPasteboardTypeListColor: &'static NSArray<NSString>;
532}
533
534extern "C" {
535    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipasteboardtypeautomatic?language=objc)
536    pub static UIPasteboardTypeAutomatic: &'static NSString;
537}