Trait NSApplicationDelegate

Source
pub unsafe trait NSApplicationDelegate: NSObjectProtocol + MainThreadOnly {
Show 44 methods // Provided methods unsafe fn applicationShouldTerminate( &self, sender: &NSApplication, ) -> NSApplicationTerminateReply where Self: Sized + Message { ... } unsafe fn application_openURLs( &self, application: &NSApplication, urls: &NSArray<NSURL>, ) where Self: Sized + Message { ... } unsafe fn application_openFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool where Self: Sized + Message { ... } unsafe fn application_openFiles( &self, sender: &NSApplication, filenames: &NSArray<NSString>, ) where Self: Sized + Message { ... } unsafe fn application_openTempFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool where Self: Sized + Message { ... } unsafe fn applicationShouldOpenUntitledFile( &self, sender: &NSApplication, ) -> bool where Self: Sized + Message { ... } unsafe fn applicationOpenUntitledFile(&self, sender: &NSApplication) -> bool where Self: Sized + Message { ... } unsafe fn application_openFileWithoutUI( &self, sender: &AnyObject, filename: &NSString, ) -> bool where Self: Sized + Message { ... } unsafe fn application_printFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool where Self: Sized + Message { ... } unsafe fn application_printFiles_withSettings_showPrintPanels( &self, application: &NSApplication, file_names: &NSArray<NSString>, print_settings: &NSDictionary<NSPrintInfoAttributeKey, AnyObject>, show_print_panels: bool, ) -> NSApplicationPrintReply where Self: Sized + Message { ... } unsafe fn applicationShouldTerminateAfterLastWindowClosed( &self, sender: &NSApplication, ) -> bool where Self: Sized + Message { ... } unsafe fn applicationShouldHandleReopen_hasVisibleWindows( &self, sender: &NSApplication, has_visible_windows: bool, ) -> bool where Self: Sized + Message { ... } unsafe fn applicationDockMenu( &self, sender: &NSApplication, ) -> Option<Retained<NSMenu>> where Self: Sized + Message { ... } unsafe fn application_willPresentError( &self, application: &NSApplication, error: &NSError, ) -> Retained<NSError> where Self: Sized + Message { ... } unsafe fn application_didRegisterForRemoteNotificationsWithDeviceToken( &self, application: &NSApplication, device_token: &NSData, ) where Self: Sized + Message { ... } unsafe fn application_didFailToRegisterForRemoteNotificationsWithError( &self, application: &NSApplication, error: &NSError, ) where Self: Sized + Message { ... } unsafe fn application_didReceiveRemoteNotification( &self, application: &NSApplication, user_info: &NSDictionary<NSString, AnyObject>, ) where Self: Sized + Message { ... } unsafe fn applicationSupportsSecureRestorableState( &self, app: &NSApplication, ) -> bool where Self: Sized + Message { ... } unsafe fn application_willEncodeRestorableState( &self, app: &NSApplication, coder: &NSCoder, ) where Self: Sized + Message { ... } unsafe fn application_didDecodeRestorableState( &self, app: &NSApplication, coder: &NSCoder, ) where Self: Sized + Message { ... } unsafe fn application_willContinueUserActivityWithType( &self, application: &NSApplication, user_activity_type: &NSString, ) -> bool where Self: Sized + Message { ... } unsafe fn application_continueUserActivity_restorationHandler( &self, application: &NSApplication, user_activity: &NSUserActivity, restoration_handler: &DynBlock<dyn Fn(NonNull<NSArray<ProtocolObject<dyn NSUserActivityRestoring>>>)>, ) -> bool where Self: Sized + Message { ... } unsafe fn application_didFailToContinueUserActivityWithType_error( &self, application: &NSApplication, user_activity_type: &NSString, error: &NSError, ) where Self: Sized + Message { ... } unsafe fn application_didUpdateUserActivity( &self, application: &NSApplication, user_activity: &NSUserActivity, ) where Self: Sized + Message { ... } unsafe fn application_userDidAcceptCloudKitShareWithMetadata( &self, application: &NSApplication, metadata: &CKShareMetadata, ) where Self: Sized + Message { ... } unsafe fn application_delegateHandlesKey( &self, sender: &NSApplication, key: &NSString, ) -> bool where Self: Sized + Message { ... } unsafe fn applicationShouldAutomaticallyLocalizeKeyEquivalents( &self, application: &NSApplication, ) -> bool where Self: Sized + Message { ... } unsafe fn applicationWillFinishLaunching( &self, notification: &NSNotification, ) where Self: Sized + Message { ... } unsafe fn applicationDidFinishLaunching( &self, notification: &NSNotification, ) where Self: Sized + Message { ... } unsafe fn applicationWillHide(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationDidHide(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationWillUnhide(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationDidUnhide(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationWillBecomeActive(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationDidBecomeActive(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationWillResignActive(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationDidResignActive(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationWillUpdate(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationDidUpdate(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationWillTerminate(&self, notification: &NSNotification) where Self: Sized + Message { ... } unsafe fn applicationDidChangeScreenParameters( &self, notification: &NSNotification, ) where Self: Sized + Message { ... } unsafe fn applicationDidChangeOcclusionState( &self, notification: &NSNotification, ) where Self: Sized + Message { ... } unsafe fn applicationProtectedDataWillBecomeUnavailable( &self, notification: &NSNotification, ) where Self: Sized + Message { ... } unsafe fn applicationProtectedDataDidBecomeAvailable( &self, notification: &NSNotification, ) where Self: Sized + Message { ... }
}
Available on crate feature NSApplication only.
Expand description

