pub trait WindowDelegate {
const NAME: &'static str;
Show 32 methods
fn subclass_name(&self) -> &'static str { ... }
fn did_load(&mut self, _window: Window) { ... }
fn should_close(&self) -> bool { ... }
fn will_close(&self) { ... }
fn will_move(&self) { ... }
fn did_move(&self) { ... }
fn will_resize(&self, width: f64, height: f64) -> (f64, f64) { ... }
fn did_resize(&self) { ... }
fn will_start_live_resize(&self) { ... }
fn did_end_live_resize(&self) { ... }
fn did_change_screen(&self) { ... }
fn did_change_screen_profile(&self) { ... }
fn did_change_backing_properties(&self) { ... }
fn did_become_key(&self) { ... }
fn did_resign_key(&self) { ... }
fn did_become_main(&self) { ... }
fn did_resign_main(&self) { ... }
fn will_miniaturize(&self) { ... }
fn did_miniaturize(&self) { ... }
fn did_deminiaturize(&self) { ... }
fn content_size_for_full_screen(
&self,
proposed_width: f64,
proposed_height: f64
) -> (f64, f64) { ... }
fn presentation_options_for_full_screen(
&self
) -> Option<&[PresentationOption]> { ... }
fn will_enter_full_screen(&self) { ... }
fn did_enter_full_screen(&self) { ... }
fn will_exit_full_screen(&self) { ... }
fn did_exit_full_screen(&self) { ... }
fn did_fail_to_enter_full_screen(&self) { ... }
fn did_fail_to_exit_full_screen(&self) { ... }
fn did_change_occlusion_state(&self) { ... }
fn did_expose(&self) { ... }
fn did_update(&self) { ... }
fn cancel(&self) { ... }
}
appkit
only.Expand description
Lifecycle events for anything that impl Window
’s. These map to the standard Cocoa
lifecycle methods, but mix in a few extra things to handle offering configuration tools
in lieu of subclasses.
Required Associated Constants
Provided Methods
fn subclass_name(&self) -> &'static str
fn subclass_name(&self) -> &'static str
You should rarely (read: probably never) need to implement this yourself.
It simply acts as a getter for the associated NAME
const on this trait.
Fires when this window has loaded in memory, and is about to display. This is a good point to set up your views and what not.
If you’re coming from the web, you can think of this as DOMContentLoaded
.
fn should_close(&self) -> bool
fn should_close(&self) -> bool
Called when the user has attempted to close the window. NOT called when a user quits the application. Return false here if you need to handle the edge case.
fn will_close(&self)
fn will_close(&self)
Fires when a window is going to close. You might opt to, say, clean up things here - perhaps you have a long running task, or something that should be removed.
Fired before the window resizes, passing you the width and height. To avoid resizing, return the current size. To resize to a different size, return the desired size.
The default implementation of this method returns None
, indicating the system should just
do its thing. If you implement it, you probably want that.
fn did_resize(&self)
fn did_resize(&self)
Fired after the window has resized.
fn will_start_live_resize(&self)
fn will_start_live_resize(&self)
Fired when the window is going to live resize.
fn did_end_live_resize(&self)
fn did_end_live_resize(&self)
Fired when the window has ended live resizing.
fn did_change_screen(&self)
fn did_change_screen(&self)
Fired when the window changes screens - you might find this useful for certain scenarios, such as rendering in retina vs non-retina environments.
fn did_change_screen_profile(&self)
fn did_change_screen_profile(&self)
Fired when the window profile changes screens - you might find this useful for certain scenarios, such as rendering in retina vs non-retina environments.
fn did_change_backing_properties(&self)
fn did_change_backing_properties(&self)
Fired when the window backing properties change - you might find this useful for certain scenarios, such as rendering in retina vs non-retina environments. It’s rare to need this though.
fn did_become_key(&self)
fn did_become_key(&self)
Fires when this window is about to become the key window.
fn did_resign_key(&self)
fn did_resign_key(&self)
Fires when this window is about to resign key window status.
fn did_become_main(&self)
fn did_become_main(&self)
Fires when this window is about to become the main window.
fn did_resign_main(&self)
fn did_resign_main(&self)
Fires when this window is about to resign main status.
fn will_miniaturize(&self)
fn will_miniaturize(&self)
Fires when the window is about to miniaturize (e.g, to the Dock).
fn did_miniaturize(&self)
fn did_miniaturize(&self)
Fires when this window miniaturized (e.g, to the Dock).
fn did_deminiaturize(&self)
fn did_deminiaturize(&self)
Fires when this window de-miniaturized (e.g, from the Dock).
Fires when the system is moving a window to full screen and wants to know what content size to use. By default, this just returns the system-provided content size, but you can override it if need be.
fn presentation_options_for_full_screen(&self) -> Option<&[PresentationOption]>
fn presentation_options_for_full_screen(&self) -> Option<&[PresentationOption]>
Specify options for when this window goes full screen.
By default, this returns None
, which tells the system to proceed as it normally would
without customization.
fn will_enter_full_screen(&self)
fn will_enter_full_screen(&self)
Fires when this window is about to go full screen.
fn did_enter_full_screen(&self)
fn did_enter_full_screen(&self)
Fires when this window entered full screen.
fn will_exit_full_screen(&self)
fn will_exit_full_screen(&self)
Fires when this window is about to exit full screen.
fn did_exit_full_screen(&self)
fn did_exit_full_screen(&self)
Fires when this window exited full screen.
fn did_fail_to_enter_full_screen(&self)
fn did_fail_to_enter_full_screen(&self)
Fires when this window failed to enter full screen.
fn did_fail_to_exit_full_screen(&self)
fn did_fail_to_exit_full_screen(&self)
Fires when this window failed to exit full screen.
fn did_change_occlusion_state(&self)
fn did_change_occlusion_state(&self)
Fired when the occlusion state for this window has changed. Similar in nature to the app-level event, just for a Window.
fn did_expose(&self)
fn did_expose(&self)
Fired when the Window receives a didExpose
message from higher up in the chain.
fn did_update(&self)
fn did_update(&self)
Fired when the Window receives an update
message from higher up in the chain.