1use crate::common::*;
4use crate::AppKit::*;
5use crate::CoreData::*;
6use crate::Foundation::*;
7
8ns_options!(
9 #[underlying(NSUInteger)]
10 pub enum NSWorkspaceIconCreationOptions {
11 NSExcludeQuickDrawElementsIconCreationOption = 1 << 1,
12 NSExclude10_4ElementsIconCreationOption = 1 << 2,
13 }
14);
15
16extern_class!(
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 #[cfg(feature = "AppKit_NSWorkspace")]
19 pub struct NSWorkspace;
20
21 #[cfg(feature = "AppKit_NSWorkspace")]
22 unsafe impl ClassType for NSWorkspace {
23 type Super = NSObject;
24 type Mutability = InteriorMutable;
25 }
26);
27
28#[cfg(feature = "AppKit_NSWorkspace")]
29unsafe impl NSObjectProtocol for NSWorkspace {}
30
31extern_methods!(
32 #[cfg(feature = "AppKit_NSWorkspace")]
33 unsafe impl NSWorkspace {
34 #[method_id(@__retain_semantics Other sharedWorkspace)]
35 pub unsafe fn sharedWorkspace() -> Id<NSWorkspace>;
36
37 #[cfg(feature = "Foundation_NSNotificationCenter")]
38 #[method_id(@__retain_semantics Other notificationCenter)]
39 pub unsafe fn notificationCenter(&self) -> Id<NSNotificationCenter>;
40
41 #[cfg(feature = "Foundation_NSURL")]
42 #[method(openURL:)]
43 pub unsafe fn openURL(&self, url: &NSURL) -> bool;
44
45 #[cfg(all(
46 feature = "AppKit_NSRunningApplication",
47 feature = "AppKit_NSWorkspaceOpenConfiguration",
48 feature = "Foundation_NSError",
49 feature = "Foundation_NSURL"
50 ))]
51 #[method(openURL:configuration:completionHandler:)]
52 pub unsafe fn openURL_configuration_completionHandler(
53 &self,
54 url: &NSURL,
55 configuration: &NSWorkspaceOpenConfiguration,
56 completion_handler: Option<&Block<(*mut NSRunningApplication, *mut NSError), ()>>,
57 );
58
59 #[cfg(all(
60 feature = "AppKit_NSRunningApplication",
61 feature = "AppKit_NSWorkspaceOpenConfiguration",
62 feature = "Foundation_NSArray",
63 feature = "Foundation_NSError",
64 feature = "Foundation_NSURL"
65 ))]
66 #[method(openURLs:withApplicationAtURL:configuration:completionHandler:)]
67 pub unsafe fn openURLs_withApplicationAtURL_configuration_completionHandler(
68 &self,
69 urls: &NSArray<NSURL>,
70 application_url: &NSURL,
71 configuration: &NSWorkspaceOpenConfiguration,
72 completion_handler: Option<&Block<(*mut NSRunningApplication, *mut NSError), ()>>,
73 );
74
75 #[cfg(all(
76 feature = "AppKit_NSRunningApplication",
77 feature = "AppKit_NSWorkspaceOpenConfiguration",
78 feature = "Foundation_NSError",
79 feature = "Foundation_NSURL"
80 ))]
81 #[method(openApplicationAtURL:configuration:completionHandler:)]
82 pub unsafe fn openApplicationAtURL_configuration_completionHandler(
83 &self,
84 application_url: &NSURL,
85 configuration: &NSWorkspaceOpenConfiguration,
86 completion_handler: Option<&Block<(*mut NSRunningApplication, *mut NSError), ()>>,
87 );
88
89 #[cfg(feature = "Foundation_NSString")]
90 #[method(selectFile:inFileViewerRootedAtPath:)]
91 pub unsafe fn selectFile_inFileViewerRootedAtPath(
92 &self,
93 full_path: Option<&NSString>,
94 root_full_path: &NSString,
95 ) -> bool;
96
97 #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSURL"))]
98 #[method(activateFileViewerSelectingURLs:)]
99 pub unsafe fn activateFileViewerSelectingURLs(&self, file_ur_ls: &NSArray<NSURL>);
100
101 #[cfg(feature = "Foundation_NSString")]
102 #[method(showSearchResultsForQueryString:)]
103 pub unsafe fn showSearchResultsForQueryString(&self, query_string: &NSString) -> bool;
104
105 #[cfg(feature = "Foundation_NSString")]
106 #[method(noteFileSystemChanged:)]
107 pub unsafe fn noteFileSystemChanged_(&self, path: &NSString);
108
109 #[cfg(feature = "Foundation_NSString")]
110 #[method(isFilePackageAtPath:)]
111 pub unsafe fn isFilePackageAtPath(&self, full_path: &NSString) -> bool;
112
113 #[cfg(all(feature = "AppKit_NSImage", feature = "Foundation_NSString"))]
114 #[method_id(@__retain_semantics Other iconForFile:)]
115 pub unsafe fn iconForFile(&self, full_path: &NSString) -> Id<NSImage>;
116
117 #[cfg(all(
118 feature = "AppKit_NSImage",
119 feature = "Foundation_NSArray",
120 feature = "Foundation_NSString"
121 ))]
122 #[method_id(@__retain_semantics Other iconForFiles:)]
123 pub unsafe fn iconForFiles(&self, full_paths: &NSArray<NSString>) -> Option<Id<NSImage>>;
124
125 #[cfg(all(feature = "AppKit_NSImage", feature = "Foundation_NSString"))]
126 #[method(setIcon:forFile:options:)]
127 pub unsafe fn setIcon_forFile_options(
128 &self,
129 image: Option<&NSImage>,
130 full_path: &NSString,
131 options: NSWorkspaceIconCreationOptions,
132 ) -> bool;
133
134 #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
135 #[method_id(@__retain_semantics Other fileLabels)]
136 pub unsafe fn fileLabels(&self) -> Id<NSArray<NSString>>;
137
138 #[cfg(all(feature = "AppKit_NSColor", feature = "Foundation_NSArray"))]
139 #[method_id(@__retain_semantics Other fileLabelColors)]
140 pub unsafe fn fileLabelColors(&self) -> Id<NSArray<NSColor>>;
141
142 #[cfg(all(
143 feature = "Foundation_NSArray",
144 feature = "Foundation_NSDictionary",
145 feature = "Foundation_NSError",
146 feature = "Foundation_NSURL"
147 ))]
148 #[method(recycleURLs:completionHandler:)]
149 pub unsafe fn recycleURLs_completionHandler(
150 &self,
151 ur_ls: &NSArray<NSURL>,
152 handler: Option<&Block<(NonNull<NSDictionary<NSURL, NSURL>>, *mut NSError), ()>>,
153 );
154
155 #[cfg(all(
156 feature = "Foundation_NSArray",
157 feature = "Foundation_NSDictionary",
158 feature = "Foundation_NSError",
159 feature = "Foundation_NSURL"
160 ))]
161 #[method(duplicateURLs:completionHandler:)]
162 pub unsafe fn duplicateURLs_completionHandler(
163 &self,
164 ur_ls: &NSArray<NSURL>,
165 handler: Option<&Block<(NonNull<NSDictionary<NSURL, NSURL>>, *mut NSError), ()>>,
166 );
167
168 #[cfg(feature = "Foundation_NSString")]
169 #[method(getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description:type:)]
170 pub unsafe fn getFileSystemInfoForPath_isRemovable_isWritable_isUnmountable_description_type(
171 &self,
172 full_path: &NSString,
173 removable_flag: *mut Bool,
174 writable_flag: *mut Bool,
175 unmountable_flag: *mut Bool,
176 description: Option<&mut Option<Id<NSString>>>,
177 file_system_type: Option<&mut Option<Id<NSString>>>,
178 ) -> bool;
179
180 #[cfg(feature = "Foundation_NSString")]
181 #[method(unmountAndEjectDeviceAtPath:)]
182 pub unsafe fn unmountAndEjectDeviceAtPath(&self, path: &NSString) -> bool;
183
184 #[cfg(all(feature = "Foundation_NSError", feature = "Foundation_NSURL"))]
185 #[method(unmountAndEjectDeviceAtURL:error:_)]
186 pub unsafe fn unmountAndEjectDeviceAtURL_error(
187 &self,
188 url: &NSURL,
189 ) -> Result<(), Id<NSError>>;
190
191 #[method(extendPowerOffBy:)]
192 pub unsafe fn extendPowerOffBy(&self, requested: NSInteger) -> NSInteger;
193
194 #[method(hideOtherApplications)]
195 pub unsafe fn hideOtherApplications(&self);
196
197 #[cfg(all(feature = "Foundation_NSString", feature = "Foundation_NSURL"))]
198 #[method_id(@__retain_semantics Other URLForApplicationWithBundleIdentifier:)]
199 pub unsafe fn URLForApplicationWithBundleIdentifier(
200 &self,
201 bundle_identifier: &NSString,
202 ) -> Option<Id<NSURL>>;
203
204 #[cfg(all(
205 feature = "Foundation_NSArray",
206 feature = "Foundation_NSString",
207 feature = "Foundation_NSURL"
208 ))]
209 #[method_id(@__retain_semantics Other URLsForApplicationsWithBundleIdentifier:)]
210 pub unsafe fn URLsForApplicationsWithBundleIdentifier(
211 &self,
212 bundle_identifier: &NSString,
213 ) -> Id<NSArray<NSURL>>;
214
215 #[cfg(feature = "Foundation_NSURL")]
216 #[method_id(@__retain_semantics Other URLForApplicationToOpenURL:)]
217 pub unsafe fn URLForApplicationToOpenURL(&self, url: &NSURL) -> Option<Id<NSURL>>;
218
219 #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSURL"))]
220 #[method_id(@__retain_semantics Other URLsForApplicationsToOpenURL:)]
221 pub unsafe fn URLsForApplicationsToOpenURL(&self, url: &NSURL) -> Id<NSArray<NSURL>>;
222
223 #[cfg(all(feature = "Foundation_NSError", feature = "Foundation_NSURL"))]
224 #[method(setDefaultApplicationAtURL:toOpenContentTypeOfFileAtURL:completionHandler:)]
225 pub unsafe fn setDefaultApplicationAtURL_toOpenContentTypeOfFileAtURL_completionHandler(
226 &self,
227 application_url: &NSURL,
228 url: &NSURL,
229 completion_handler: Option<&Block<(*mut NSError,), ()>>,
230 );
231
232 #[cfg(all(
233 feature = "Foundation_NSError",
234 feature = "Foundation_NSString",
235 feature = "Foundation_NSURL"
236 ))]
237 #[method(setDefaultApplicationAtURL:toOpenURLsWithScheme:completionHandler:)]
238 pub unsafe fn setDefaultApplicationAtURL_toOpenURLsWithScheme_completionHandler(
239 &self,
240 application_url: &NSURL,
241 url_scheme: &NSString,
242 completion_handler: Option<&Block<(*mut NSError,), ()>>,
243 );
244
245 #[cfg(all(feature = "Foundation_NSError", feature = "Foundation_NSURL"))]
246 #[method(setDefaultApplicationAtURL:toOpenFileAtURL:completionHandler:)]
247 pub unsafe fn setDefaultApplicationAtURL_toOpenFileAtURL_completionHandler(
248 &self,
249 application_url: &NSURL,
250 url: &NSURL,
251 completion_handler: Option<&Block<(*mut NSError,), ()>>,
252 );
253
254 #[cfg(feature = "AppKit_NSRunningApplication")]
255 #[method_id(@__retain_semantics Other frontmostApplication)]
256 pub unsafe fn frontmostApplication(&self) -> Option<Id<NSRunningApplication>>;
257
258 #[cfg(feature = "AppKit_NSRunningApplication")]
259 #[method_id(@__retain_semantics Other menuBarOwningApplication)]
260 pub unsafe fn menuBarOwningApplication(&self) -> Option<Id<NSRunningApplication>>;
261 }
262);
263
264extern_methods!(
265 #[cfg(feature = "AppKit_NSWorkspace")]
267 unsafe impl NSWorkspace {
268 #[method_id(@__retain_semantics Init init)]
269 pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
270
271 #[method_id(@__retain_semantics New new)]
272 pub unsafe fn new() -> Id<Self>;
273 }
274);
275
276extern_class!(
277 #[derive(Debug, PartialEq, Eq, Hash)]
278 #[cfg(feature = "AppKit_NSWorkspaceOpenConfiguration")]
279 pub struct NSWorkspaceOpenConfiguration;
280
281 #[cfg(feature = "AppKit_NSWorkspaceOpenConfiguration")]
282 unsafe impl ClassType for NSWorkspaceOpenConfiguration {
283 type Super = NSObject;
284 type Mutability = InteriorMutable;
285 }
286);
287
288#[cfg(feature = "AppKit_NSWorkspaceOpenConfiguration")]
289unsafe impl NSCopying for NSWorkspaceOpenConfiguration {}
290
291#[cfg(feature = "AppKit_NSWorkspaceOpenConfiguration")]
292unsafe impl NSObjectProtocol for NSWorkspaceOpenConfiguration {}
293
294extern_methods!(
295 #[cfg(feature = "AppKit_NSWorkspaceOpenConfiguration")]
296 unsafe impl NSWorkspaceOpenConfiguration {
297 #[method_id(@__retain_semantics Other configuration)]
298 pub unsafe fn configuration() -> Id<Self>;
299
300 #[method(promptsUserIfNeeded)]
301 pub unsafe fn promptsUserIfNeeded(&self) -> bool;
302
303 #[method(setPromptsUserIfNeeded:)]
304 pub unsafe fn setPromptsUserIfNeeded(&self, prompts_user_if_needed: bool);
305
306 #[method(addsToRecentItems)]
307 pub unsafe fn addsToRecentItems(&self) -> bool;
308
309 #[method(setAddsToRecentItems:)]
310 pub unsafe fn setAddsToRecentItems(&self, adds_to_recent_items: bool);
311
312 #[method(activates)]
313 pub unsafe fn activates(&self) -> bool;
314
315 #[method(setActivates:)]
316 pub unsafe fn setActivates(&self, activates: bool);
317
318 #[method(hides)]
319 pub unsafe fn hides(&self) -> bool;
320
321 #[method(setHides:)]
322 pub unsafe fn setHides(&self, hides: bool);
323
324 #[method(hidesOthers)]
325 pub unsafe fn hidesOthers(&self) -> bool;
326
327 #[method(setHidesOthers:)]
328 pub unsafe fn setHidesOthers(&self, hides_others: bool);
329
330 #[method(isForPrinting)]
331 pub unsafe fn isForPrinting(&self) -> bool;
332
333 #[method(setForPrinting:)]
334 pub unsafe fn setForPrinting(&self, for_printing: bool);
335
336 #[method(createsNewApplicationInstance)]
337 pub unsafe fn createsNewApplicationInstance(&self) -> bool;
338
339 #[method(setCreatesNewApplicationInstance:)]
340 pub unsafe fn setCreatesNewApplicationInstance(
341 &self,
342 creates_new_application_instance: bool,
343 );
344
345 #[method(allowsRunningApplicationSubstitution)]
346 pub unsafe fn allowsRunningApplicationSubstitution(&self) -> bool;
347
348 #[method(setAllowsRunningApplicationSubstitution:)]
349 pub unsafe fn setAllowsRunningApplicationSubstitution(
350 &self,
351 allows_running_application_substitution: bool,
352 );
353
354 #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
355 #[method_id(@__retain_semantics Other arguments)]
356 pub unsafe fn arguments(&self) -> Id<NSArray<NSString>>;
357
358 #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
359 #[method(setArguments:)]
360 pub unsafe fn setArguments(&self, arguments: &NSArray<NSString>);
361
362 #[cfg(all(feature = "Foundation_NSDictionary", feature = "Foundation_NSString"))]
363 #[method_id(@__retain_semantics Other environment)]
364 pub unsafe fn environment(&self) -> Id<NSDictionary<NSString, NSString>>;
365
366 #[cfg(all(feature = "Foundation_NSDictionary", feature = "Foundation_NSString"))]
367 #[method(setEnvironment:)]
368 pub unsafe fn setEnvironment(&self, environment: &NSDictionary<NSString, NSString>);
369
370 #[cfg(feature = "Foundation_NSAppleEventDescriptor")]
371 #[method_id(@__retain_semantics Other appleEvent)]
372 pub unsafe fn appleEvent(&self) -> Option<Id<NSAppleEventDescriptor>>;
373
374 #[cfg(feature = "Foundation_NSAppleEventDescriptor")]
375 #[method(setAppleEvent:)]
376 pub unsafe fn setAppleEvent(&self, apple_event: Option<&NSAppleEventDescriptor>);
377
378 #[method(requiresUniversalLinks)]
379 pub unsafe fn requiresUniversalLinks(&self) -> bool;
380
381 #[method(setRequiresUniversalLinks:)]
382 pub unsafe fn setRequiresUniversalLinks(&self, requires_universal_links: bool);
383 }
384);
385
386extern_methods!(
387 #[cfg(feature = "AppKit_NSWorkspaceOpenConfiguration")]
389 unsafe impl NSWorkspaceOpenConfiguration {
390 #[method_id(@__retain_semantics Init init)]
391 pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
392
393 #[method_id(@__retain_semantics New new)]
394 pub unsafe fn new() -> Id<Self>;
395 }
396);
397
398typed_enum!(
399 pub type NSWorkspaceDesktopImageOptionKey = NSString;
400);
401
402extern_static!(NSWorkspaceDesktopImageScalingKey: &'static NSWorkspaceDesktopImageOptionKey);
403
404extern_static!(NSWorkspaceDesktopImageAllowClippingKey: &'static NSWorkspaceDesktopImageOptionKey);
405
406extern_static!(NSWorkspaceDesktopImageFillColorKey: &'static NSWorkspaceDesktopImageOptionKey);
407
408extern_methods!(
409 #[cfg(feature = "AppKit_NSWorkspace")]
411 unsafe impl NSWorkspace {
412 #[cfg(all(
413 feature = "AppKit_NSScreen",
414 feature = "Foundation_NSDictionary",
415 feature = "Foundation_NSError",
416 feature = "Foundation_NSURL"
417 ))]
418 #[method(setDesktopImageURL:forScreen:options:error:_)]
419 pub unsafe fn setDesktopImageURL_forScreen_options_error(
420 &self,
421 url: &NSURL,
422 screen: &NSScreen,
423 options: &NSDictionary<NSWorkspaceDesktopImageOptionKey, AnyObject>,
424 ) -> Result<(), Id<NSError>>;
425
426 #[cfg(all(feature = "AppKit_NSScreen", feature = "Foundation_NSURL"))]
427 #[method_id(@__retain_semantics Other desktopImageURLForScreen:)]
428 pub unsafe fn desktopImageURLForScreen(&self, screen: &NSScreen) -> Option<Id<NSURL>>;
429
430 #[cfg(all(feature = "AppKit_NSScreen", feature = "Foundation_NSDictionary"))]
431 #[method_id(@__retain_semantics Other desktopImageOptionsForScreen:)]
432 pub unsafe fn desktopImageOptionsForScreen(
433 &self,
434 screen: &NSScreen,
435 ) -> Option<Id<NSDictionary<NSWorkspaceDesktopImageOptionKey, AnyObject>>>;
436 }
437);
438
439ns_enum!(
440 #[underlying(NSInteger)]
441 pub enum NSWorkspaceAuthorizationType {
442 NSWorkspaceAuthorizationTypeCreateSymbolicLink = 0,
443 NSWorkspaceAuthorizationTypeSetAttributes = 1,
444 NSWorkspaceAuthorizationTypeReplaceFile = 2,
445 }
446);
447
448extern_class!(
449 #[derive(Debug, PartialEq, Eq, Hash)]
450 #[cfg(feature = "AppKit_NSWorkspaceAuthorization")]
451 pub struct NSWorkspaceAuthorization;
452
453 #[cfg(feature = "AppKit_NSWorkspaceAuthorization")]
454 unsafe impl ClassType for NSWorkspaceAuthorization {
455 type Super = NSObject;
456 type Mutability = InteriorMutable;
457 }
458);
459
460#[cfg(feature = "AppKit_NSWorkspaceAuthorization")]
461unsafe impl NSObjectProtocol for NSWorkspaceAuthorization {}
462
463extern_methods!(
464 #[cfg(feature = "AppKit_NSWorkspaceAuthorization")]
465 unsafe impl NSWorkspaceAuthorization {}
466);
467
468extern_methods!(
469 #[cfg(feature = "AppKit_NSWorkspaceAuthorization")]
471 unsafe impl NSWorkspaceAuthorization {
472 #[method_id(@__retain_semantics Init init)]
473 pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
474
475 #[method_id(@__retain_semantics New new)]
476 pub unsafe fn new() -> Id<Self>;
477 }
478);
479
480extern_methods!(
481 #[cfg(feature = "AppKit_NSWorkspace")]
483 unsafe impl NSWorkspace {
484 #[cfg(all(
485 feature = "AppKit_NSWorkspaceAuthorization",
486 feature = "Foundation_NSError"
487 ))]
488 #[method(requestAuthorizationOfType:completionHandler:)]
489 pub unsafe fn requestAuthorizationOfType_completionHandler(
490 &self,
491 r#type: NSWorkspaceAuthorizationType,
492 completion_handler: &Block<(*mut NSWorkspaceAuthorization, *mut NSError), ()>,
493 );
494 }
495);
496
497extern_methods!(
498 #[cfg(feature = "Foundation_NSFileManager")]
500 unsafe impl NSFileManager {
501 #[cfg(feature = "AppKit_NSWorkspaceAuthorization")]
502 #[method_id(@__retain_semantics Other fileManagerWithAuthorization:)]
503 pub unsafe fn fileManagerWithAuthorization(
504 authorization: &NSWorkspaceAuthorization,
505 ) -> Id<Self>;
506 }
507);
508
509extern_static!(NSWorkspaceApplicationKey: &'static NSString);
510
511extern_static!(NSWorkspaceWillLaunchApplicationNotification: &'static NSNotificationName);
512
513extern_static!(NSWorkspaceDidLaunchApplicationNotification: &'static NSNotificationName);
514
515extern_static!(NSWorkspaceDidTerminateApplicationNotification: &'static NSNotificationName);
516
517extern_static!(NSWorkspaceDidHideApplicationNotification: &'static NSNotificationName);
518
519extern_static!(NSWorkspaceDidUnhideApplicationNotification: &'static NSNotificationName);
520
521extern_static!(NSWorkspaceDidActivateApplicationNotification: &'static NSNotificationName);
522
523extern_static!(NSWorkspaceDidDeactivateApplicationNotification: &'static NSNotificationName);
524
525extern_static!(NSWorkspaceVolumeLocalizedNameKey: &'static NSString);
526
527extern_static!(NSWorkspaceVolumeURLKey: &'static NSString);
528
529extern_static!(NSWorkspaceVolumeOldLocalizedNameKey: &'static NSString);
530
531extern_static!(NSWorkspaceVolumeOldURLKey: &'static NSString);
532
533extern_static!(NSWorkspaceDidMountNotification: &'static NSNotificationName);
534
535extern_static!(NSWorkspaceDidUnmountNotification: &'static NSNotificationName);
536
537extern_static!(NSWorkspaceWillUnmountNotification: &'static NSNotificationName);
538
539extern_static!(NSWorkspaceDidRenameVolumeNotification: &'static NSNotificationName);
540
541extern_static!(NSWorkspaceWillPowerOffNotification: &'static NSNotificationName);
542
543extern_static!(NSWorkspaceWillSleepNotification: &'static NSNotificationName);
544
545extern_static!(NSWorkspaceDidWakeNotification: &'static NSNotificationName);
546
547extern_static!(NSWorkspaceScreensDidSleepNotification: &'static NSNotificationName);
548
549extern_static!(NSWorkspaceScreensDidWakeNotification: &'static NSNotificationName);
550
551extern_static!(NSWorkspaceSessionDidBecomeActiveNotification: &'static NSNotificationName);
552
553extern_static!(NSWorkspaceSessionDidResignActiveNotification: &'static NSNotificationName);
554
555extern_static!(NSWorkspaceDidChangeFileLabelsNotification: &'static NSNotificationName);
556
557extern_static!(NSWorkspaceActiveSpaceDidChangeNotification: &'static NSNotificationName);
558
559typed_enum!(
560 pub type NSWorkspaceFileOperationName = NSString;
561);
562
563ns_options!(
564 #[underlying(NSUInteger)]
565 pub enum NSWorkspaceLaunchOptions {
566 #[deprecated = "Use -[NSWorkspaceOpenConfiguration setForPrinting:YES] instead."]
567 NSWorkspaceLaunchAndPrint = 0x00000002,
568 #[deprecated = "Use -[NSWorkspaceOpenConfiguration setPromptsUserIfNeeded:YES] instead."]
569 NSWorkspaceLaunchWithErrorPresentation = 0x00000040,
570 #[deprecated = "This option does nothing."]
571 NSWorkspaceLaunchInhibitingBackgroundOnly = 0x00000080,
572 #[deprecated = "Use -[NSWorkspaceOpenConfiguration setAddsToRecentItems:YES] instead."]
573 NSWorkspaceLaunchWithoutAddingToRecents = 0x00000100,
574 #[deprecated = "Use -[NSWorkspaceOpenConfiguration setActivates:NO] instead."]
575 NSWorkspaceLaunchWithoutActivation = 0x00000200,
576 #[deprecated = "When using NSWorkspaceOpenConfiguration, all launches are asynchronous."]
577 NSWorkspaceLaunchAsync = 0x00010000,
578 #[deprecated = "Use -[NSWorkspaceOpenConfiguration setCreatesNewApplicationInstance:YES] instead."]
579 NSWorkspaceLaunchNewInstance = 0x00080000,
580 #[deprecated = "Use -[NSWorkspaceOpenConfiguration setHides:YES] instead."]
581 NSWorkspaceLaunchAndHide = 0x00100000,
582 #[deprecated = "Use -[NSWorkspaceOpenConfiguration setHidesOthers:YES] instead."]
583 NSWorkspaceLaunchAndHideOthers = 0x00200000,
584 #[deprecated = "Use NSWorkspaceOpenConfiguration instead."]
585 NSWorkspaceLaunchDefault = NSWorkspaceLaunchAsync,
586 #[deprecated = "The Classic environment is no longer supported."]
587 NSWorkspaceLaunchAllowingClassicStartup = 0x00020000,
588 #[deprecated = "The Classic environment is no longer supported."]
589 NSWorkspaceLaunchPreferringClassic = 0x00040000,
590 }
591);
592
593typed_enum!(
594 pub type NSWorkspaceLaunchConfigurationKey = NSString;
595);
596
597extern_static!(NSWorkspaceLaunchConfigurationAppleEvent: &'static NSWorkspaceLaunchConfigurationKey);
598
599extern_static!(NSWorkspaceLaunchConfigurationArguments: &'static NSWorkspaceLaunchConfigurationKey);
600
601extern_static!(NSWorkspaceLaunchConfigurationEnvironment: &'static NSWorkspaceLaunchConfigurationKey);
602
603extern_static!(NSWorkspaceLaunchConfigurationArchitecture: &'static NSWorkspaceLaunchConfigurationKey);
604
605extern_methods!(
606 #[cfg(feature = "AppKit_NSWorkspace")]
608 unsafe impl NSWorkspace {
609 #[cfg(feature = "Foundation_NSString")]
610 #[deprecated = "Use -[NSWorkspace openURL:] instead."]
611 #[method(openFile:)]
612 pub unsafe fn openFile(&self, full_path: &NSString) -> bool;
613
614 #[cfg(feature = "Foundation_NSString")]
615 #[deprecated = "Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead."]
616 #[method(openFile:withApplication:)]
617 pub unsafe fn openFile_withApplication(
618 &self,
619 full_path: &NSString,
620 app_name: Option<&NSString>,
621 ) -> bool;
622
623 #[cfg(feature = "Foundation_NSString")]
624 #[deprecated = "Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead."]
625 #[method(openFile:withApplication:andDeactivate:)]
626 pub unsafe fn openFile_withApplication_andDeactivate(
627 &self,
628 full_path: &NSString,
629 app_name: Option<&NSString>,
630 flag: bool,
631 ) -> bool;
632
633 #[cfg(feature = "Foundation_NSString")]
634 #[deprecated = "Use -[NSWorkspace openApplicationAtURL:configuration:completionHandler:] instead."]
635 #[method(launchApplication:)]
636 pub unsafe fn launchApplication(&self, app_name: &NSString) -> bool;
637
638 #[cfg(all(
639 feature = "AppKit_NSRunningApplication",
640 feature = "Foundation_NSDictionary",
641 feature = "Foundation_NSError",
642 feature = "Foundation_NSURL"
643 ))]
644 #[deprecated = "Use -[NSWorkspace openApplicationAtURL:configuration:completionHandler:] instead."]
645 #[method_id(@__retain_semantics Other launchApplicationAtURL:options:configuration:error:_)]
646 pub unsafe fn launchApplicationAtURL_options_configuration_error(
647 &self,
648 url: &NSURL,
649 options: NSWorkspaceLaunchOptions,
650 configuration: &NSDictionary<NSWorkspaceLaunchConfigurationKey, AnyObject>,
651 ) -> Result<Id<NSRunningApplication>, Id<NSError>>;
652
653 #[cfg(all(
654 feature = "AppKit_NSRunningApplication",
655 feature = "Foundation_NSDictionary",
656 feature = "Foundation_NSError",
657 feature = "Foundation_NSURL"
658 ))]
659 #[deprecated = "Use -[NSWorkspace openURL:configuration:completionHandler:] instead."]
660 #[method_id(@__retain_semantics Other openURL:options:configuration:error:_)]
661 pub unsafe fn openURL_options_configuration_error(
662 &self,
663 url: &NSURL,
664 options: NSWorkspaceLaunchOptions,
665 configuration: &NSDictionary<NSWorkspaceLaunchConfigurationKey, AnyObject>,
666 ) -> Result<Id<NSRunningApplication>, Id<NSError>>;
667
668 #[cfg(all(
669 feature = "AppKit_NSRunningApplication",
670 feature = "Foundation_NSArray",
671 feature = "Foundation_NSDictionary",
672 feature = "Foundation_NSError",
673 feature = "Foundation_NSURL"
674 ))]
675 #[deprecated = "Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead."]
676 #[method_id(@__retain_semantics Other openURLs:withApplicationAtURL:options:configuration:error:_)]
677 pub unsafe fn openURLs_withApplicationAtURL_options_configuration_error(
678 &self,
679 urls: &NSArray<NSURL>,
680 application_url: &NSURL,
681 options: NSWorkspaceLaunchOptions,
682 configuration: &NSDictionary<NSWorkspaceLaunchConfigurationKey, AnyObject>,
683 ) -> Result<Id<NSRunningApplication>, Id<NSError>>;
684
685 #[cfg(feature = "Foundation_NSString")]
686 #[deprecated = "Use -[NSWorkspace openApplicationAtURL:configuration:completionHandler:] instead."]
687 #[method(launchApplication:showIcon:autolaunch:)]
688 pub unsafe fn launchApplication_showIcon_autolaunch(
689 &self,
690 app_name: &NSString,
691 show_icon: bool,
692 autolaunch: bool,
693 ) -> bool;
694
695 #[cfg(feature = "Foundation_NSString")]
696 #[deprecated = "Use -[NSWorkspace URLForApplicationWithBundleIdentifier:] instead."]
697 #[method_id(@__retain_semantics Other fullPathForApplication:)]
698 pub unsafe fn fullPathForApplication(&self, app_name: &NSString) -> Option<Id<NSString>>;
699
700 #[cfg(feature = "Foundation_NSString")]
701 #[deprecated = "Use -[NSWorkspace URLForApplicationWithBundleIdentifier:] instead."]
702 #[method_id(@__retain_semantics Other absolutePathForAppBundleWithIdentifier:)]
703 pub unsafe fn absolutePathForAppBundleWithIdentifier(
704 &self,
705 bundle_identifier: &NSString,
706 ) -> Option<Id<NSString>>;
707
708 #[cfg(all(
709 feature = "Foundation_NSAppleEventDescriptor",
710 feature = "Foundation_NSNumber",
711 feature = "Foundation_NSString"
712 ))]
713 #[deprecated = "Use -[NSWorkspace openApplicationAtURL:configuration:completionHandler:] instead."]
714 #[method(launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:)]
715 pub unsafe fn launchAppWithBundleIdentifier_options_additionalEventParamDescriptor_launchIdentifier(
716 &self,
717 bundle_identifier: &NSString,
718 options: NSWorkspaceLaunchOptions,
719 descriptor: Option<&NSAppleEventDescriptor>,
720 identifier: Option<&mut Option<Id<NSNumber>>>,
721 ) -> bool;
722
723 #[cfg(all(
724 feature = "Foundation_NSAppleEventDescriptor",
725 feature = "Foundation_NSArray",
726 feature = "Foundation_NSNumber",
727 feature = "Foundation_NSString",
728 feature = "Foundation_NSURL"
729 ))]
730 #[deprecated = "Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead."]
731 #[method(openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:)]
732 pub unsafe fn openURLs_withAppBundleIdentifier_options_additionalEventParamDescriptor_launchIdentifiers(
733 &self,
734 urls: &NSArray<NSURL>,
735 bundle_identifier: Option<&NSString>,
736 options: NSWorkspaceLaunchOptions,
737 descriptor: Option<&NSAppleEventDescriptor>,
738 identifiers: Option<&mut Option<Id<NSArray<NSNumber>>>>,
739 ) -> bool;
740
741 #[cfg(feature = "Foundation_NSString")]
742 #[deprecated]
743 #[method(openTempFile:)]
744 pub unsafe fn openTempFile(&self, full_path: &NSString) -> bool;
745
746 #[deprecated]
747 #[method(findApplications)]
748 pub unsafe fn findApplications(&self);
749
750 #[deprecated]
751 #[method(noteUserDefaultsChanged)]
752 pub unsafe fn noteUserDefaultsChanged(&self);
753
754 #[cfg(feature = "AppKit_NSImage")]
755 #[deprecated]
756 #[method(slideImage:from:to:)]
757 pub unsafe fn slideImage_from_to(
758 &self,
759 image: &NSImage,
760 from_point: NSPoint,
761 to_point: NSPoint,
762 );
763
764 #[deprecated]
765 #[method(checkForRemovableMedia)]
766 pub unsafe fn checkForRemovableMedia(&self);
767
768 #[deprecated]
769 #[method(noteFileSystemChanged)]
770 pub unsafe fn noteFileSystemChanged(&self);
771
772 #[deprecated]
773 #[method(fileSystemChanged)]
774 pub unsafe fn fileSystemChanged(&self) -> bool;
775
776 #[deprecated]
777 #[method(userDefaultsChanged)]
778 pub unsafe fn userDefaultsChanged(&self) -> bool;
779
780 #[cfg(feature = "Foundation_NSArray")]
781 #[deprecated]
782 #[method_id(@__retain_semantics Other mountNewRemovableMedia)]
783 pub unsafe fn mountNewRemovableMedia(&self) -> Option<Id<NSArray>>;
784
785 #[cfg(feature = "Foundation_NSDictionary")]
786 #[deprecated = "Use -[NSWorkspace frontmostApplication] instead."]
787 #[method_id(@__retain_semantics Other activeApplication)]
788 pub unsafe fn activeApplication(&self) -> Option<Id<NSDictionary>>;
789
790 #[cfg(feature = "Foundation_NSArray")]
791 #[deprecated = "Use -[NSFileManager mountedVolumeURLsIncludingResourceValuesForKeys:options:] instead."]
792 #[method_id(@__retain_semantics Other mountedLocalVolumePaths)]
793 pub unsafe fn mountedLocalVolumePaths(&self) -> Option<Id<NSArray>>;
794
795 #[cfg(feature = "Foundation_NSArray")]
796 #[deprecated = "Use -[NSFileManager mountedVolumeURLsIncludingResourceValuesForKeys:options:] instead."]
797 #[method_id(@__retain_semantics Other mountedRemovableMedia)]
798 pub unsafe fn mountedRemovableMedia(&self) -> Option<Id<NSArray>>;
799
800 #[cfg(feature = "Foundation_NSArray")]
801 #[deprecated = "Use -[NSWorkspace runningApplications] instead."]
802 #[method_id(@__retain_semantics Other launchedApplications)]
803 pub unsafe fn launchedApplications(&self) -> Option<Id<NSArray>>;
804
805 #[cfg(all(
806 feature = "AppKit_NSImage",
807 feature = "AppKit_NSView",
808 feature = "Foundation_NSString"
809 ))]
810 #[deprecated = "Use -[NSWorkspace openURL:] instead."]
811 #[method(openFile:fromImage:at:inView:)]
812 pub unsafe fn openFile_fromImage_at_inView(
813 &self,
814 full_path: &NSString,
815 image: Option<&NSImage>,
816 point: NSPoint,
817 view: Option<&NSView>,
818 ) -> bool;
819
820 #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
821 #[deprecated]
822 #[method(performFileOperation:source:destination:files:tag:)]
823 pub unsafe fn performFileOperation_source_destination_files_tag(
824 &self,
825 operation: &NSWorkspaceFileOperationName,
826 source: &NSString,
827 destination: &NSString,
828 files: &NSArray,
829 tag: *mut NSInteger,
830 ) -> bool;
831
832 #[cfg(feature = "Foundation_NSString")]
833 #[deprecated = "Use -[NSWorkspace URLForApplicationToOpenURL:] to get the URL of an application that will open a given item, or -[NSURL getResourceValue:forKey:error:] with NSURLContentTypeKey to get the type of the given item."]
834 #[method(getInfoForFile:application:type:)]
835 pub unsafe fn getInfoForFile_application_type(
836 &self,
837 full_path: &NSString,
838 app_name: Option<&mut Option<Id<NSString>>>,
839 r#type: Option<&mut Option<Id<NSString>>>,
840 ) -> bool;
841
842 #[cfg(all(feature = "AppKit_NSImage", feature = "Foundation_NSString"))]
843 #[deprecated = "Use -[NSWorkspace iconForContentType:] instead."]
844 #[method_id(@__retain_semantics Other iconForFileType:)]
845 pub unsafe fn iconForFileType(&self, file_type: &NSString) -> Id<NSImage>;
846
847 #[cfg(all(feature = "Foundation_NSError", feature = "Foundation_NSString"))]
848 #[deprecated = "Use -[NSURL getResourceValue:forKey:error:] with NSURLContentTypeKey instead."]
849 #[method_id(@__retain_semantics Other typeOfFile:error:_)]
850 pub unsafe fn typeOfFile_error(
851 &self,
852 absolute_file_path: &NSString,
853 ) -> Result<Id<NSString>, Id<NSError>>;
854
855 #[cfg(feature = "Foundation_NSString")]
856 #[deprecated = "Use UTType.localizedDescription instead."]
857 #[method_id(@__retain_semantics Other localizedDescriptionForType:)]
858 pub unsafe fn localizedDescriptionForType(
859 &self,
860 type_name: &NSString,
861 ) -> Option<Id<NSString>>;
862
863 #[cfg(feature = "Foundation_NSString")]
864 #[deprecated = "Use UTType.preferredFilenameExtension instead."]
865 #[method_id(@__retain_semantics Other preferredFilenameExtensionForType:)]
866 pub unsafe fn preferredFilenameExtensionForType(
867 &self,
868 type_name: &NSString,
869 ) -> Option<Id<NSString>>;
870
871 #[cfg(feature = "Foundation_NSString")]
872 #[deprecated = "Use +[UTType typesWithTag:tagClass:conformingToType:] to get a list of candidate types, then check if the input type conforms to any of them."]
873 #[method(filenameExtension:isValidForType:)]
874 pub unsafe fn filenameExtension_isValidForType(
875 &self,
876 filename_extension: &NSString,
877 type_name: &NSString,
878 ) -> bool;
879
880 #[cfg(feature = "Foundation_NSString")]
881 #[deprecated = "Use -[UTType conformsToType:] instead."]
882 #[method(type:conformsToType:)]
883 pub unsafe fn type_conformsToType(
884 &self,
885 first_type_name: &NSString,
886 second_type_name: &NSString,
887 ) -> bool;
888 }
889);
890
891extern_static!(NSWorkspaceMoveOperation: &'static NSWorkspaceFileOperationName);
892
893extern_static!(NSWorkspaceCopyOperation: &'static NSWorkspaceFileOperationName);
894
895extern_static!(NSWorkspaceLinkOperation: &'static NSWorkspaceFileOperationName);
896
897extern_static!(NSWorkspaceCompressOperation: &'static NSWorkspaceFileOperationName);
898
899extern_static!(NSWorkspaceDecompressOperation: &'static NSWorkspaceFileOperationName);
900
901extern_static!(NSWorkspaceEncryptOperation: &'static NSWorkspaceFileOperationName);
902
903extern_static!(NSWorkspaceDecryptOperation: &'static NSWorkspaceFileOperationName);
904
905extern_static!(NSWorkspaceDestroyOperation: &'static NSWorkspaceFileOperationName);
906
907extern_static!(NSWorkspaceRecycleOperation: &'static NSWorkspaceFileOperationName);
908
909extern_static!(NSWorkspaceDuplicateOperation: &'static NSWorkspaceFileOperationName);
910
911extern_static!(NSWorkspaceDidPerformFileOperationNotification: &'static NSNotificationName);
912
913extern_static!(NSPlainFileType: &'static NSString);
914
915extern_static!(NSDirectoryFileType: &'static NSString);
916
917extern_static!(NSApplicationFileType: &'static NSString);
918
919extern_static!(NSFilesystemFileType: &'static NSString);
920
921extern_static!(NSShellCommandFileType: &'static NSString);