pub unsafe trait NSWindowDelegate: NSObjectProtocol + MainThreadOnly {
Show 53 methods
// Provided methods
unsafe 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 { ... }
unsafe fn windowWillResize_toSize(
&self,
sender: &NSWindow,
frame_size: NSSize,
) -> NSSize
where Self: Sized + Message { ... }
unsafe fn windowWillUseStandardFrame_defaultFrame(
&self,
window: &NSWindow,
new_frame: NSRect,
) -> NSRect
where Self: Sized + Message { ... }
unsafe fn windowShouldZoom_toFrame(
&self,
window: &NSWindow,
new_frame: NSRect,
) -> bool
where Self: Sized + Message { ... }
unsafe fn windowWillReturnUndoManager(
&self,
window: &NSWindow,
) -> Option<Retained<NSUndoManager>>
where Self: Sized + Message { ... }
unsafe fn window_willPositionSheet_usingRect(
&self,
window: &NSWindow,
sheet: &NSWindow,
rect: NSRect,
) -> NSRect
where Self: Sized + Message { ... }
unsafe fn window_shouldPopUpDocumentPathMenu(
&self,
window: &NSWindow,
menu: &NSMenu,
) -> bool
where Self: Sized + Message { ... }
unsafe fn window_shouldDragDocumentWithEvent_from_withPasteboard(
&self,
window: &NSWindow,
event: &NSEvent,
drag_image_location: NSPoint,
pasteboard: &NSPasteboard,
) -> bool
where Self: Sized + Message { ... }
unsafe fn window_willUseFullScreenContentSize(
&self,
window: &NSWindow,
proposed_size: NSSize,
) -> NSSize
where Self: Sized + Message { ... }
unsafe fn window_willUseFullScreenPresentationOptions(
&self,
window: &NSWindow,
proposed_options: NSApplicationPresentationOptions,
) -> NSApplicationPresentationOptions
where Self: Sized + Message { ... }
unsafe fn customWindowsToEnterFullScreenForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<NSWindow>>>
where Self: Sized + Message { ... }
unsafe fn window_startCustomAnimationToEnterFullScreenWithDuration(
&self,
window: &NSWindow,
duration: NSTimeInterval,
)
where Self: Sized + Message { ... }
unsafe fn windowDidFailToEnterFullScreen(&self, window: &NSWindow)
where Self: Sized + Message { ... }
unsafe fn customWindowsToExitFullScreenForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<NSWindow>>>
where Self: Sized + Message { ... }
unsafe fn window_startCustomAnimationToExitFullScreenWithDuration(
&self,
window: &NSWindow,
duration: NSTimeInterval,
)
where Self: Sized + Message { ... }
unsafe fn customWindowsToEnterFullScreenForWindow_onScreen(
&self,
window: &NSWindow,
screen: &NSScreen,
) -> Option<Retained<NSArray<NSWindow>>>
where Self: Sized + Message { ... }
unsafe fn window_startCustomAnimationToEnterFullScreenOnScreen_withDuration(
&self,
window: &NSWindow,
screen: &NSScreen,
duration: NSTimeInterval,
)
where Self: Sized + Message { ... }
unsafe fn windowDidFailToExitFullScreen(&self, window: &NSWindow)
where Self: Sized + Message { ... }
unsafe 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 { ... }
unsafe fn previewRepresentableActivityItemsForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>
where Self: Sized + Message { ... }
unsafe fn windowForSharingRequestFromWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSWindow>>
where Self: Sized + Message { ... }
unsafe fn windowDidResize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidExpose(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowWillMove(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidMove(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidBecomeKey(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidResignKey(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidBecomeMain(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidResignMain(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowWillClose(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowWillMiniaturize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidMiniaturize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidDeminiaturize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidUpdate(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidChangeScreen(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidChangeScreenProfile(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidChangeBackingProperties(
&self,
notification: &NSNotification,
)
where Self: Sized + Message { ... }
unsafe fn windowWillBeginSheet(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidEndSheet(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowWillStartLiveResize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidEndLiveResize(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowWillEnterFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidEnterFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowWillExitFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidExitFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowWillEnterVersionBrowser(
&self,
notification: &NSNotification,
)
where Self: Sized + Message { ... }
unsafe fn windowDidEnterVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowWillExitVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidExitVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn windowDidChangeOcclusionState(
&self,
notification: &NSNotification,
)
where Self: Sized + Message { ... }
}
NSWindow
only.Expand description
Provided Methods§
unsafe fn windowShouldClose(&self, sender: &NSWindow) -> bool
NSResponder
only.unsafe fn windowWillReturnFieldEditor_toObject( &self, sender: &NSWindow, client: Option<&AnyObject>, ) -> Option<Retained<AnyObject>>
NSResponder
only.unsafe fn windowWillResize_toSize( &self, sender: &NSWindow, frame_size: NSSize, ) -> NSSize
NSResponder
only.unsafe fn windowWillUseStandardFrame_defaultFrame( &self, window: &NSWindow, new_frame: NSRect, ) -> NSRect
NSResponder
only.unsafe fn windowShouldZoom_toFrame( &self, window: &NSWindow, new_frame: NSRect, ) -> bool
NSResponder
only.unsafe fn windowWillReturnUndoManager( &self, window: &NSWindow, ) -> Option<Retained<NSUndoManager>>
NSResponder
only.Sourceunsafe fn window_willPositionSheet_usingRect(
&self,
window: &NSWindow,
sheet: &NSWindow,
rect: NSRect,
) -> NSRect
Available on crate feature NSResponder
only.
unsafe 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.
Sourceunsafe fn window_shouldPopUpDocumentPathMenu(
&self,
window: &NSWindow,
menu: &NSMenu,
) -> bool
Available on crate features NSMenu
and NSResponder
only.
unsafe 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.
Sourceunsafe fn 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.
unsafe 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.
unsafe fn window_willUseFullScreenContentSize( &self, window: &NSWindow, proposed_size: NSSize, ) -> NSSize
NSResponder
only.unsafe fn window_willUseFullScreenPresentationOptions( &self, window: &NSWindow, proposed_options: NSApplicationPresentationOptions, ) -> NSApplicationPresentationOptions
NSApplication
and NSResponder
only.Sourceunsafe fn customWindowsToEnterFullScreenForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<NSWindow>>>
Available on crate feature NSResponder
only.
unsafe 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.
Sourceunsafe fn window_startCustomAnimationToEnterFullScreenWithDuration(
&self,
window: &NSWindow,
duration: NSTimeInterval,
)
Available on crate feature NSResponder
only.
unsafe 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.
Sourceunsafe fn windowDidFailToEnterFullScreen(&self, window: &NSWindow)
Available on crate feature NSResponder
only.
unsafe 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:
.
Sourceunsafe fn customWindowsToExitFullScreenForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<NSWindow>>>
Available on crate feature NSResponder
only.
unsafe 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.
Sourceunsafe fn window_startCustomAnimationToExitFullScreenWithDuration(
&self,
window: &NSWindow,
duration: NSTimeInterval,
)
Available on crate feature NSResponder
only.
unsafe 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.
Sourceunsafe fn customWindowsToEnterFullScreenForWindow_onScreen(
&self,
window: &NSWindow,
screen: &NSScreen,
) -> Option<Retained<NSArray<NSWindow>>>
Available on crate features NSResponder
and NSScreen
only.
unsafe 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.
Sourceunsafe fn window_startCustomAnimationToEnterFullScreenOnScreen_withDuration(
&self,
window: &NSWindow,
screen: &NSScreen,
duration: NSTimeInterval,
)
Available on crate features NSResponder
and NSScreen
only.
unsafe 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.
Sourceunsafe fn windowDidFailToExitFullScreen(&self, window: &NSWindow)
Available on crate feature NSResponder
only.
unsafe 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:
.
Sourceunsafe fn window_willResizeForVersionBrowserWithMaxPreferredSize_maxAllowedSize(
&self,
window: &NSWindow,
max_preferred_frame_size: NSSize,
max_allowed_frame_size: NSSize,
) -> NSSize
Available on crate feature NSResponder
only.
unsafe 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.
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.
Sourceunsafe fn previewRepresentableActivityItemsForWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>
Available on crate features NSPreviewRepresentingActivityItem
and NSResponder
only.
unsafe fn previewRepresentableActivityItemsForWindow( &self, window: &NSWindow, ) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>
NSPreviewRepresentingActivityItem
and NSResponder
only.Preview representable activity items, used for sharing and collaboration.
Sourceunsafe fn windowForSharingRequestFromWindow(
&self,
window: &NSWindow,
) -> Option<Retained<NSWindow>>
Available on crate feature NSResponder
only.
unsafe 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