Trait NSPopoverDelegate

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

Provided Methods§

Source

unsafe fn popoverShouldClose(&self, popover: &NSPopover) -> bool
where Self: Sized + Message,

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

Source

unsafe fn popoverShouldDetach(&self, popover: &NSPopover) -> bool
where Self: Sized + Message,

Available on crate feature NSResponder only.

Return YESto allow the popover to detach from its positioning view. Return NOif 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 contentViewControllerhas 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.

Source

unsafe fn popoverDidDetach(&self, popover: &NSPopover)
where Self: Sized + Message,

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

Source

unsafe fn detachableWindowForPopover( &self, popover: &NSPopover, ) -> Option<Retained<NSWindow>>
where Self: Sized + Message,

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

Source

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

Invoked on the delegate when the NSPopoverWillShowNotification notification is sent. This method will also be invoked on the popover.

Source

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

Invoked on the delegate when the NSPopoverDidShowNotification notification is sent. This method will also be invoked on the popover.

Source

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

Invoked on the delegate when the NSPopoverWillCloseNotification notification is sent. This method will also be invoked on the popover.

Source

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

Invoked on the delegate when the NSPopoverDidCloseNotification notification is sent. This method will also be invoked on the popover.

Trait Implementations§

Source§

impl ProtocolType for dyn NSPopoverDelegate

Source§

const NAME: &'static str = "NSPopoverDelegate"

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 NSPopoverDelegate

Implementations on Foreign Types§

Source§

impl<T> NSPopoverDelegate for ProtocolObject<T>

Implementors§