pub unsafe trait NSWindowDelegate: NSObjectProtocol + MainThreadOnly {
Show 53 methods
// Provided methods
fn windowShouldClose(&self, sender: &NSWindow) -> bool
where Self: Sized + Message { ... }
unsafe fn windowWillReturnFieldEditor_toObject(
&self,
sender: &NSWindow,
client: Option<&AnyObject>,
) -> Option<Retained<AnyObject>>
where Self: Sized + Message { ... }
fn windowWillResize_toSize(
&self,
sender: &NSWindow,
frame_size: NSSize,
) -> NSSize
where Self: Sized + Message { ... }
fn windowWillUseStandardFrame_defaultFrame(
&self,
window: &NSWindow,
new_frame: NSRect,
) -> NSRect
where Self: Sized + Message { ... }
fn windowShouldZoom_toFrame(
&self,
window: &NSWindow,
new_frame: NSRect,
) -> bool
where Self: Sized + Message { ... }
fn windowWillReturnUndoManager(
&self,
window: &NSWindow,
) -> Option<Retained<NSUndoManager>>
where Self: Sized + Message { ... }
fn window_willPositionSheet_usingRect(
&self,
window: &NSWindow,
sheet: &NSWindow,
rect: NSRect,
) -> NSRect
where Self: Sized + Message { ... }
fn window_shouldPopUpDocumentPathMenu(
&self,
window: &NSWindow,
menu: &NSMenu,
) -> bool
where Self: Sized + Message { ... }
fn window_shouldDragDocumentWithEvent_from_withPasteboard(
&self,
window: &NSWindow,
event: &NSEvent,
drag_image_location: NSPoint,
pasteboard: &NSPasteboard,
) -> bool
where Self: Sized + Message { ... }
fn window_willUseFullScreenContentSize(
&self,
window: &NSWindow,
proposed_size: NSSize,
) -> NSSize
where Self: Sized + Message { ... }
fn window_willUseFullScreenPresentationOptions(
&self,
window: &NSWindow,
proposed_options: NSApplicationPresentationOptions,
) -> NSApplicationPresentationOptions
where Self: Sized + Message { ... }
fn customWindowsToEnterFullScreenForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<NSWindow>>>
where Self: Sized + Message { ... }
fn window_startCustomAnimationToEnterFullScreenWithDuration(
&self,
window: &NSWindow,
duration: NSTimeInterval,
)
where Self: Sized + Message { ... }
fn windowDidFailToEnterFullScreen(&self, window: &NSWindow)
where Self: Sized + Message { ... }
fn customWindowsToExitFullScreenForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<NSWindow>>>
where Self: Sized + Message { ... }
fn window_startCustomAnimationToExitFullScreenWithDuration(
&self,
window: &NSWindow,
duration: NSTimeInterval,
)
where Self: Sized + Message { ... }
fn customWindowsToEnterFullScreenForWindow_onScreen(
&self,
window: &NSWindow,
screen: &NSScreen,
) -> Option<Retained<NSArray<NSWindow>>>
where Self: Sized + Message { ... }
fn window_startCustomAnimationToEnterFullScreenOnScreen_withDuration(
&self,
window: &NSWindow,
screen: &NSScreen,
duration: NSTimeInterval,
)
where Self: Sized + Message { ... }
fn windowDidFailToExitFullScreen(&self, window: &NSWindow)
where Self: Sized + Message { ... }
fn window_willResizeForVersionBrowserWithMaxPreferredSize_maxAllowedSize(
&self,
window: &NSWindow,
max_preferred_frame_size: NSSize,
max_allowed_frame_size: NSSize,
) -> NSSize
where Self: Sized + Message { ... }
unsafe fn window_willEncodeRestorableState(
&self,
window: &NSWindow,
state: &NSCoder,
)
where Self: Sized + Message { ... }
unsafe fn window_didDecodeRestorableState(
&self,
window: &NSWindow,
state: &NSCoder,
)
where Self: Sized + Message { ... }
fn previewRepresentableActivityItemsForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>
where Self: Sized + Message { ... }
fn windowForSharingRequestFromWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSWindow>>
where Self: Sized + Message { ... }
fn windowDidResize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidExpose(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowWillMove(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidMove(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidBecomeKey(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidResignKey(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidBecomeMain(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidResignMain(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowWillClose(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowWillMiniaturize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidMiniaturize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidDeminiaturize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidUpdate(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidChangeScreen(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidChangeScreenProfile(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidChangeBackingProperties(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowWillBeginSheet(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidEndSheet(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowWillStartLiveResize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidEndLiveResize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowWillEnterFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidEnterFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowWillExitFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidExitFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowWillEnterVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidEnterVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowWillExitVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidExitVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
fn windowDidChangeOcclusionState(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
}
NSWindow
only.Expand description
Provided Methods§
fn windowShouldClose(&self, sender: &NSWindow) -> bool
NSResponder
only.Sourceunsafe fn windowWillReturnFieldEditor_toObject(
&self,
sender: &NSWindow,
client: Option<&AnyObject>,
) -> Option<Retained<AnyObject>>
Available on crate feature NSResponder
only.
unsafe fn windowWillReturnFieldEditor_toObject( &self, sender: &NSWindow, client: Option<&AnyObject>, ) -> Option<Retained<AnyObject>>
NSResponder
only.§Safety
client
should be of the correct type.
fn windowWillResize_toSize( &self, sender: &NSWindow, frame_size: NSSize, ) -> NSSize
NSResponder
only.fn windowWillUseStandardFrame_defaultFrame( &self, window: &NSWindow, new_frame: NSRect, ) -> NSRect
NSResponder
only.fn windowShouldZoom_toFrame(&self, window: &NSWindow, new_frame: NSRect) -> bool
NSResponder
only.fn windowWillReturnUndoManager( &self, window: &NSWindow, ) -> Option<Retained<NSUndoManager>>
NSResponder
only.Sourcefn window_willPositionSheet_usingRect(
&self,
window: &NSWindow,
sheet: &NSWindow,
rect: NSRect,
) -> NSRect
Available on crate feature NSResponder
only.
fn window_willPositionSheet_usingRect( &self, window: &NSWindow, sheet: &NSWindow, rect: NSRect, ) -> NSRect
NSResponder
only.Tells the delegate that the window is about to show a sheet, and gives the delegate a chance to customize the location of the sheet.
Sourcefn window_shouldPopUpDocumentPathMenu(
&self,
window: &NSWindow,
menu: &NSMenu,
) -> bool
Available on crate features NSMenu
and NSResponder
only.
fn window_shouldPopUpDocumentPathMenu( &self, window: &NSWindow, menu: &NSMenu, ) -> bool
NSMenu
and NSResponder
only.If a window has a
representedURL,
the window will by default show a path popup menu for a command-click on a rectangle containing the window document icon button and the window title. The window delegate may implement -window:shouldPopupDocumentPathMenu:
to override NSWindow
’s default behavior for path popup menu. A return of
NO
will prevent the menu from being shown. A return of
YES
will cause the window to show the menu passed to this method, which by default will contain a menuItem for each path component of the
representedURL.
If the
representedURL
has no path components, the menu will have no menu items. Before returning
YES,
the window delegate may customize the menu by changing the menuItems. menuItems may be added or deleted, and each menuItem title, action, or target may be modified.
Sourcefn window_shouldDragDocumentWithEvent_from_withPasteboard(
&self,
window: &NSWindow,
event: &NSEvent,
drag_image_location: NSPoint,
pasteboard: &NSPasteboard,
) -> bool
Available on crate features NSEvent
and NSPasteboard
and NSResponder
only.
fn window_shouldDragDocumentWithEvent_from_withPasteboard( &self, window: &NSWindow, event: &NSEvent, drag_image_location: NSPoint, pasteboard: &NSPasteboard, ) -> bool
NSEvent
and NSPasteboard
and NSResponder
only.The window delegate may implement -window:shouldDragDocumentWithEvent:from:withPasteboard:
to override
NSWindow
document icon’s default drag behavior. The delegate can prohibit the drag by returning
NO.
Before returning
NO,
the delegate may implement its own dragging behavior using -[NSWindow dragImage:at:offset:event:pasteboard:source:slideBack:]
. Alternatively, the delegate can enable a drag by returning
YES,
for example to override NSWindow’s default behavior of prohibiting the drag of an edited document. Lastly, the delegate can customize the pasteboard contents before returning
YES.
fn window_willUseFullScreenContentSize( &self, window: &NSWindow, proposed_size: NSSize, ) -> NSSize
NSResponder
only.fn window_willUseFullScreenPresentationOptions( &self, window: &NSWindow, proposed_options: NSApplicationPresentationOptions, ) -> NSApplicationPresentationOptions
NSApplication
and NSResponder
only.Sourcefn customWindowsToEnterFullScreenForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<NSWindow>>>
Available on crate feature NSResponder
only.
fn customWindowsToEnterFullScreenForWindow( &self, window: &NSWindow, ) -> Option<Retained<NSArray<NSWindow>>>
NSResponder
only.The default animation between a window and its fullscreen representation is a crossfade. With knowledge of the layout of a window before and after it enters fullscreen, an application can do a much better job on the animation. The following API allows a window delegate to customize the animation by providing a custom window or windows containing layers or other effects. In order to manage windows on spaces, we need the window delegate to provide a list of windows involved in the animation. If an application does not do a custom animation, this method can be unimplemented or can return nil. -window:startCustomAnimationToEnterFullScreenWithDuration:
will be called only if -customWindowsToEnterFullScreenForWindow:
returns non-nil.
Sourcefn window_startCustomAnimationToEnterFullScreenWithDuration(
&self,
window: &NSWindow,
duration: NSTimeInterval,
)
Available on crate feature NSResponder
only.
fn window_startCustomAnimationToEnterFullScreenWithDuration( &self, window: &NSWindow, duration: NSTimeInterval, )
NSResponder
only.The system has started its animation into fullscreen, including transitioning to a new space. Start the window fullscreen animation immediately, and perform the animation with the given duration to be in sync with the system animation. This method is called only if -customWindowToEnterFullScreenForWindow:
returned non-nil.
Sourcefn windowDidFailToEnterFullScreen(&self, window: &NSWindow)
Available on crate feature NSResponder
only.
fn windowDidFailToEnterFullScreen(&self, window: &NSWindow)
NSResponder
only.In some cases, the transition to enter fullscreen will fail, due to being in the midst of handling some other animation or user gesture. We will attempt to minimize these cases, but believe there is a need for failure handling. This method indicates that there was an error, and the application should clean up any work it may have done to prepare to enter fullscreen. This message will be sent whether or not the delegate indicated a custom animation by returning non-nil from -customWindowsToEnterFullScreenForWindow:
.
Sourcefn customWindowsToExitFullScreenForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<NSWindow>>>
Available on crate feature NSResponder
only.
fn customWindowsToExitFullScreenForWindow( &self, window: &NSWindow, ) -> Option<Retained<NSArray<NSWindow>>>
NSResponder
only.The window is about to exit fullscreen mode. The following API allows a window delegate to customize the animation when the window is about to exit fullscreen. In order to manage windows on spaces, we need the window delegate to provide a list of windows involved in the animation. If an application does not do a custom animation, this method can be unimplemented or can return nil. -window:startCustomAnimationToExitFullScreenWithDuration:
will be called only if -customWindowsToExitFullScreenForWindow:
returns non-nil.
Sourcefn window_startCustomAnimationToExitFullScreenWithDuration(
&self,
window: &NSWindow,
duration: NSTimeInterval,
)
Available on crate feature NSResponder
only.
fn window_startCustomAnimationToExitFullScreenWithDuration( &self, window: &NSWindow, duration: NSTimeInterval, )
NSResponder
only.The system has started its animation out of fullscreen, including transitioning back to the desktop space. Start the window animation immediately, and perform the animation with the given duration to be in sync with the system animation. This method is called only if -customWindowsToExitFullScreenForWindow:
returned non-nil.
Sourcefn customWindowsToEnterFullScreenForWindow_onScreen(
&self,
window: &NSWindow,
screen: &NSScreen,
) -> Option<Retained<NSArray<NSWindow>>>
Available on crate features NSResponder
and NSScreen
only.
fn customWindowsToEnterFullScreenForWindow_onScreen( &self, window: &NSWindow, screen: &NSScreen, ) -> Option<Retained<NSArray<NSWindow>>>
NSResponder
and NSScreen
only.-customWindowsToEnterFullScreenForWindow:onScreen:
will be called in place of -customWindowsToEnterFullScreenForWindow:
if both are implemented.
Sourcefn window_startCustomAnimationToEnterFullScreenOnScreen_withDuration(
&self,
window: &NSWindow,
screen: &NSScreen,
duration: NSTimeInterval,
)
Available on crate features NSResponder
and NSScreen
only.
fn window_startCustomAnimationToEnterFullScreenOnScreen_withDuration( &self, window: &NSWindow, screen: &NSScreen, duration: NSTimeInterval, )
NSResponder
and NSScreen
only.-window:startCustomAnimationToEnterFullScreenOnScreen:withDuration:
will be called in place of -window:startCustomAnimationToEnterFullScreenWithDuration:
if both are implemented.
Sourcefn windowDidFailToExitFullScreen(&self, window: &NSWindow)
Available on crate feature NSResponder
only.
fn windowDidFailToExitFullScreen(&self, window: &NSWindow)
NSResponder
only.In some cases, the transition to exit fullscreen will fail, due to being in the midst of handling some other animation or user gesture. We will attempt to minimize these cases, but believe there is a need for failure handling. This method indicates that there was an error, and the application should clean up any work it may have done to prepare to exit fullscreen. This message will be sent whether or not the delegate indicated a custom animation by returning non-nil from -customWindowsToExitFullScreenForWindow:
.
Sourcefn window_willResizeForVersionBrowserWithMaxPreferredSize_maxAllowedSize(
&self,
window: &NSWindow,
max_preferred_frame_size: NSSize,
max_allowed_frame_size: NSSize,
) -> NSSize
Available on crate feature NSResponder
only.
fn window_willResizeForVersionBrowserWithMaxPreferredSize_maxAllowedSize( &self, window: &NSWindow, max_preferred_frame_size: NSSize, max_allowed_frame_size: NSSize, ) -> NSSize
NSResponder
only.Windows entering the version browser will be resized to the size returned by this method. If either dimension of the returned size is larger than the
maxPreferredFrameSize,
the window will also be scaled down to ensure it fits properly in the version browser. Returned sizes larger than
maxAllowedSize
will be constrained to that size. If this method is not implemented, the version browser will use -window:willUseStandardFrame:
to determine the resulting window frame size.
Sourceunsafe fn window_willEncodeRestorableState(
&self,
window: &NSWindow,
state: &NSCoder,
)
Available on crate feature NSResponder
only.
unsafe fn window_willEncodeRestorableState( &self, window: &NSWindow, state: &NSCoder, )
NSResponder
only.Method called by -[NSWindow encodeRestorableStateWithCoder:]
to give the delegate a chance to encode any additional state into the NSCoder. This state is available in the NSCoder passed to -restoreWindowWithIdentifier:state:handler:
. See the header NSWindowRestoration.h
for more information.
§Safety
state
possibly has further requirements.
Sourceunsafe fn window_didDecodeRestorableState(
&self,
window: &NSWindow,
state: &NSCoder,
)
Available on crate feature NSResponder
only.
unsafe fn window_didDecodeRestorableState( &self, window: &NSWindow, state: &NSCoder, )
NSResponder
only.Method called by -[NSWindow 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
state
possibly has further requirements.
Sourcefn previewRepresentableActivityItemsForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>
Available on crate features NSPreviewRepresentingActivityItem
and NSResponder
only.
fn previewRepresentableActivityItemsForWindow( &self, window: &NSWindow, ) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>
NSPreviewRepresentingActivityItem
and NSResponder
only.Preview representable activity items, used for sharing and collaboration.
Sourcefn windowForSharingRequestFromWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSWindow>>
Available on crate feature NSResponder
only.
fn windowForSharingRequestFromWindow( &self, window: &NSWindow, ) -> Option<Retained<NSWindow>>
NSResponder
only.Method called to get the window to share once sharing is confirmed, after a request is initiated by requestSharingOfWindowUsingPreview:title:completionHandler:. Implement this on the delegate of the requesting window