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
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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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
481impl 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 pub static UIPasteboardChangedNotification: &'static NSNotificationName;
497}
498
499extern "C" {
500 pub static UIPasteboardChangedTypesAddedKey: &'static NSString;
502}
503
504extern "C" {
505 pub static UIPasteboardChangedTypesRemovedKey: &'static NSString;
507}
508
509extern "C" {
510 pub static UIPasteboardRemovedNotification: &'static NSNotificationName;
512}
513
514extern "C" {
515 pub static UIPasteboardTypeListString: &'static NSArray<NSString>;
517}
518
519extern "C" {
520 pub static UIPasteboardTypeListURL: &'static NSArray<NSString>;
522}
523
524extern "C" {
525 pub static UIPasteboardTypeListImage: &'static NSArray<NSString>;
527}
528
529extern "C" {
530 pub static UIPasteboardTypeListColor: &'static NSArray<NSString>;
532}
533
534extern "C" {
535 pub static UIPasteboardTypeAutomatic: &'static NSString;
537}