QLPreviewPanelDelegate

Trait QLPreviewPanelDelegate 

Source
pub unsafe trait QLPreviewPanelDelegate: NSWindowDelegate {
    // Provided methods
    unsafe fn previewPanel_handleEvent(
        &self,
        panel: Option<&QLPreviewPanel>,
        event: Option<&NSEvent>,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn previewPanel_sourceFrameOnScreenForPreviewItem(
        &self,
        panel: Option<&QLPreviewPanel>,
        item: Option<&ProtocolObject<dyn QLPreviewItem>>,
    ) -> NSRect
       where Self: Sized + Message { ... }
    unsafe fn previewPanel_transitionImageForPreviewItem_contentRect(
        &self,
        panel: Option<&QLPreviewPanel>,
        item: Option<&ProtocolObject<dyn QLPreviewItem>>,
        content_rect: *mut NSRect,
    ) -> Option<Retained<AnyObject>>
       where Self: Sized + Message { ... }
}
Available on crate features QLPreviewPanel and objc2-app-kit only.
Expand description

A protocol for the delegate of the Quick Look preview panel.

You can implement these methods to perform custom tasks in response to events in the preview panel.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn previewPanel_handleEvent( &self, panel: Option<&QLPreviewPanel>, event: Option<&NSEvent>, ) -> bool
where Self: Sized + Message,

Handles an event that the preview panel receives, but doesn’t handle.

The preview panel invokes this optional method when it receives an event it doesn’t handle.

  • Parameters:

  • panel: The preview panel.

  • event: The event that the preview panel wasn’t able to handle.

  • Returns: <doc ://com.apple.documentation/documentation/objectivec/yes> if the receiver handled the event; otherwise, <doc ://com.apple.documentation/documentation/objectivec/no>.

§Safety
  • panel might not allow None.
  • event might not allow None.
Source

unsafe fn previewPanel_sourceFrameOnScreenForPreviewItem( &self, panel: Option<&QLPreviewPanel>, item: Option<&ProtocolObject<dyn QLPreviewItem>>, ) -> NSRect
where Self: Sized + Message,

Available on crate feature QLPreviewItem only.

Returns the screen rectangle for a given preview item.

The system invokes this optional method when the preview panel opens or closes to provide a zoom effect. You should return — in screen coordinates — the rectangle that displays the specified preview item.

  • Parameters:

  • panel: The preview panel.

  • item: The preview item for which the screen rectangle is required.

  • Returns: The screen rectangle for the given preview item. Return <doc ://com.apple.documentation/documentation/foundation/nszerorect> if there is no origin point (this will produce a fade of the panel).

§Safety
  • panel might not allow None.
  • item might not allow None.
Source

unsafe fn previewPanel_transitionImageForPreviewItem_contentRect( &self, panel: Option<&QLPreviewPanel>, item: Option<&ProtocolObject<dyn QLPreviewItem>>, content_rect: *mut NSRect, ) -> Option<Retained<AnyObject>>
where Self: Sized + Message,

Available on crate feature QLPreviewItem only.

Returns the image to use for the transition zoom effect for a given item.

The system invokes this optional method when the preview panel opens or closes to provide a smooth transition when zooming. The return type of the function should be an instance of <doc ://com.apple.documentation/documentation/appkit/nsimage>.

  • Parameters:

  • panel: The preview panel.

  • item: The item the system is previewing.

  • contentRect: The rectangle within a preview image that actually represents the content of the document. For icons, the actual rectangle is typically smaller than the icon itself.

  • Returns: The image to use for the transition zoom effect for the item.

§Safety
  • panel might not allow None.
  • item might not allow None.
  • content_rect must be a valid pointer.

Trait Implementations§

Source§

impl ProtocolType for dyn QLPreviewPanelDelegate

Source§

const NAME: &'static str = "QLPreviewPanelDelegate"

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 QLPreviewPanelDelegate

Implementations on Foreign Types§

Source§

impl<T> QLPreviewPanelDelegate for ProtocolObject<T>

Implementors§