pub trait PNSApplicationDelegate {
Show 18 methods
// Provided methods
fn will_finish_launching(&mut self) { ... }
fn did_finish_launching(&mut self) { ... }
fn did_become_active(&mut self) { ... }
fn will_resign_active(&mut self) { ... }
fn will_continue_user_activity(&mut self, _activity_type: &str) -> bool { ... }
fn will_terminate(&mut self) { ... }
fn will_become_active(&mut self) { ... }
fn did_resign_active(&mut self) { ... }
fn will_hide(&mut self) { ... }
fn did_hide(&mut self) { ... }
fn will_unhide(&mut self) { ... }
fn did_unhide(&mut self) { ... }
fn will_update(&mut self) { ... }
fn did_update(&mut self) { ... }
fn should_terminate(&mut self) -> NSApplicationTerminateReply { ... }
fn should_terminate_after_last_window_closed(&mut self) -> bool { ... }
fn should_handle_reopen(&mut self, _has_visible_windows: bool) -> bool { ... }
fn dock_menu(&mut self) -> Option<NSMenu> { ... }
}Expand description
A set of methods that manage your app’s life cycle and its interaction with common system services.
Provided Methods§
Sourcefn will_finish_launching(&mut self)
fn will_finish_launching(&mut self)
Called right before the application will finish launching. You really, probably, want to do
your setup in did_finish_launching unless you’re sure of what you’re doing.
Sourcefn did_finish_launching(&mut self)
fn did_finish_launching(&mut self)
Fired when the application has finished launching.
Sourcefn did_become_active(&mut self)
fn did_become_active(&mut self)
Fired when the application is about to become active.
Sourcefn will_resign_active(&mut self)
fn will_resign_active(&mut self)
Fired when the application is about to resign active state.
Sourcefn will_continue_user_activity(&mut self, _activity_type: &str) -> bool
fn will_continue_user_activity(&mut self, _activity_type: &str) -> bool
Fired when the user is going to continue an activity.
Sourcefn will_terminate(&mut self)
fn will_terminate(&mut self)
Fired before the application terminates. You can use this to do any required cleanup.
Sourcefn will_become_active(&mut self)
fn will_become_active(&mut self)
Fired immediately before the application is about to become active.
Sourcefn did_resign_active(&mut self)
fn did_resign_active(&mut self)
Fired when the application has resigned active state.
Sourcefn will_unhide(&mut self)
fn will_unhide(&mut self)
Fired when the application is about to unhide itself.
Sourcefn did_unhide(&mut self)
fn did_unhide(&mut self)
Fired after the application has unhidden itself.
Sourcefn will_update(&mut self)
fn will_update(&mut self)
Fired immediately before the application object updates its windows.
Sourcefn did_update(&mut self)
fn did_update(&mut self)
Fired immediately after the application object updates its windows.
Sourcefn should_terminate(&mut self) -> NSApplicationTerminateReply
fn should_terminate(&mut self) -> NSApplicationTerminateReply
This is fired after the Quit menu item has been selected, or after you’ve called App::terminate().
In most cases you just want TerminateResponse::Now here, which enables business as usual. If you need,
though, you can cancel the termination via TerminateResponse::Cancel to continue something essential. If
you do this, you’ll need to be sure to call App::reply_to_termination_request() to circle
back.
Sourcefn should_terminate_after_last_window_closed(&mut self) -> bool
fn should_terminate_after_last_window_closed(&mut self) -> bool
Called after closing the last open window. Return true here if you want
the application to terminate.
Sourcefn should_handle_reopen(&mut self, _has_visible_windows: bool) -> bool
fn should_handle_reopen(&mut self, _has_visible_windows: bool) -> bool
Sent by the application to the delegate prior to default behavior to reopen AppleEvents.
has_visible_windows indicates whether the Application object found any visible windows in your application.
You can use this value as an indication of whether the application would do anything if you return true.
Return true if you want the application to perform its normal tasks, or false if you want the
application to do nothing. The default implementation of this method returns true.
Some finer points of discussion, from Apple documentation:
These events are sent whenever the Finder reactivates an already running application because someone double-clicked it again or used the dock to activate it.
For most document-based applications, an untitled document will be created.
Supply a dock menu for the application dynamically. The default implementation for this
method returns None, for no menu.