Provided Methods§

Source

unsafe fn applicationShouldTerminate( &self, sender: &NSApplication, ) -> NSApplicationTerminateReply
where Self: Sized + Message,

Available on crate feature NSResponder only.

Allowable return values are: NSTerminateNow- it is ok to proceed with termination NSTerminateCancel- the application should not be terminated NSTerminateLater- it may be ok to proceed with termination later. The application must call -replyToApplicationShouldTerminate: with YESor NOonce the answer is known

Note: This return value is for delegates who need to provide document modal alerts (sheets) in order to decide whether to quit.

Source

unsafe fn application_openURLs( &self, application: &NSApplication, urls: &NSArray<NSURL>, )
where Self: Sized + Message,

Available on crate feature NSResponder only.

This will be called for any URLs your application is asked to open. This includes URL types (CFBundleURLTypes) defined in your Info.plist, and Document types ( CFBundleDocumentTypes)that have no associated NSDocumentclass. Document URLs that have an associated NSDocumentclass will be opened through NSDocumentController.If this is implemented, -application:openFiles: and -application:openFile: will not be called.

Source

unsafe fn application_openFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn application_openFiles( &self, sender: &NSApplication, filenames: &NSArray<NSString>, )
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn application_openTempFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn applicationShouldOpenUntitledFile( &self, sender: &NSApplication, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn applicationOpenUntitledFile(&self, sender: &NSApplication) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn application_openFileWithoutUI( &self, sender: &AnyObject, filename: &NSString, ) -> bool
where Self: Sized + Message,

Source

unsafe fn application_printFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn application_printFiles_withSettings_showPrintPanels( &self, application: &NSApplication, file_names: &NSArray<NSString>, print_settings: &NSDictionary<NSPrintInfoAttributeKey, AnyObject>, show_print_panels: bool, ) -> NSApplicationPrintReply
where Self: Sized + Message,

Available on crate features NSPrintInfo and NSResponder only.
Source

unsafe fn applicationShouldTerminateAfterLastWindowClosed( &self, sender: &NSApplication, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn applicationShouldHandleReopen_hasVisibleWindows( &self, sender: &NSApplication, has_visible_windows: bool, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn applicationDockMenu( &self, sender: &NSApplication, ) -> Option<Retained<NSMenu>>
where Self: Sized + Message,

Available on crate features NSMenu and NSResponder only.
Source

unsafe fn application_willPresentError( &self, application: &NSApplication, error: &NSError, ) -> Retained<NSError>
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn application_didRegisterForRemoteNotificationsWithDeviceToken( &self, application: &NSApplication, device_token: &NSData, )
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn application_didFailToRegisterForRemoteNotificationsWithError( &self, application: &NSApplication, error: &NSError, )
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn application_didReceiveRemoteNotification( &self, application: &NSApplication, user_info: &NSDictionary<NSString, AnyObject>, )
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn applicationSupportsSecureRestorableState( &self, app: &NSApplication, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.

Method to opt-in to secure restorable state.

When this returns YES:NSCoders that are passed into the various NSWindowRestorationmethods will requiresSecureCodingand have a decodingFailurePolicyof NSDecodingFailurePolicySetErrorAndReturn.Any restorationClassset on a window must explicitly conform to NSWindowRestoration.This method will be called prior to any state encoding or restoration.

Source

unsafe fn application_willEncodeRestorableState( &self, app: &NSApplication, coder: &NSCoder, )
where Self: Sized + Message,

Available on crate feature NSResponder only.

Method called by -[NSApplication encodeRestorableStateWithCoder:] to give the delegate a chance to encode any additional state into the NSCoder.If the restorable state managed by the delegate changes, you must call -[NSApplication invalidateRestorableState] so that it will be re-encoded. See the header NSWindowRestoration.h for more information.

Source

unsafe fn application_didDecodeRestorableState( &self, app: &NSApplication, coder: &NSCoder, )
where Self: Sized + Message,

Available on crate feature NSResponder only.

Method called by -[NSApplication restoreStateWithCoder:] to give the delegate a chance to restore its own state, which it may decode from the NSCoder.See the header NSWindowRestoration.h for more information.

Source

unsafe fn application_willContinueUserActivityWithType( &self, application: &NSApplication, user_activity_type: &NSString, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.

This will be called on the main thread as soon as the user indicates they want to continue an activity in your application. The NSUserActivityobject may not be available instantly, so use this as an opportunity to show the user that an activity will be continued shortly. Return YESto indicate that you are doing so. Return NO(or leave it unimplemented) and AppKit/UIKit will put up a default UI.

For each -application:willContinueUserActivityWithType: invocation, you are guaranteed to get exactly one invocation of -application:continueUserActivity:restorationHandler: on success, or -application:didFailToContinueUserActivityWithType:error: if an error was encountered.

Source

unsafe fn application_continueUserActivity_restorationHandler( &self, application: &NSApplication, user_activity: &NSUserActivity, restoration_handler: &DynBlock<dyn Fn(NonNull<NSArray<ProtocolObject<dyn NSUserActivityRestoring>>>)>, ) -> bool
where Self: Sized + Message,

Available on crate features NSResponder and NSUserActivity and block2 only.

This will be called on the main thread after the NSUserActivityobject is available. Use the data you stored in the NSUserActivity object to re-create what the user was doing.

Returns: YESto indicate that the activity was handled. Return NO(or leave it unimplemented) and AppKit will attempt to continue the user activity.

You should create/fetch any restorable objects associated with the user activity, and pass them to the restorationHandler. They will then get the above -restoreUserActivityState: method invoked with the user activity. Invoking the restorationHandleris optional. It may be copied and invoked later, but must be invoked on the main thread.

If this user activity was created automatically by having NSUbiquitousDocumentUserActivityTypein a CFBundleDocumentTypesentry, AppKit can automatically restore the NSUserActivity on OS X if NO is returned, or this method is unimplemented. It will do so by creating a document of the appropriate type using the URL stored in the userInfo under the NSUserActivityDocumentURLKey.The document will have -restoreUserActivity: called on it.

Source

unsafe fn application_didFailToContinueUserActivityWithType_error( &self, application: &NSApplication, user_activity_type: &NSString, error: &NSError, )
where Self: Sized + Message,

Available on crate feature NSResponder only.

There are instances where continuing a NSUserActivitymay fail. This will get called on the main thread if it does so. If it is unimplemented, AppKit will present the error.

Source

unsafe fn application_didUpdateUserActivity( &self, application: &NSApplication, user_activity: &NSUserActivity, )
where Self: Sized + Message,

Available on crate feature NSResponder only.

This will be called on the main thread when a user activity managed by AppKit/UIKit has been updated. You should use this as a last chance to add additional data to the userActivity.

Source

unsafe fn application_userDidAcceptCloudKitShareWithMetadata( &self, application: &NSApplication, metadata: &CKShareMetadata, )
where Self: Sized + Message,

Available on crate feature NSResponder and crate feature objc2-cloud-kit and Apple only.

This will be called on the main thread after the user indicates they want to accept a CloudKit sharing invitation in your application.

You should use the CKShareMetadataobject’s shareURLand containerIdentifier to schedule a CKAcceptSharesOperation,then start using the resulting CKShareand its associated record(s), which will appear in the CKContainer'sshared database in a zone matching that of the record’s owner.

Source

unsafe fn application_delegateHandlesKey( &self, sender: &NSApplication, key: &NSString, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.

Returns: YESif the receiving delegate object can respond to key value coding messages for a specific keyed attribute, to-one relationship, or to-many relationship. Return NOotherwise.

Source

unsafe fn applicationShouldAutomaticallyLocalizeKeyEquivalents( &self, application: &NSApplication, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.

This method will be called once during application launch at -[NSApplication finishLaunching].

Returns: NOif the receiving delegate object wishes to opt-out of system-wide keyboard shortcut localization for all application-supplied menus. Return YESby default for apps linked against 12.0 and later SDK.

Source

unsafe fn applicationWillFinishLaunching(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationDidFinishLaunching(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationWillHide(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationDidHide(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationWillUnhide(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationDidUnhide(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationWillBecomeActive(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationDidBecomeActive(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationWillResignActive(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationDidResignActive(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationWillUpdate(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationDidUpdate(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationWillTerminate(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn applicationDidChangeScreenParameters( &self, notification: &NSNotification, )
where Self: Sized + Message,

Source

unsafe fn applicationDidChangeOcclusionState( &self, notification: &NSNotification, )
where Self: Sized + Message,

Source

unsafe fn applicationProtectedDataWillBecomeUnavailable( &self, notification: &NSNotification, )
where Self: Sized + Message,

Source

unsafe fn applicationProtectedDataDidBecomeAvailable( &self, notification: &NSNotification, )
where Self: Sized + Message,

Trait Implementations§

Source§

impl ProtocolType for dyn NSApplicationDelegate

Source§

const NAME: &'static str = "NSApplicationDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn NSApplicationDelegate

Implementations on Foreign Types§

Source§

impl<T> NSApplicationDelegate for ProtocolObject<T>

Implementors§