use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-uniform-type-identifiers")]
#[cfg(target_vendor = "apple")]
use objc2_uniform_type_identifiers::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWorkspaceIconCreationOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSWorkspaceIconCreationOptions: NSUInteger {
#[doc(alias = "NSExcludeQuickDrawElementsIconCreationOption")]
const ExcludeQuickDrawElementsIconCreationOption = 1<<1;
#[doc(alias = "NSExclude10_4ElementsIconCreationOption")]
const Exclude10_4ElementsIconCreationOption = 1<<2;
}
}
unsafe impl Encode for NSWorkspaceIconCreationOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSWorkspaceIconCreationOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSWorkspace;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSWorkspace {}
);
impl NSWorkspace {
extern_methods!(
#[unsafe(method(sharedWorkspace))]
#[unsafe(method_family = none)]
pub fn sharedWorkspace() -> Retained<NSWorkspace>;
#[unsafe(method(notificationCenter))]
#[unsafe(method_family = none)]
pub fn notificationCenter(&self) -> Retained<NSNotificationCenter>;
#[unsafe(method(openURL:))]
#[unsafe(method_family = none)]
pub fn openURL(&self, url: &NSURL) -> bool;
#[cfg(all(feature = "NSRunningApplication", feature = "block2"))]
#[unsafe(method(openURL:configuration:completionHandler:))]
#[unsafe(method_family = none)]
pub fn openURL_configuration_completionHandler(
&self,
url: &NSURL,
configuration: &NSWorkspaceOpenConfiguration,
completion_handler: Option<
&block2::DynBlock<dyn Fn(*mut NSRunningApplication, *mut NSError)>,
>,
);
#[cfg(all(feature = "NSRunningApplication", feature = "block2"))]
#[unsafe(method(openURLs:withApplicationAtURL:configuration:completionHandler:))]
#[unsafe(method_family = none)]
pub fn openURLs_withApplicationAtURL_configuration_completionHandler(
&self,
urls: &NSArray<NSURL>,
application_url: &NSURL,
configuration: &NSWorkspaceOpenConfiguration,
completion_handler: Option<
&block2::DynBlock<dyn Fn(*mut NSRunningApplication, *mut NSError)>,
>,
);
#[cfg(all(feature = "NSRunningApplication", feature = "block2"))]
#[unsafe(method(openApplicationAtURL:configuration:completionHandler:))]
#[unsafe(method_family = none)]
pub fn openApplicationAtURL_configuration_completionHandler(
&self,
application_url: &NSURL,
configuration: &NSWorkspaceOpenConfiguration,
completion_handler: Option<
&block2::DynBlock<dyn Fn(*mut NSRunningApplication, *mut NSError)>,
>,
);
#[unsafe(method(selectFile:inFileViewerRootedAtPath:))]
#[unsafe(method_family = none)]
pub fn selectFile_inFileViewerRootedAtPath(
&self,
full_path: Option<&NSString>,
root_full_path: &NSString,
) -> bool;
#[unsafe(method(activateFileViewerSelectingURLs:))]
#[unsafe(method_family = none)]
pub fn activateFileViewerSelectingURLs(&self, file_ur_ls: &NSArray<NSURL>);
#[unsafe(method(showSearchResultsForQueryString:))]
#[unsafe(method_family = none)]
pub fn showSearchResultsForQueryString(&self, query_string: &NSString) -> bool;
#[unsafe(method(noteFileSystemChanged:))]
#[unsafe(method_family = none)]
pub fn noteFileSystemChanged_(&self, path: &NSString);
#[unsafe(method(isFilePackageAtPath:))]
#[unsafe(method_family = none)]
pub fn isFilePackageAtPath(&self, full_path: &NSString) -> bool;
#[cfg(feature = "NSImage")]
#[unsafe(method(iconForFile:))]
#[unsafe(method_family = none)]
pub fn iconForFile(&self, full_path: &NSString) -> Retained<NSImage>;
#[cfg(feature = "NSImage")]
#[unsafe(method(iconForFiles:))]
#[unsafe(method_family = none)]
pub fn iconForFiles(&self, full_paths: &NSArray<NSString>) -> Option<Retained<NSImage>>;
#[cfg(all(feature = "NSImage", feature = "objc2-uniform-type-identifiers"))]
#[cfg(target_vendor = "apple")]
#[unsafe(method(iconForContentType:))]
#[unsafe(method_family = none)]
pub fn iconForContentType(&self, content_type: &UTType) -> Retained<NSImage>;
#[cfg(feature = "NSImage")]
#[unsafe(method(setIcon:forFile:options:))]
#[unsafe(method_family = none)]
pub fn setIcon_forFile_options(
&self,
image: Option<&NSImage>,
full_path: &NSString,
options: NSWorkspaceIconCreationOptions,
) -> bool;
#[unsafe(method(fileLabels))]
#[unsafe(method_family = none)]
pub fn fileLabels(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "NSColor")]
#[unsafe(method(fileLabelColors))]
#[unsafe(method_family = none)]
pub fn fileLabelColors(&self) -> Retained<NSArray<NSColor>>;
#[cfg(feature = "block2")]
#[unsafe(method(recycleURLs:completionHandler:))]
#[unsafe(method_family = none)]
pub fn recycleURLs_completionHandler(
&self,
ur_ls: &NSArray<NSURL>,
handler: Option<
&block2::DynBlock<dyn Fn(NonNull<NSDictionary<NSURL, NSURL>>, *mut NSError)>,
>,
);
#[cfg(feature = "block2")]
#[unsafe(method(duplicateURLs:completionHandler:))]
#[unsafe(method_family = none)]
pub fn duplicateURLs_completionHandler(
&self,
ur_ls: &NSArray<NSURL>,
handler: Option<
&block2::DynBlock<dyn Fn(NonNull<NSDictionary<NSURL, NSURL>>, *mut NSError)>,
>,
);
#[unsafe(method(getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description:type:))]
#[unsafe(method_family = none)]
pub unsafe fn getFileSystemInfoForPath_isRemovable_isWritable_isUnmountable_description_type(
&self,
full_path: &NSString,
removable_flag: *mut Bool,
writable_flag: *mut Bool,
unmountable_flag: *mut Bool,
description: Option<&mut Option<Retained<NSString>>>,
file_system_type: Option<&mut Option<Retained<NSString>>>,
) -> bool;
#[unsafe(method(unmountAndEjectDeviceAtPath:))]
#[unsafe(method_family = none)]
pub fn unmountAndEjectDeviceAtPath(&self, path: &NSString) -> bool;
#[unsafe(method(unmountAndEjectDeviceAtURL:error:_))]
#[unsafe(method_family = none)]
pub fn unmountAndEjectDeviceAtURL_error(
&self,
url: &NSURL,
) -> Result<(), Retained<NSError>>;
#[unsafe(method(extendPowerOffBy:))]
#[unsafe(method_family = none)]
pub fn extendPowerOffBy(&self, requested: NSInteger) -> NSInteger;
#[unsafe(method(hideOtherApplications))]
#[unsafe(method_family = none)]
pub fn hideOtherApplications(&self);
#[unsafe(method(URLForApplicationWithBundleIdentifier:))]
#[unsafe(method_family = none)]
pub fn URLForApplicationWithBundleIdentifier(
&self,
bundle_identifier: &NSString,
) -> Option<Retained<NSURL>>;
#[unsafe(method(URLsForApplicationsWithBundleIdentifier:))]
#[unsafe(method_family = none)]
pub fn URLsForApplicationsWithBundleIdentifier(
&self,
bundle_identifier: &NSString,
) -> Retained<NSArray<NSURL>>;
#[unsafe(method(URLForApplicationToOpenURL:))]
#[unsafe(method_family = none)]
pub fn URLForApplicationToOpenURL(&self, url: &NSURL) -> Option<Retained<NSURL>>;
#[unsafe(method(URLsForApplicationsToOpenURL:))]
#[unsafe(method_family = none)]
pub fn URLsForApplicationsToOpenURL(&self, url: &NSURL) -> Retained<NSArray<NSURL>>;
#[cfg(feature = "block2")]
#[unsafe(method(setDefaultApplicationAtURL:toOpenContentTypeOfFileAtURL:completionHandler:))]
#[unsafe(method_family = none)]
pub fn setDefaultApplicationAtURL_toOpenContentTypeOfFileAtURL_completionHandler(
&self,
application_url: &NSURL,
url: &NSURL,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(feature = "block2")]
#[unsafe(method(setDefaultApplicationAtURL:toOpenURLsWithScheme:completionHandler:))]
#[unsafe(method_family = none)]
pub fn setDefaultApplicationAtURL_toOpenURLsWithScheme_completionHandler(
&self,
application_url: &NSURL,
url_scheme: &NSString,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(feature = "block2")]
#[unsafe(method(setDefaultApplicationAtURL:toOpenFileAtURL:completionHandler:))]
#[unsafe(method_family = none)]
pub fn setDefaultApplicationAtURL_toOpenFileAtURL_completionHandler(
&self,
application_url: &NSURL,
url: &NSURL,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(feature = "objc2-uniform-type-identifiers")]
#[cfg(target_vendor = "apple")]
#[unsafe(method(URLForApplicationToOpenContentType:))]
#[unsafe(method_family = none)]
pub fn URLForApplicationToOpenContentType(
&self,
content_type: &UTType,
) -> Option<Retained<NSURL>>;
#[cfg(feature = "objc2-uniform-type-identifiers")]
#[cfg(target_vendor = "apple")]
#[unsafe(method(URLsForApplicationsToOpenContentType:))]
#[unsafe(method_family = none)]
pub fn URLsForApplicationsToOpenContentType(
&self,
content_type: &UTType,
) -> Retained<NSArray<NSURL>>;
#[cfg(all(feature = "block2", feature = "objc2-uniform-type-identifiers"))]
#[cfg(target_vendor = "apple")]
#[unsafe(method(setDefaultApplicationAtURL:toOpenContentType:completionHandler:))]
#[unsafe(method_family = none)]
pub fn setDefaultApplicationAtURL_toOpenContentType_completionHandler(
&self,
application_url: &NSURL,
content_type: &UTType,
completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(feature = "NSRunningApplication")]
#[unsafe(method(frontmostApplication))]
#[unsafe(method_family = none)]
pub fn frontmostApplication(&self) -> Option<Retained<NSRunningApplication>>;
#[cfg(feature = "NSRunningApplication")]
#[unsafe(method(menuBarOwningApplication))]
#[unsafe(method_family = none)]
pub fn menuBarOwningApplication(&self) -> Option<Retained<NSRunningApplication>>;
);
}
impl NSWorkspace {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSWorkspace {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSWorkspaceOpenConfiguration;
);
extern_conformance!(
unsafe impl NSCopying for NSWorkspaceOpenConfiguration {}
);
unsafe impl CopyingHelper for NSWorkspaceOpenConfiguration {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSWorkspaceOpenConfiguration {}
);
impl NSWorkspaceOpenConfiguration {
extern_methods!(
#[unsafe(method(configuration))]
#[unsafe(method_family = none)]
pub fn configuration() -> Retained<Self>;
#[unsafe(method(promptsUserIfNeeded))]
#[unsafe(method_family = none)]
pub fn promptsUserIfNeeded(&self) -> bool;
#[unsafe(method(setPromptsUserIfNeeded:))]
#[unsafe(method_family = none)]
pub fn setPromptsUserIfNeeded(&self, prompts_user_if_needed: bool);
#[unsafe(method(addsToRecentItems))]
#[unsafe(method_family = none)]
pub fn addsToRecentItems(&self) -> bool;
#[unsafe(method(setAddsToRecentItems:))]
#[unsafe(method_family = none)]
pub fn setAddsToRecentItems(&self, adds_to_recent_items: bool);
#[unsafe(method(activates))]
#[unsafe(method_family = none)]
pub fn activates(&self) -> bool;
#[unsafe(method(setActivates:))]
#[unsafe(method_family = none)]
pub fn setActivates(&self, activates: bool);
#[unsafe(method(hides))]
#[unsafe(method_family = none)]
pub fn hides(&self) -> bool;
#[unsafe(method(setHides:))]
#[unsafe(method_family = none)]
pub fn setHides(&self, hides: bool);
#[unsafe(method(hidesOthers))]
#[unsafe(method_family = none)]
pub fn hidesOthers(&self) -> bool;
#[unsafe(method(setHidesOthers:))]
#[unsafe(method_family = none)]
pub fn setHidesOthers(&self, hides_others: bool);
#[unsafe(method(isForPrinting))]
#[unsafe(method_family = none)]
pub fn isForPrinting(&self) -> bool;
#[unsafe(method(setForPrinting:))]
#[unsafe(method_family = none)]
pub fn setForPrinting(&self, for_printing: bool);
#[unsafe(method(createsNewApplicationInstance))]
#[unsafe(method_family = none)]
pub fn createsNewApplicationInstance(&self) -> bool;
#[unsafe(method(setCreatesNewApplicationInstance:))]
#[unsafe(method_family = none)]
pub fn setCreatesNewApplicationInstance(&self, creates_new_application_instance: bool);
#[unsafe(method(allowsRunningApplicationSubstitution))]
#[unsafe(method_family = none)]
pub fn allowsRunningApplicationSubstitution(&self) -> bool;
#[unsafe(method(setAllowsRunningApplicationSubstitution:))]
#[unsafe(method_family = none)]
pub fn setAllowsRunningApplicationSubstitution(
&self,
allows_running_application_substitution: bool,
);
#[unsafe(method(arguments))]
#[unsafe(method_family = none)]
pub fn arguments(&self) -> Retained<NSArray<NSString>>;
#[unsafe(method(setArguments:))]
#[unsafe(method_family = none)]
pub fn setArguments(&self, arguments: &NSArray<NSString>);
#[unsafe(method(environment))]
#[unsafe(method_family = none)]
pub fn environment(&self) -> Retained<NSDictionary<NSString, NSString>>;
#[unsafe(method(setEnvironment:))]
#[unsafe(method_family = none)]
pub fn setEnvironment(&self, environment: &NSDictionary<NSString, NSString>);
#[unsafe(method(appleEvent))]
#[unsafe(method_family = none)]
pub fn appleEvent(&self) -> Option<Retained<NSAppleEventDescriptor>>;
#[unsafe(method(setAppleEvent:))]
#[unsafe(method_family = none)]
pub fn setAppleEvent(&self, apple_event: Option<&NSAppleEventDescriptor>);
#[unsafe(method(requiresUniversalLinks))]
#[unsafe(method_family = none)]
pub fn requiresUniversalLinks(&self) -> bool;
#[unsafe(method(setRequiresUniversalLinks:))]
#[unsafe(method_family = none)]
pub fn setRequiresUniversalLinks(&self, requires_universal_links: bool);
);
}
impl NSWorkspaceOpenConfiguration {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSWorkspaceOpenConfiguration {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
pub type NSWorkspaceDesktopImageOptionKey = NSString;
extern "C" {
pub static NSWorkspaceDesktopImageScalingKey: &'static NSWorkspaceDesktopImageOptionKey;
}
extern "C" {
pub static NSWorkspaceDesktopImageAllowClippingKey: &'static NSWorkspaceDesktopImageOptionKey;
}
extern "C" {
pub static NSWorkspaceDesktopImageFillColorKey: &'static NSWorkspaceDesktopImageOptionKey;
}
impl NSWorkspace {
extern_methods!(
#[cfg(feature = "NSScreen")]
#[unsafe(method(setDesktopImageURL:forScreen:options:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn setDesktopImageURL_forScreen_options_error(
&self,
url: &NSURL,
screen: &NSScreen,
options: &NSDictionary<NSWorkspaceDesktopImageOptionKey, AnyObject>,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "NSScreen")]
#[unsafe(method(desktopImageURLForScreen:))]
#[unsafe(method_family = none)]
pub fn desktopImageURLForScreen(&self, screen: &NSScreen) -> Option<Retained<NSURL>>;
#[cfg(feature = "NSScreen")]
#[unsafe(method(desktopImageOptionsForScreen:))]
#[unsafe(method_family = none)]
pub fn desktopImageOptionsForScreen(
&self,
screen: &NSScreen,
) -> Option<Retained<NSDictionary<NSWorkspaceDesktopImageOptionKey, AnyObject>>>;
);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWorkspaceAuthorizationType(pub NSInteger);
impl NSWorkspaceAuthorizationType {
#[doc(alias = "NSWorkspaceAuthorizationTypeCreateSymbolicLink")]
pub const CreateSymbolicLink: Self = Self(0);
#[doc(alias = "NSWorkspaceAuthorizationTypeSetAttributes")]
pub const SetAttributes: Self = Self(1);
#[doc(alias = "NSWorkspaceAuthorizationTypeReplaceFile")]
pub const ReplaceFile: Self = Self(2);
}
unsafe impl Encode for NSWorkspaceAuthorizationType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSWorkspaceAuthorizationType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSWorkspaceAuthorization;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSWorkspaceAuthorization {}
);
impl NSWorkspaceAuthorization {
extern_methods!();
}
impl NSWorkspaceAuthorization {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSWorkspaceAuthorization {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
impl NSWorkspace {
extern_methods!(
#[cfg(feature = "block2")]
#[unsafe(method(requestAuthorizationOfType:completionHandler:))]
#[unsafe(method_family = none)]
pub fn requestAuthorizationOfType_completionHandler(
&self,
r#type: NSWorkspaceAuthorizationType,
completion_handler: &block2::DynBlock<
dyn Fn(*mut NSWorkspaceAuthorization, *mut NSError),
>,
);
);
}
mod private_NSFileManagerNSWorkspaceAuthorization {
pub trait Sealed {}
}
#[doc(alias = "NSWorkspaceAuthorization")]
pub unsafe trait NSFileManagerNSWorkspaceAuthorization:
ClassType + Sized + private_NSFileManagerNSWorkspaceAuthorization::Sealed
{
extern_methods!(
#[unsafe(method(fileManagerWithAuthorization:))]
#[unsafe(method_family = none)]
fn fileManagerWithAuthorization(authorization: &NSWorkspaceAuthorization)
-> Retained<Self>;
);
}
impl private_NSFileManagerNSWorkspaceAuthorization::Sealed for NSFileManager {}
unsafe impl NSFileManagerNSWorkspaceAuthorization for NSFileManager {}
extern "C" {
pub static NSWorkspaceApplicationKey: &'static NSString;
}
extern "C" {
pub static NSWorkspaceWillLaunchApplicationNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceDidLaunchApplicationNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceDidTerminateApplicationNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceDidHideApplicationNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceDidUnhideApplicationNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceDidActivateApplicationNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceDidDeactivateApplicationNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceVolumeLocalizedNameKey: &'static NSString;
}
extern "C" {
pub static NSWorkspaceVolumeURLKey: &'static NSString;
}
extern "C" {
pub static NSWorkspaceVolumeOldLocalizedNameKey: &'static NSString;
}
extern "C" {
pub static NSWorkspaceVolumeOldURLKey: &'static NSString;
}
extern "C" {
pub static NSWorkspaceDidMountNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceDidUnmountNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceWillUnmountNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceDidRenameVolumeNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceWillPowerOffNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceWillSleepNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceDidWakeNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceScreensDidSleepNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceScreensDidWakeNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceSessionDidBecomeActiveNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceSessionDidResignActiveNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceDidChangeFileLabelsNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSWorkspaceActiveSpaceDidChangeNotification: &'static NSNotificationName;
}
#[deprecated]
pub type NSWorkspaceFileOperationName = NSString;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWorkspaceLaunchOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSWorkspaceLaunchOptions: NSUInteger {
#[doc(alias = "NSWorkspaceLaunchAndPrint")]
#[deprecated = "Use -[NSWorkspaceOpenConfiguration setForPrinting:YES] instead."]
const AndPrint = 0x00000002;
#[doc(alias = "NSWorkspaceLaunchWithErrorPresentation")]
#[deprecated = "Use -[NSWorkspaceOpenConfiguration setPromptsUserIfNeeded:YES] instead."]
const WithErrorPresentation = 0x00000040;
#[doc(alias = "NSWorkspaceLaunchInhibitingBackgroundOnly")]
#[deprecated = "This option does nothing."]
const InhibitingBackgroundOnly = 0x00000080;
#[doc(alias = "NSWorkspaceLaunchWithoutAddingToRecents")]
#[deprecated = "Use -[NSWorkspaceOpenConfiguration setAddsToRecentItems:YES] instead."]
const WithoutAddingToRecents = 0x00000100;
#[doc(alias = "NSWorkspaceLaunchWithoutActivation")]
#[deprecated = "Use -[NSWorkspaceOpenConfiguration setActivates:NO] instead."]
const WithoutActivation = 0x00000200;
#[doc(alias = "NSWorkspaceLaunchAsync")]
#[deprecated = "When using NSWorkspaceOpenConfiguration, all launches are asynchronous."]
const Async = 0x00010000;
#[doc(alias = "NSWorkspaceLaunchNewInstance")]
#[deprecated = "Use -[NSWorkspaceOpenConfiguration setCreatesNewApplicationInstance:YES] instead."]
const NewInstance = 0x00080000;
#[doc(alias = "NSWorkspaceLaunchAndHide")]
#[deprecated = "Use -[NSWorkspaceOpenConfiguration setHides:YES] instead."]
const AndHide = 0x00100000;
#[doc(alias = "NSWorkspaceLaunchAndHideOthers")]
#[deprecated = "Use -[NSWorkspaceOpenConfiguration setHidesOthers:YES] instead."]
const AndHideOthers = 0x00200000;
#[doc(alias = "NSWorkspaceLaunchDefault")]
#[deprecated = "Use NSWorkspaceOpenConfiguration instead."]
const Default = NSWorkspaceLaunchOptions::Async.0;
#[doc(alias = "NSWorkspaceLaunchAllowingClassicStartup")]
#[deprecated = "The Classic environment is no longer supported."]
const AllowingClassicStartup = 0x00020000;
#[doc(alias = "NSWorkspaceLaunchPreferringClassic")]
#[deprecated = "The Classic environment is no longer supported."]
const PreferringClassic = 0x00040000;
}
}
unsafe impl Encode for NSWorkspaceLaunchOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSWorkspaceLaunchOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[deprecated = "Use NSWorkspaceOpenConfiguration instead."]
pub type NSWorkspaceLaunchConfigurationKey = NSString;
extern "C" {
#[deprecated = "Use -[NSWorkspaceOpenConfiguration setAppleEvent:] instead."]
pub static NSWorkspaceLaunchConfigurationAppleEvent: &'static NSWorkspaceLaunchConfigurationKey;
}
extern "C" {
#[deprecated = "Use -[NSWorkspaceOpenConfiguration setArguments:] instead."]
pub static NSWorkspaceLaunchConfigurationArguments: &'static NSWorkspaceLaunchConfigurationKey;
}
extern "C" {
#[deprecated = "Use -[NSWorkspaceOpenConfiguration setEnvironment:] instead."]
pub static NSWorkspaceLaunchConfigurationEnvironment:
&'static NSWorkspaceLaunchConfigurationKey;
}
extern "C" {
#[deprecated = "Do not specify an architecutre. When unspecified, the architecture for a new application instance will be determined based on the available architectures in its executable."]
pub static NSWorkspaceLaunchConfigurationArchitecture:
&'static NSWorkspaceLaunchConfigurationKey;
}
impl NSWorkspace {
extern_methods!(
#[deprecated = "Use -[NSWorkspace openURL:] instead."]
#[unsafe(method(openFile:))]
#[unsafe(method_family = none)]
pub fn openFile(&self, full_path: &NSString) -> bool;
#[deprecated = "Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead."]
#[unsafe(method(openFile:withApplication:))]
#[unsafe(method_family = none)]
pub fn openFile_withApplication(
&self,
full_path: &NSString,
app_name: Option<&NSString>,
) -> bool;
#[deprecated = "Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead."]
#[unsafe(method(openFile:withApplication:andDeactivate:))]
#[unsafe(method_family = none)]
pub fn openFile_withApplication_andDeactivate(
&self,
full_path: &NSString,
app_name: Option<&NSString>,
flag: bool,
) -> bool;
#[deprecated = "Use -[NSWorkspace openApplicationAtURL:configuration:completionHandler:] instead."]
#[unsafe(method(launchApplication:))]
#[unsafe(method_family = none)]
pub fn launchApplication(&self, app_name: &NSString) -> bool;
#[cfg(feature = "NSRunningApplication")]
#[deprecated = "Use -[NSWorkspace openApplicationAtURL:configuration:completionHandler:] instead."]
#[unsafe(method(launchApplicationAtURL:options:configuration:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn launchApplicationAtURL_options_configuration_error(
&self,
url: &NSURL,
options: NSWorkspaceLaunchOptions,
configuration: &NSDictionary<NSWorkspaceLaunchConfigurationKey, AnyObject>,
) -> Result<Retained<NSRunningApplication>, Retained<NSError>>;
#[cfg(feature = "NSRunningApplication")]
#[deprecated = "Use -[NSWorkspace openURL:configuration:completionHandler:] instead."]
#[unsafe(method(openURL:options:configuration:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn openURL_options_configuration_error(
&self,
url: &NSURL,
options: NSWorkspaceLaunchOptions,
configuration: &NSDictionary<NSWorkspaceLaunchConfigurationKey, AnyObject>,
) -> Result<Retained<NSRunningApplication>, Retained<NSError>>;
#[cfg(feature = "NSRunningApplication")]
#[deprecated = "Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead."]
#[unsafe(method(openURLs:withApplicationAtURL:options:configuration:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn openURLs_withApplicationAtURL_options_configuration_error(
&self,
urls: &NSArray<NSURL>,
application_url: &NSURL,
options: NSWorkspaceLaunchOptions,
configuration: &NSDictionary<NSWorkspaceLaunchConfigurationKey, AnyObject>,
) -> Result<Retained<NSRunningApplication>, Retained<NSError>>;
#[deprecated = "Use -[NSWorkspace openApplicationAtURL:configuration:completionHandler:] instead."]
#[unsafe(method(launchApplication:showIcon:autolaunch:))]
#[unsafe(method_family = none)]
pub fn launchApplication_showIcon_autolaunch(
&self,
app_name: &NSString,
show_icon: bool,
autolaunch: bool,
) -> bool;
#[deprecated = "Use -[NSWorkspace URLForApplicationWithBundleIdentifier:] instead."]
#[unsafe(method(fullPathForApplication:))]
#[unsafe(method_family = none)]
pub fn fullPathForApplication(&self, app_name: &NSString) -> Option<Retained<NSString>>;
#[deprecated = "Use -[NSWorkspace URLForApplicationWithBundleIdentifier:] instead."]
#[unsafe(method(absolutePathForAppBundleWithIdentifier:))]
#[unsafe(method_family = none)]
pub fn absolutePathForAppBundleWithIdentifier(
&self,
bundle_identifier: &NSString,
) -> Option<Retained<NSString>>;
#[deprecated = "Use -[NSWorkspace openApplicationAtURL:configuration:completionHandler:] instead."]
#[unsafe(method(launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:))]
#[unsafe(method_family = none)]
pub fn launchAppWithBundleIdentifier_options_additionalEventParamDescriptor_launchIdentifier(
&self,
bundle_identifier: &NSString,
options: NSWorkspaceLaunchOptions,
descriptor: Option<&NSAppleEventDescriptor>,
identifier: Option<&mut Option<Retained<NSNumber>>>,
) -> bool;
#[deprecated = "Use -[NSWorkspace openURLs:withApplicationAtURL:configuration:completionHandler:] instead."]
#[unsafe(method(openURLs:withAppBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifiers:))]
#[unsafe(method_family = none)]
pub fn openURLs_withAppBundleIdentifier_options_additionalEventParamDescriptor_launchIdentifiers(
&self,
urls: &NSArray<NSURL>,
bundle_identifier: Option<&NSString>,
options: NSWorkspaceLaunchOptions,
descriptor: Option<&NSAppleEventDescriptor>,
identifiers: Option<&mut Option<Retained<NSArray<NSNumber>>>>,
) -> bool;
#[deprecated]
#[unsafe(method(openTempFile:))]
#[unsafe(method_family = none)]
pub fn openTempFile(&self, full_path: &NSString) -> bool;
#[deprecated]
#[unsafe(method(findApplications))]
#[unsafe(method_family = none)]
pub fn findApplications(&self);
#[deprecated]
#[unsafe(method(noteUserDefaultsChanged))]
#[unsafe(method_family = none)]
pub fn noteUserDefaultsChanged(&self);
#[cfg(feature = "NSImage")]
#[deprecated]
#[unsafe(method(slideImage:from:to:))]
#[unsafe(method_family = none)]
pub fn slideImage_from_to(&self, image: &NSImage, from_point: NSPoint, to_point: NSPoint);
#[deprecated]
#[unsafe(method(checkForRemovableMedia))]
#[unsafe(method_family = none)]
pub fn checkForRemovableMedia(&self);
#[deprecated]
#[unsafe(method(noteFileSystemChanged))]
#[unsafe(method_family = none)]
pub fn noteFileSystemChanged(&self);
#[deprecated]
#[unsafe(method(fileSystemChanged))]
#[unsafe(method_family = none)]
pub fn fileSystemChanged(&self) -> bool;
#[deprecated]
#[unsafe(method(userDefaultsChanged))]
#[unsafe(method_family = none)]
pub fn userDefaultsChanged(&self) -> bool;
#[deprecated]
#[unsafe(method(mountNewRemovableMedia))]
#[unsafe(method_family = none)]
pub fn mountNewRemovableMedia(&self) -> Option<Retained<NSArray>>;
#[deprecated = "Use -[NSWorkspace frontmostApplication] instead."]
#[unsafe(method(activeApplication))]
#[unsafe(method_family = none)]
pub fn activeApplication(&self) -> Option<Retained<NSDictionary>>;
#[deprecated = "Use -[NSFileManager mountedVolumeURLsIncludingResourceValuesForKeys:options:] instead."]
#[unsafe(method(mountedLocalVolumePaths))]
#[unsafe(method_family = none)]
pub fn mountedLocalVolumePaths(&self) -> Option<Retained<NSArray>>;
#[deprecated = "Use -[NSFileManager mountedVolumeURLsIncludingResourceValuesForKeys:options:] instead."]
#[unsafe(method(mountedRemovableMedia))]
#[unsafe(method_family = none)]
pub fn mountedRemovableMedia(&self) -> Option<Retained<NSArray>>;
#[deprecated = "Use -[NSWorkspace runningApplications] instead."]
#[unsafe(method(launchedApplications))]
#[unsafe(method_family = none)]
pub fn launchedApplications(&self) -> Option<Retained<NSArray>>;
#[cfg(all(feature = "NSImage", feature = "NSResponder", feature = "NSView"))]
#[deprecated = "Use -[NSWorkspace openURL:] instead."]
#[unsafe(method(openFile:fromImage:at:inView:))]
#[unsafe(method_family = none)]
pub fn openFile_fromImage_at_inView(
&self,
full_path: &NSString,
image: Option<&NSImage>,
point: NSPoint,
view: Option<&NSView>,
) -> bool;
#[deprecated]
#[unsafe(method(performFileOperation:source:destination:files:tag:))]
#[unsafe(method_family = none)]
pub unsafe fn performFileOperation_source_destination_files_tag(
&self,
operation: &NSWorkspaceFileOperationName,
source: &NSString,
destination: &NSString,
files: &NSArray,
tag: *mut NSInteger,
) -> bool;
#[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."]
#[unsafe(method(getInfoForFile:application:type:))]
#[unsafe(method_family = none)]
pub fn getInfoForFile_application_type(
&self,
full_path: &NSString,
app_name: Option<&mut Option<Retained<NSString>>>,
r#type: Option<&mut Option<Retained<NSString>>>,
) -> bool;
#[cfg(feature = "NSImage")]
#[deprecated = "Use -[NSWorkspace iconForContentType:] instead."]
#[unsafe(method(iconForFileType:))]
#[unsafe(method_family = none)]
pub fn iconForFileType(&self, file_type: &NSString) -> Retained<NSImage>;
#[deprecated = "Use -[NSURL getResourceValue:forKey:error:] with NSURLContentTypeKey instead."]
#[unsafe(method(typeOfFile:error:_))]
#[unsafe(method_family = none)]
pub fn typeOfFile_error(
&self,
absolute_file_path: &NSString,
) -> Result<Retained<NSString>, Retained<NSError>>;
#[deprecated = "Use UTType.localizedDescription instead."]
#[unsafe(method(localizedDescriptionForType:))]
#[unsafe(method_family = none)]
pub fn localizedDescriptionForType(
&self,
type_name: &NSString,
) -> Option<Retained<NSString>>;
#[deprecated = "Use UTType.preferredFilenameExtension instead."]
#[unsafe(method(preferredFilenameExtensionForType:))]
#[unsafe(method_family = none)]
pub fn preferredFilenameExtensionForType(
&self,
type_name: &NSString,
) -> Option<Retained<NSString>>;
#[deprecated = "Use +[UTType typesWithTag:tagClass:conformingToType:] to get a list of candidate types, then check if the input type conforms to any of them."]
#[unsafe(method(filenameExtension:isValidForType:))]
#[unsafe(method_family = none)]
pub fn filenameExtension_isValidForType(
&self,
filename_extension: &NSString,
type_name: &NSString,
) -> bool;
#[deprecated = "Use -[UTType conformsToType:] instead."]
#[unsafe(method(type:conformsToType:))]
#[unsafe(method_family = none)]
pub fn type_conformsToType(
&self,
first_type_name: &NSString,
second_type_name: &NSString,
) -> bool;
);
}
extern "C" {
#[deprecated = "Use -[NSFileManager moveItemAtURL:toURL:error:] instead."]
pub static NSWorkspaceMoveOperation: &'static NSWorkspaceFileOperationName;
}
extern "C" {
#[deprecated = "Use -[NSFileManager copyItemAtURL:toURL:error:] instead."]
pub static NSWorkspaceCopyOperation: &'static NSWorkspaceFileOperationName;
}
extern "C" {
#[deprecated = "Use -[NSFileManager linkItemAtURL:toURL:error:] instead."]
pub static NSWorkspaceLinkOperation: &'static NSWorkspaceFileOperationName;
}
extern "C" {
#[deprecated = "This operation is unimplemented."]
pub static NSWorkspaceCompressOperation: &'static NSWorkspaceFileOperationName;
}
extern "C" {
#[deprecated = "This operation is unimplemented."]
pub static NSWorkspaceDecompressOperation: &'static NSWorkspaceFileOperationName;
}
extern "C" {
#[deprecated = "This operation is unimplemented."]
pub static NSWorkspaceEncryptOperation: &'static NSWorkspaceFileOperationName;
}
extern "C" {
#[deprecated = "This operation is unimplemented."]
pub static NSWorkspaceDecryptOperation: &'static NSWorkspaceFileOperationName;
}
extern "C" {
#[deprecated = "Use -[NSFileManager removeItemAtURL:error:] instead."]
pub static NSWorkspaceDestroyOperation: &'static NSWorkspaceFileOperationName;
}
extern "C" {
#[deprecated = "Use -[NSWorkspace recycleURLs:completionHandler:] instead."]
pub static NSWorkspaceRecycleOperation: &'static NSWorkspaceFileOperationName;
}
extern "C" {
#[deprecated = "Use -[NSWorkspace duplicateURLs:completionHandler:] instead."]
pub static NSWorkspaceDuplicateOperation: &'static NSWorkspaceFileOperationName;
}
extern "C" {
#[deprecated]
pub static NSWorkspaceDidPerformFileOperationNotification: &'static NSNotificationName;
}
extern "C" {
#[deprecated]
pub static NSPlainFileType: &'static NSString;
}
extern "C" {
#[deprecated]
pub static NSDirectoryFileType: &'static NSString;
}
extern "C" {
#[deprecated]
pub static NSApplicationFileType: &'static NSString;
}
extern "C" {
#[deprecated]
pub static NSFilesystemFileType: &'static NSString;
}
extern "C" {
#[deprecated]
pub static NSShellCommandFileType: &'static NSString;
}