Trait NSWindowDelegate

Source
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 { ... }
}
Available on crate feature NSWindow only.
Expand description

Provided Methods§

Source

unsafe fn windowShouldClose(&self, sender: &NSWindow) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn windowWillReturnFieldEditor_toObject( &self, sender: &NSWindow, client: Option<&AnyObject>, ) -> Option<Retained<AnyObject>>
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn windowWillResize_toSize( &self, sender: &NSWindow, frame_size: NSSize, ) -> NSSize
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn windowWillUseStandardFrame_defaultFrame( &self, window: &NSWindow, new_frame: NSRect, ) -> NSRect
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn windowShouldZoom_toFrame( &self, window: &NSWindow, new_frame: NSRect, ) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn windowWillReturnUndoManager( &self, window: &NSWindow, ) -> Option<Retained<NSUndoManager>>
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn window_willPositionSheet_usingRect( &self, window: &NSWindow, sheet: &NSWindow, rect: NSRect, ) -> NSRect
where Self: Sized + Message,

Available on crate feature 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.

Source

unsafe fn window_shouldPopUpDocumentPathMenu( &self, window: &NSWindow, menu: &NSMenu, ) -> bool
where Self: Sized + Message,

Available on crate features 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 NOwill prevent the menu from being shown. A return of YESwill 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 representedURLhas 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.

Source

unsafe fn window_shouldDragDocumentWithEvent_from_withPasteboard( &self, window: &NSWindow, event: &NSEvent, drag_image_location: NSPoint, pasteboard: &NSPasteboard, ) -> bool
where Self: Sized + Message,

Available on crate features NSEvent and NSPasteboard and NSResponder only.

The window delegate may implement -window:shouldDragDocumentWithEvent:from:withPasteboard: to override NSWindowdocument 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.

Source

unsafe fn window_willUseFullScreenContentSize( &self, window: &NSWindow, proposed_size: NSSize, ) -> NSSize
where Self: Sized + Message,

Available on crate feature NSResponder only.
Source

unsafe fn window_willUseFullScreenPresentationOptions( &self, window: &NSWindow, proposed_options: NSApplicationPresentationOptions, ) -> NSApplicationPresentationOptions
where Self: Sized + Message,

Available on crate features NSApplication and NSResponder only.
Source

unsafe fn customWindowsToEnterFullScreenForWindow( &self, window: &NSWindow, ) -> Option<Retained<NSArray<NSWindow>>>
where Self: Sized + Message,

Available on crate feature 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.

Source

unsafe fn window_startCustomAnimationToEnterFullScreenWithDuration( &self, window: &NSWindow, duration: NSTimeInterval, )
where Self: Sized + Message,

Available on crate feature 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.

Source

unsafe fn windowDidFailToEnterFullScreen(&self, window: &NSWindow)
where Self: Sized + Message,

Available on crate feature 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:.

Source

unsafe fn customWindowsToExitFullScreenForWindow( &self, window: &NSWindow, ) -> Option<Retained<NSArray<NSWindow>>>
where Self: Sized + Message,

Available on crate feature 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.

Source

unsafe fn window_startCustomAnimationToExitFullScreenWithDuration( &self, window: &NSWindow, duration: NSTimeInterval, )
where Self: Sized + Message,

Available on crate feature 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.

Source

unsafe fn customWindowsToEnterFullScreenForWindow_onScreen( &self, window: &NSWindow, screen: &NSScreen, ) -> Option<Retained<NSArray<NSWindow>>>
where Self: Sized + Message,

Available on crate features NSResponder and NSScreen only.

-customWindowsToEnterFullScreenForWindow:onScreen: will be called in place of -customWindowsToEnterFullScreenForWindow: if both are implemented.

Source

unsafe fn window_startCustomAnimationToEnterFullScreenOnScreen_withDuration( &self, window: &NSWindow, screen: &NSScreen, duration: NSTimeInterval, )
where Self: Sized + Message,

Available on crate features NSResponder and NSScreen only.

-window:startCustomAnimationToEnterFullScreenOnScreen:withDuration: will be called in place of -window:startCustomAnimationToEnterFullScreenWithDuration: if both are implemented.

Source

unsafe fn windowDidFailToExitFullScreen(&self, window: &NSWindow)
where Self: Sized + Message,

Available on crate feature 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:.

Source

unsafe fn window_willResizeForVersionBrowserWithMaxPreferredSize_maxAllowedSize( &self, window: &NSWindow, max_preferred_frame_size: NSSize, max_allowed_frame_size: NSSize, ) -> NSSize
where Self: Sized + Message,

Available on crate feature 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 maxAllowedSizewill 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.

Source

unsafe fn window_willEncodeRestorableState( &self, window: &NSWindow, state: &NSCoder, )
where Self: Sized + Message,

Available on crate feature 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.

Source

unsafe fn window_didDecodeRestorableState( &self, window: &NSWindow, state: &NSCoder, )
where Self: Sized + Message,

Available on crate feature 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.

Source

unsafe fn previewRepresentableActivityItemsForWindow( &self, window: &NSWindow, ) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>
where Self: Sized + Message,

Available on crate features NSPreviewRepresentingActivityItem and NSResponder only.

Preview representable activity items, used for sharing and collaboration.

Source

unsafe fn windowForSharingRequestFromWindow( &self, window: &NSWindow, ) -> Option<Retained<NSWindow>>
where Self: Sized + Message,

Available on crate feature 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

Source

unsafe fn windowDidResize(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidExpose(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowWillMove(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidMove(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidBecomeKey(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidResignKey(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidBecomeMain(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidResignMain(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowWillClose(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowWillMiniaturize(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidMiniaturize(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidDeminiaturize(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidUpdate(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidChangeScreen(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidChangeScreenProfile(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidChangeBackingProperties(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowWillBeginSheet(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidEndSheet(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowWillStartLiveResize(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidEndLiveResize(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowWillEnterFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidEnterFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowWillExitFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidExitFullScreen(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowWillEnterVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidEnterVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowWillExitVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidExitVersionBrowser(&self, notification: &NSNotification)
where Self: Sized + Message,

Source

unsafe fn windowDidChangeOcclusionState(&self, notification: &NSNotification)
where Self: Sized + Message,

Trait Implementations§

Source§

impl ProtocolType for dyn NSWindowDelegate

Source§

const NAME: &'static str = "NSWindowDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn NSWindowDelegate

Implementations on Foreign Types§

Source§

impl<T> NSWindowDelegate for ProtocolObject<T>
where T: ?Sized + NSWindowDelegate,

Implementors§