Mac Developer Library

Developer

QLPreviewPanelDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

QLPreviewPanelDelegate

Inheritance


Not Applicable

Import Statement


Swift

import Quartz

Objective-C

@import Quartz;

Availability


Available in OS X v10.6 and later.

QLPreviewPanelDelegate is the protocol for the delegate of the Quick Look preview panel (QLPreviewPanel) object.

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

  • Invoked by the preview panel when it receives an event it doesn't handle. This method is optional.

    Declaration

    Swift

    optional func previewPanel(_ panel: QLPreviewPanel!, handleEvent event: NSEvent!) -> Bool

    Objective-C

    - (BOOL)previewPanel:(QLPreviewPanel *)panel handleEvent:(NSEvent *)event

    Parameters

    panel

    The preview panel.

    event

    The event that the preview panel was not able to handle.

    Return Value

    YEStrue if the receiver handled the event, otherwise NOfalse.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • Returns the screen rectangle for a given preview item. This method is optional.

    Declaration

    Swift

    optional func previewPanel(_ panel: QLPreviewPanel!, sourceFrameOnScreenForPreviewItem item: QLPreviewItem!) -> NSRect

    Objective-C

    - (NSRect)previewPanel:(QLPreviewPanel *)panel sourceFrameOnScreenForPreviewItem:(id<QLPreviewItem>)item

    Parameters

    panel

    The preview panel.

    item

    The preview item for which the screen rectangle is required.

    Return Value

    The screen rectangle for the given preview item. Return NSZeroRect if there is no origin point (this will produce a fade of the panel).

    Discussion

    This method is invoked 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.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.

  • Returns the image to use for the transition zoom effect for a given item. This method is optional.

    Declaration

    Swift

    optional func previewPanel(_ panel: QLPreviewPanel!, transitionImageForPreviewItem item: QLPreviewItem!, contentRect contentRect: UnsafeMutablePointer<NSRect>) -> AnyObject!

    Objective-C

    - (id)previewPanel:(QLPreviewPanel *)panel transitionImageForPreviewItem:(id<QLPreviewItem>)item contentRect:(NSRect *)contentRect

    Parameters

    panel

    The preview panel.

    item

    The preview item for which the transition image is required.

    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).

    Return Value

    The image to use for the transition zoom effect for the item.

    Discussion

    This method is invoked when the preview panel opens or closes to provide a smooth transition when zooming.

    Import Statement

    Objective-C

    @import Quartz;

    Swift

    import Quartz

    Availability

    Available in OS X v10.6 and later.