pub unsafe trait NSPopoverDelegate: NSObjectProtocol + MainThreadOnly {
// Provided methods
unsafe fn popoverShouldClose(&self, popover: &NSPopover) -> bool
where Self: Sized + Message { ... }
unsafe fn popoverShouldDetach(&self, popover: &NSPopover) -> bool
where Self: Sized + Message { ... }
unsafe fn popoverDidDetach(&self, popover: &NSPopover)
where Self: Sized + Message { ... }
unsafe fn detachableWindowForPopover(
&self,
popover: &NSPopover,
) -> Option<Retained<NSWindow>>
where Self: Sized + Message { ... }
unsafe fn popoverWillShow(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn popoverDidShow(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn popoverWillClose(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
unsafe fn popoverDidClose(&self, notification: &NSNotification)
where Self: Sized + Message { ... }
}
NSPopover
only.Expand description
Provided Methods§
Sourceunsafe fn popoverShouldClose(&self, popover: &NSPopover) -> bool
Available on crate feature NSResponder
only.
unsafe fn popoverShouldClose(&self, popover: &NSPopover) -> bool
NSResponder
only.The popover invokes this method on its delegate whenever it is about to close to give the delegate a chance to veto the close.
If the delegate does not implement this method,
-popoverShouldClose:
will also be invoked on the popover to allow the popover to veto the close.
Returns: Return YES if the popover should close, NO otherwise.
Sourceunsafe fn popoverShouldDetach(&self, popover: &NSPopover) -> bool
Available on crate feature NSResponder
only.
unsafe fn popoverShouldDetach(&self, popover: &NSPopover) -> bool
NSResponder
only.Return
YES
to allow the popover to detach from its positioning view. Return
NO
if it should not. If this method is not implemented, the default behavior is
NO.
If this method returns YES, and
-detachableWindowForPopover:
is not implemented or returns nil, a detachable window will be created with the popover’s
contentViewController.
This implicit detached window will have the same appearance as the popover. If the
contentViewController
has a title, it will be bound to and displayed as the title of the detached window. Upon being released in a detached state, the popover will call
-popoverDidDetach:
on the delegate. Once the detached popover is closed, PopoverShould/Will/DidClose delegate calls and notifications will be sent with the reason
NSPopoverCloseReasonStandard.
Parameter popover
: The popover that may be detached
Returns: YES if the popover should detach, whether to a custom window or the implicitly detached window. NO if not.
Sourceunsafe fn popoverDidDetach(&self, popover: &NSPopover)
Available on crate feature NSResponder
only.
unsafe fn popoverDidDetach(&self, popover: &NSPopover)
NSResponder
only.This is called when the popover has been released in an implicitly detached state, i.e. not when detached to a custom window returned from
-detachableWindowForPopover:.
Parameter popover
: The popover that detached from its anchor view and is not closing.
Sourceunsafe fn detachableWindowForPopover(
&self,
popover: &NSPopover,
) -> Option<Retained<NSWindow>>
Available on crate features NSResponder
and NSWindow
only.
unsafe fn detachableWindowForPopover( &self, popover: &NSPopover, ) -> Option<Retained<NSWindow>>
NSResponder
and NSWindow
only.Return a custom window to which the popover should be detached. This should be used when the content of the detached window is wanted to be different from the content of the popover. If the same content should be used in the detached window, only
-popoverShouldDetach:
needs to be implemented.
If implementing this method, you should not remove the popover’s content view as part of your implementation of this method. The popover and the detachable window may be shown at the same time and therefore cannot share a content view (or a content view controller). If the popover and the detachable window should have the same content, you should define the content in a separate nib file and use a view controller to instantiate separate copies of the content for the popover and the detachable window. The popover will animate to appear as though it morphs into the detachable window (unless the animates property is set to NO. The exact animation used is not guaranteed). Subclasses of NSPopover may also implement this method, in which case the subclass method will be invoked only if the delegate does not implement the method.
Not implementing this method, and just returning YES to
-popoverShouldDetach:
is recommended over providing a custom window.
If
-popoverShouldDetach:
is not overridden or returns NO, this method will not be called and the popover will not be detachable.
Parameter popover
: The popover that is being detached
Returns: The custom window to detach to.
Sourceunsafe fn popoverWillShow(&self, notification: &NSNotification)
unsafe fn popoverWillShow(&self, notification: &NSNotification)
Invoked on the delegate when the NSPopoverWillShowNotification notification is sent. This method will also be invoked on the popover.
Sourceunsafe fn popoverDidShow(&self, notification: &NSNotification)
unsafe fn popoverDidShow(&self, notification: &NSNotification)
Invoked on the delegate when the NSPopoverDidShowNotification notification is sent. This method will also be invoked on the popover.
Sourceunsafe fn popoverWillClose(&self, notification: &NSNotification)
unsafe fn popoverWillClose(&self, notification: &NSNotification)
Invoked on the delegate when the NSPopoverWillCloseNotification notification is sent. This method will also be invoked on the popover.
Sourceunsafe fn popoverDidClose(&self, notification: &NSNotification)
unsafe fn popoverDidClose(&self, notification: &NSNotification)
Invoked on the delegate when the NSPopoverDidCloseNotification notification is sent. This method will also be invoked on the popover.