pub unsafe trait NSApplicationDelegate: NSObjectProtocol + MainThreadOnly {
Show 43 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: &Block<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_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 { ... }
}NSApplication only.Expand description
Provided Methods§
Sourceunsafe fn applicationShouldTerminate(
&self,
sender: &NSApplication,
) -> NSApplicationTerminateReply
Available on crate feature NSResponder only.
unsafe fn applicationShouldTerminate( &self, sender: &NSApplication, ) -> NSApplicationTerminateReply
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.
Sourceunsafe fn application_openURLs(
&self,
application: &NSApplication,
urls: &NSArray<NSURL>,
)
Available on crate feature NSResponder only.
unsafe fn application_openURLs( &self, application: &NSApplication, urls: &NSArray<NSURL>, )
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.
unsafe fn application_openFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool
NSResponder only.unsafe fn application_openFiles( &self, sender: &NSApplication, filenames: &NSArray<NSString>, )
NSResponder only.unsafe fn application_openTempFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool
NSResponder only.unsafe fn applicationShouldOpenUntitledFile( &self, sender: &NSApplication, ) -> bool
NSResponder only.unsafe fn applicationOpenUntitledFile(&self, sender: &NSApplication) -> bool
NSResponder only.unsafe fn application_openFileWithoutUI( &self, sender: &AnyObject, filename: &NSString, ) -> bool
unsafe fn application_printFile( &self, sender: &NSApplication, filename: &NSString, ) -> bool
NSResponder only.unsafe fn application_printFiles_withSettings_showPrintPanels( &self, application: &NSApplication, file_names: &NSArray<NSString>, print_settings: &NSDictionary<NSPrintInfoAttributeKey, AnyObject>, show_print_panels: bool, ) -> NSApplicationPrintReply
NSPrintInfo and NSResponder only.unsafe fn applicationShouldTerminateAfterLastWindowClosed( &self, sender: &NSApplication, ) -> bool
NSResponder only.unsafe fn applicationShouldHandleReopen_hasVisibleWindows( &self, sender: &NSApplication, has_visible_windows: bool, ) -> bool
NSResponder only.unsafe fn applicationDockMenu( &self, sender: &NSApplication, ) -> Option<Retained<NSMenu>>
NSMenu and NSResponder only.unsafe fn application_willPresentError( &self, application: &NSApplication, error: &NSError, ) -> Retained<NSError>
NSResponder only.unsafe fn application_didRegisterForRemoteNotificationsWithDeviceToken( &self, application: &NSApplication, device_token: &NSData, )
NSResponder only.unsafe fn application_didFailToRegisterForRemoteNotificationsWithError( &self, application: &NSApplication, error: &NSError, )
NSResponder only.unsafe fn application_didReceiveRemoteNotification( &self, application: &NSApplication, user_info: &NSDictionary<NSString, AnyObject>, )
NSResponder only.Sourceunsafe fn applicationSupportsSecureRestorableState(
&self,
app: &NSApplication,
) -> bool
Available on crate feature NSResponder only.
unsafe fn applicationSupportsSecureRestorableState( &self, app: &NSApplication, ) -> bool
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.
Sourceunsafe fn application_willEncodeRestorableState(
&self,
app: &NSApplication,
coder: &NSCoder,
)
Available on crate feature NSResponder only.
unsafe fn application_willEncodeRestorableState( &self, app: &NSApplication, coder: &NSCoder, )
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.
Sourceunsafe fn application_didDecodeRestorableState(
&self,
app: &NSApplication,
coder: &NSCoder,
)
Available on crate feature NSResponder only.
unsafe fn application_didDecodeRestorableState( &self, app: &NSApplication, coder: &NSCoder, )
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.
Sourceunsafe fn application_willContinueUserActivityWithType(
&self,
application: &NSApplication,
user_activity_type: &NSString,
) -> bool
Available on crate feature NSResponder only.
unsafe fn application_willContinueUserActivityWithType( &self, application: &NSApplication, user_activity_type: &NSString, ) -> bool
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.
Sourceunsafe fn application_continueUserActivity_restorationHandler(
&self,
application: &NSApplication,
user_activity: &NSUserActivity,
restoration_handler: &Block<dyn Fn(NonNull<NSArray<ProtocolObject<dyn NSUserActivityRestoring>>>)>,
) -> bool
Available on crate features NSResponder and NSUserActivity and block2 only.
unsafe fn application_continueUserActivity_restorationHandler( &self, application: &NSApplication, user_activity: &NSUserActivity, restoration_handler: &Block<dyn Fn(NonNull<NSArray<ProtocolObject<dyn NSUserActivityRestoring>>>)>, ) -> bool
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.
Sourceunsafe fn application_didFailToContinueUserActivityWithType_error(
&self,
application: &NSApplication,
user_activity_type: &NSString,
error: &NSError,
)
Available on crate feature NSResponder only.
unsafe fn application_didFailToContinueUserActivityWithType_error( &self, application: &NSApplication, user_activity_type: &NSString, error: &NSError, )
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.
Sourceunsafe fn application_didUpdateUserActivity(
&self,
application: &NSApplication,
user_activity: &NSUserActivity,
)
Available on crate feature NSResponder only.
unsafe fn application_didUpdateUserActivity( &self, application: &NSApplication, user_activity: &NSUserActivity, )
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.
Sourceunsafe fn application_delegateHandlesKey(
&self,
sender: &NSApplication,
key: &NSString,
) -> bool
Available on crate feature NSResponder only.
unsafe fn application_delegateHandlesKey( &self, sender: &NSApplication, key: &NSString, ) -> bool
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.
Sourceunsafe fn applicationShouldAutomaticallyLocalizeKeyEquivalents(
&self,
application: &NSApplication,
) -> bool
Available on crate feature NSResponder only.
unsafe fn applicationShouldAutomaticallyLocalizeKeyEquivalents( &self, application: &NSApplication, ) -> bool
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.