objc2_ui_kit/generated/
UIPasteboard.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10pub type UIPasteboardName = NSString;
13
14extern "C" {
15 pub static UIPasteboardNameGeneral: &'static UIPasteboardName;
17}
18
19extern "C" {
20 pub static UIPasteboardNameFind: &'static NSString;
22}
23
24pub type UIPasteboardDetectionPattern = NSString;
27
28extern "C" {
29 pub static UIPasteboardDetectionPatternProbableWebURL: &'static UIPasteboardDetectionPattern;
33}
34
35extern "C" {
36 pub static UIPasteboardDetectionPatternProbableWebSearch: &'static UIPasteboardDetectionPattern;
40}
41
42extern "C" {
43 pub static UIPasteboardDetectionPatternNumber: &'static UIPasteboardDetectionPattern;
47}
48
49extern "C" {
50 pub static UIPasteboardDetectionPatternLink: &'static UIPasteboardDetectionPattern;
54}
55
56extern "C" {
57 pub static UIPasteboardDetectionPatternPhoneNumber: &'static UIPasteboardDetectionPattern;
61}
62
63extern "C" {
64 pub static UIPasteboardDetectionPatternEmailAddress: &'static UIPasteboardDetectionPattern;
68}
69
70extern "C" {
71 pub static UIPasteboardDetectionPatternPostalAddress: &'static UIPasteboardDetectionPattern;
75}
76
77extern "C" {
78 pub static UIPasteboardDetectionPatternCalendarEvent: &'static UIPasteboardDetectionPattern;
82}
83
84extern "C" {
85 pub static UIPasteboardDetectionPatternShipmentTrackingNumber:
89 &'static UIPasteboardDetectionPattern;
90}
91
92extern "C" {
93 pub static UIPasteboardDetectionPatternFlightNumber: &'static UIPasteboardDetectionPattern;
97}
98
99extern "C" {
100 pub static UIPasteboardDetectionPatternMoneyAmount: &'static UIPasteboardDetectionPattern;
104}
105
106pub type UIPasteboardOption = NSString;
109
110extern "C" {
111 pub static UIPasteboardOptionExpirationDate: &'static UIPasteboardOption;
113}
114
115extern "C" {
116 pub static UIPasteboardOptionLocalOnly: &'static UIPasteboardOption;
118}
119
120extern_class!(
121 #[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
131unsafe impl NSObjectProtocol for UIPasteboard {}
132
133impl UIPasteboard {
134 extern_methods!(
135 #[unsafe(method(generalPasteboard))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn generalPasteboard() -> Retained<UIPasteboard>;
138
139 #[unsafe(method(pasteboardWithName:create:))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn pasteboardWithName_create(
142 pasteboard_name: &UIPasteboardName,
143 create: bool,
144 ) -> Option<Retained<UIPasteboard>>;
145
146 #[unsafe(method(pasteboardWithUniqueName))]
147 #[unsafe(method_family = none)]
148 pub unsafe fn pasteboardWithUniqueName() -> Retained<UIPasteboard>;
149
150 #[unsafe(method(name))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn name(&self) -> Retained<UIPasteboardName>;
153
154 #[unsafe(method(removePasteboardWithName:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn removePasteboardWithName(pasteboard_name: &UIPasteboardName);
157
158 #[unsafe(method(isPersistent))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn isPersistent(&self) -> bool;
161
162 #[deprecated = "Do not set persistence on pasteboards. This property is set automatically."]
163 #[unsafe(method(setPersistent:))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn setPersistent(&self, persistent: bool);
166
167 #[unsafe(method(changeCount))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn changeCount(&self) -> NSInteger;
170
171 #[unsafe(method(itemProviders))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn itemProviders(&self) -> Retained<NSArray<NSItemProvider>>;
174
175 #[unsafe(method(setItemProviders:))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn setItemProviders(&self, item_providers: &NSArray<NSItemProvider>);
179
180 #[unsafe(method(setItemProviders:localOnly:expirationDate:))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn setItemProviders_localOnly_expirationDate(
183 &self,
184 item_providers: &NSArray<NSItemProvider>,
185 local_only: bool,
186 expiration_date: Option<&NSDate>,
187 );
188
189 #[unsafe(method(setObjects:))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn setObjects(
192 &self,
193 objects: &NSArray<ProtocolObject<dyn NSItemProviderWriting>>,
194 );
195
196 #[unsafe(method(setObjects:localOnly:expirationDate:))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn setObjects_localOnly_expirationDate(
199 &self,
200 objects: &NSArray<ProtocolObject<dyn NSItemProviderWriting>>,
201 local_only: bool,
202 expiration_date: Option<&NSDate>,
203 );
204
205 #[unsafe(method(pasteboardTypes))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn pasteboardTypes(&self) -> Retained<NSArray<NSString>>;
208
209 #[unsafe(method(containsPasteboardTypes:))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn containsPasteboardTypes(&self, pasteboard_types: &NSArray<NSString>) -> bool;
212
213 #[unsafe(method(dataForPasteboardType:))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn dataForPasteboardType(
216 &self,
217 pasteboard_type: &NSString,
218 ) -> Option<Retained<NSData>>;
219
220 #[unsafe(method(valueForPasteboardType:))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn valueForPasteboardType(
223 &self,
224 pasteboard_type: &NSString,
225 ) -> Option<Retained<AnyObject>>;
226
227 #[unsafe(method(setValue:forPasteboardType:))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn setValue_forPasteboardType(
230 &self,
231 value: &AnyObject,
232 pasteboard_type: &NSString,
233 );
234
235 #[unsafe(method(setData:forPasteboardType:))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn setData_forPasteboardType(&self, data: &NSData, pasteboard_type: &NSString);
238
239 #[unsafe(method(numberOfItems))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn numberOfItems(&self) -> NSInteger;
242
243 #[unsafe(method(pasteboardTypesForItemSet:))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn pasteboardTypesForItemSet(
246 &self,
247 item_set: Option<&NSIndexSet>,
248 ) -> Option<Retained<NSArray<NSArray<NSString>>>>;
249
250 #[unsafe(method(containsPasteboardTypes:inItemSet:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn containsPasteboardTypes_inItemSet(
253 &self,
254 pasteboard_types: &NSArray<NSString>,
255 item_set: Option<&NSIndexSet>,
256 ) -> bool;
257
258 #[unsafe(method(itemSetWithPasteboardTypes:))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn itemSetWithPasteboardTypes(
261 &self,
262 pasteboard_types: &NSArray<NSString>,
263 ) -> Option<Retained<NSIndexSet>>;
264
265 #[unsafe(method(valuesForPasteboardType:inItemSet:))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn valuesForPasteboardType_inItemSet(
268 &self,
269 pasteboard_type: &NSString,
270 item_set: Option<&NSIndexSet>,
271 ) -> Option<Retained<NSArray>>;
272
273 #[unsafe(method(dataForPasteboardType:inItemSet:))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn dataForPasteboardType_inItemSet(
276 &self,
277 pasteboard_type: &NSString,
278 item_set: Option<&NSIndexSet>,
279 ) -> Option<Retained<NSArray<NSData>>>;
280
281 #[unsafe(method(items))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn items(&self) -> Retained<NSArray<NSDictionary<NSString, AnyObject>>>;
284
285 #[unsafe(method(setItems:))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn setItems(&self, items: &NSArray<NSDictionary<NSString, AnyObject>>);
289
290 #[unsafe(method(addItems:))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn addItems(&self, items: &NSArray<NSDictionary<NSString, AnyObject>>);
293
294 #[unsafe(method(setItems:options:))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn setItems_options(
297 &self,
298 items: &NSArray<NSDictionary<NSString, AnyObject>>,
299 options: &NSDictionary<UIPasteboardOption, AnyObject>,
300 );
301
302 #[unsafe(method(string))]
303 #[unsafe(method_family = none)]
304 pub unsafe fn string(&self) -> Option<Retained<NSString>>;
305
306 #[unsafe(method(setString:))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn setString(&self, string: Option<&NSString>);
310
311 #[unsafe(method(strings))]
312 #[unsafe(method_family = none)]
313 pub unsafe fn strings(&self) -> Option<Retained<NSArray<NSString>>>;
314
315 #[unsafe(method(setStrings:))]
317 #[unsafe(method_family = none)]
318 pub unsafe fn setStrings(&self, strings: Option<&NSArray<NSString>>);
319
320 #[unsafe(method(URL))]
321 #[unsafe(method_family = none)]
322 pub unsafe fn URL(&self) -> Option<Retained<NSURL>>;
323
324 #[unsafe(method(setURL:))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn setURL(&self, url: Option<&NSURL>);
328
329 #[unsafe(method(URLs))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn URLs(&self) -> Option<Retained<NSArray<NSURL>>>;
332
333 #[unsafe(method(setURLs:))]
335 #[unsafe(method_family = none)]
336 pub unsafe fn setURLs(&self, ur_ls: Option<&NSArray<NSURL>>);
337
338 #[cfg(feature = "UIImage")]
339 #[unsafe(method(image))]
340 #[unsafe(method_family = none)]
341 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
342
343 #[cfg(feature = "UIImage")]
344 #[unsafe(method(setImage:))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn setImage(&self, image: Option<&UIImage>);
348
349 #[cfg(feature = "UIImage")]
350 #[unsafe(method(images))]
351 #[unsafe(method_family = none)]
352 pub unsafe fn images(&self) -> Option<Retained<NSArray<UIImage>>>;
353
354 #[cfg(feature = "UIImage")]
355 #[unsafe(method(setImages:))]
357 #[unsafe(method_family = none)]
358 pub unsafe fn setImages(&self, images: Option<&NSArray<UIImage>>);
359
360 #[cfg(feature = "UIColor")]
361 #[unsafe(method(color))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn color(&self) -> Option<Retained<UIColor>>;
364
365 #[cfg(feature = "UIColor")]
366 #[unsafe(method(setColor:))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn setColor(&self, color: Option<&UIColor>);
370
371 #[cfg(feature = "UIColor")]
372 #[unsafe(method(colors))]
373 #[unsafe(method_family = none)]
374 pub unsafe fn colors(&self) -> Option<Retained<NSArray<UIColor>>>;
375
376 #[cfg(feature = "UIColor")]
377 #[unsafe(method(setColors:))]
379 #[unsafe(method_family = none)]
380 pub unsafe fn setColors(&self, colors: Option<&NSArray<UIColor>>);
381
382 #[unsafe(method(hasStrings))]
383 #[unsafe(method_family = none)]
384 pub unsafe fn hasStrings(&self) -> bool;
385
386 #[unsafe(method(hasURLs))]
387 #[unsafe(method_family = none)]
388 pub unsafe fn hasURLs(&self) -> bool;
389
390 #[unsafe(method(hasImages))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn hasImages(&self) -> bool;
393
394 #[unsafe(method(hasColors))]
395 #[unsafe(method_family = none)]
396 pub unsafe fn hasColors(&self) -> bool;
397
398 #[cfg(feature = "block2")]
399 #[unsafe(method(detectPatternsForPatterns:completionHandler:))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn detectPatternsForPatterns_completionHandler(
408 &self,
409 patterns: &NSSet<UIPasteboardDetectionPattern>,
410 completion_handler: &block2::Block<
411 dyn Fn(*mut NSSet<UIPasteboardDetectionPattern>, *mut NSError),
412 >,
413 );
414
415 #[cfg(feature = "block2")]
416 #[unsafe(method(detectPatternsForPatterns:inItemSet:completionHandler:))]
426 #[unsafe(method_family = none)]
427 pub unsafe fn detectPatternsForPatterns_inItemSet_completionHandler(
428 &self,
429 patterns: &NSSet<UIPasteboardDetectionPattern>,
430 item_set: Option<&NSIndexSet>,
431 completion_handler: &block2::Block<
432 dyn Fn(*mut NSArray<NSSet<UIPasteboardDetectionPattern>>, *mut NSError),
433 >,
434 );
435
436 #[cfg(feature = "block2")]
437 #[unsafe(method(detectValuesForPatterns:completionHandler:))]
444 #[unsafe(method_family = none)]
445 pub unsafe fn detectValuesForPatterns_completionHandler(
446 &self,
447 patterns: &NSSet<UIPasteboardDetectionPattern>,
448 completion_handler: &block2::Block<
449 dyn Fn(*mut NSDictionary<UIPasteboardDetectionPattern, AnyObject>, *mut NSError),
450 >,
451 );
452
453 #[cfg(feature = "block2")]
454 #[unsafe(method(detectValuesForPatterns:inItemSet:completionHandler:))]
464 #[unsafe(method_family = none)]
465 pub unsafe fn detectValuesForPatterns_inItemSet_completionHandler(
466 &self,
467 patterns: &NSSet<UIPasteboardDetectionPattern>,
468 item_set: Option<&NSIndexSet>,
469 completion_handler: &block2::Block<
470 dyn Fn(
471 *mut NSArray<NSDictionary<UIPasteboardDetectionPattern, AnyObject>>,
472 *mut NSError,
473 ),
474 >,
475 );
476 );
477}
478
479impl UIPasteboard {
481 extern_methods!(
482 #[unsafe(method(init))]
483 #[unsafe(method_family = init)]
484 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
485
486 #[unsafe(method(new))]
487 #[unsafe(method_family = new)]
488 pub unsafe fn new() -> Retained<Self>;
489 );
490}
491
492extern "C" {
493 pub static UIPasteboardChangedNotification: &'static NSNotificationName;
495}
496
497extern "C" {
498 pub static UIPasteboardChangedTypesAddedKey: &'static NSString;
500}
501
502extern "C" {
503 pub static UIPasteboardChangedTypesRemovedKey: &'static NSString;
505}
506
507extern "C" {
508 pub static UIPasteboardRemovedNotification: &'static NSNotificationName;
510}
511
512extern "C" {
513 pub static UIPasteboardTypeListString: &'static NSArray<NSString>;
515}
516
517extern "C" {
518 pub static UIPasteboardTypeListURL: &'static NSArray<NSString>;
520}
521
522extern "C" {
523 pub static UIPasteboardTypeListImage: &'static NSArray<NSString>;
525}
526
527extern "C" {
528 pub static UIPasteboardTypeListColor: &'static NSArray<NSString>;
530}
531
532extern "C" {
533 pub static UIPasteboardTypeAutomatic: &'static NSString;
535}