PNSApplicationDelegate

Trait PNSApplicationDelegate 

Source
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§

Source

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.

Source

fn did_finish_launching(&mut self)

Fired when the application has finished launching.

Source

fn did_become_active(&mut self)

Fired when the application is about to become active.

Source

fn will_resign_active(&mut self)

Fired when the application is about to resign active state.

Source

fn will_continue_user_activity(&mut self, _activity_type: &str) -> bool

Fired when the user is going to continue an activity.

Source

fn will_terminate(&mut self)

Fired before the application terminates. You can use this to do any required cleanup.

Source

fn will_become_active(&mut self)

Fired immediately before the application is about to become active.

Source

fn did_resign_active(&mut self)

Fired when the application has resigned active state.

Source

fn will_hide(&mut self)

Fired when the application is about to hide.

Source

fn did_hide(&mut self)

Fired after the application has hidden.

Source

fn will_unhide(&mut self)

Fired when the application is about to unhide itself.

Source

fn did_unhide(&mut self)

Fired after the application has unhidden itself.

Source

fn will_update(&mut self)

Fired immediately before the application object updates its windows.

Source

fn did_update(&mut self)

Fired immediately after the application object updates its windows.

Source

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.

Source

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.

Source

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.

Read more here

Source

fn dock_menu(&mut self) -> Option<NSMenu>

Supply a dock menu for the application dynamically. The default implementation for this method returns None, for no menu.

Implementors§