NSApplicationDelegate

Trait NSApplicationDelegate 

Source
pub unsafe trait NSApplicationDelegate: NSObjectProtocol + MainThreadOnly {
Show 43 methods // Provided methods fn applicationShouldTerminate( &self, sender: &NSApplication, ) -> NSApplicationTerminateReply where Self: Sized + Message { ... } fn application_openURLs( &self, application: &NSApplication, urls: &NSArray<NSURL>, ) where Self: Sized + Message { ... } fn application_openFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool where Self: Sized + Message { ... } fn application_openFiles( &self, sender: &NSApplication, filenames: &NSArray<NSString>, ) where Self: Sized + Message { ... } fn application_openTempFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool where Self: Sized + Message { ... } fn applicationShouldOpenUntitledFile(&self, sender: &NSApplication) -> bool where Self: Sized + Message { ... } fn applicationOpenUntitledFile(&self, sender: &NSApplication) -> bool where Self: Sized + Message { ... } unsafe fn application_openFileWithoutUI( &self, sender: &AnyObject, filename: &NSString, ) -> bool where Self: Sized + Message { ... } 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 { ... } fn applicationShouldTerminateAfterLastWindowClosed( &self, sender: &NSApplication, ) -> bool where Self: Sized + Message { ... } fn applicationShouldHandleReopen_hasVisibleWindows( &self, sender: &NSApplication, has_visible_windows: bool, ) -> bool where Self: Sized + Message { ... } fn applicationDockMenu( &self, sender: &NSApplication, ) -> Option<Retained<NSMenu>> where Self: Sized + Message { ... } fn application_willPresentError( &self, application: &NSApplication, error: &NSError, ) -> Retained<NSError> where Self: Sized + Message { ... } fn application_didRegisterForRemoteNotificationsWithDeviceToken( &self, application: &NSApplication, device_token: &NSData, ) where Self: Sized + Message { ... } 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 { ... } 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 { ... } fn application_willContinueUserActivityWithType( &self, application: &NSApplication, user_activity_type: &NSString, ) -> bool where Self: Sized + Message { ... } 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 { ... } fn application_didFailToContinueUserActivityWithType_error( &self, application: &NSApplication, user_activity_type: &NSString, error: &NSError, ) where Self: Sized + Message { ... } fn application_didUpdateUserActivity( &self, application: &NSApplication, user_activity: &NSUserActivity, ) where Self: Sized + Message { ... } fn application_delegateHandlesKey( &self, sender: &NSApplication, key: &NSString, ) -> bool where Self: Sized + Message { ... } fn applicationShouldAutomaticallyLocalizeKeyEquivalents( &self, application: &NSApplication, ) -> bool where Self: Sized + Message { ... } fn applicationWillFinishLaunching(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationDidFinishLaunching(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationWillHide(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationDidHide(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationWillUnhide(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationDidUnhide(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationWillBecomeActive(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationDidBecomeActive(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationWillResignActive(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationDidResignActive(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationWillUpdate(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationDidUpdate(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationWillTerminate(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationDidChangeScreenParameters( &self, notification: &NSNotification, ) where Self: Sized + Message { ... } fn applicationDidChangeOcclusionState(&self, notification: &NSNotification) where Self: Sized + Message { ... } fn applicationProtectedDataWillBecomeUnavailable( &self, notification: &NSNotification, ) where Self: Sized + Message { ... } fn applicationProtectedDataDidBecomeAvailable( &self, notification: &NSNotification, ) where Self: Sized + Message { ... }
}
Available on crate feature NSApplication only.
Expand description

Provided Methods§

Source

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

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

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

Available on crate feature NSResponder only.
Source

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

Available on crate feature NSResponder only.
Source

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

Available on crate feature NSResponder only.
Source

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

Available on crate feature NSResponder only.
Source

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,

§Safety

sender should be of the correct type.

Source

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.
§Safety

print_settings generic should be of the correct type.

Source

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

Available on crate feature NSResponder only.
Source

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

Available on crate feature NSResponder only.
Source

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

Available on crate features NSMenu and NSResponder only.
Source

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

Available on crate feature NSResponder only.
Source

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

Available on crate feature NSResponder only.
Source

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.
§Safety

user_info generic should be of the correct type.

Source

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.

§Safety

coder possibly has further requirements.

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.

§Safety

coder possibly has further requirements.

Source

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

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

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

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

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

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

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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§