Mac Developer Library

Developer

AppKit Framework Reference NSDrawerDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSDrawerDelegate

Inheritance


Not Applicable

Conforms To


Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.6 and later.

The NSDrawerDelegate protocol defines the messages sent to delegates of NSDrawer. All of the methods of this protocol are optional.

  • Asks the delegate if the specified drawer should open.

    Declaration

    Swift

    optional func drawerShouldOpen(_ sender: NSDrawer) -> Bool

    Objective-C

    - (BOOL)drawerShouldOpen:(NSDrawer *)sender

    Parameters

    sender

    The drawer requesting permission to open.

    Return Value

    YEStrue if the drawer should open; NOfalse to prevent the drawer from opening.

    Discussion

    This method is invoked on user-initiated attempts to open a drawer by dragging it or when the open: method is called.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Notifies the delegate that the drawer will open.

    Declaration

    Swift

    optional func drawerWillOpen(_ notification: NSNotification)

    Objective-C

    - (void)drawerWillOpen:(NSNotification *)notification

    Parameters

    notification

    An NSDrawerWillOpenNotification notification, sent by the default notification center immediately before the drawer is opened.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Notifies the delegate that the drawer has opened.

    Declaration

    Swift

    optional func drawerDidOpen(_ notification: NSNotification)

    Objective-C

    - (void)drawerDidOpen:(NSNotification *)notification

    Parameters

    notification

    An NSDrawerDidOpenNotification notification, sent by the default notification center immediately after the drawer has opened.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Asks the delegate if the specified drawer should close.

    Declaration

    Swift

    optional func drawerShouldClose(_ sender: NSDrawer) -> Bool

    Objective-C

    - (BOOL)drawerShouldClose:(NSDrawer *)sender

    Parameters

    sender

    The drawer being closed.

    Return Value

    YEStrue to allow the drawer to close; NOfalse to prevent it from closing.

    Discussion

    This method is invoked on user-initiated attempts to close a drawer by dragging it or when the close: method is called.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Notifies the delegate the the drawer will close.

    Declaration

    Swift

    optional func drawerWillClose(_ notification: NSNotification)

    Objective-C

    - (void)drawerWillClose:(NSNotification *)notification

    Parameters

    notification

    An NSDrawerWillCloseNotification notification sent by the default notification center immediately before the drawer is closed.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Notifies the delegate that the drawer has closed.

    Declaration

    Swift

    optional func drawerDidClose(_ notification: NSNotification)

    Objective-C

    - (void)drawerDidClose:(NSNotification *)notification

    Parameters

    notification

    An NSDrawerDidCloseNotification notification sent by the default notification center immediately after the drawer has closed.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • Invoked when the user resizes the drawer or parent.

    Declaration

    Swift

    optional func drawerWillResizeContents(_ sender: NSDrawer, toSize contentSize: NSSize) -> NSSize

    Objective-C

    - (NSSize)drawerWillResizeContents:(NSDrawer *)sender toSize:(NSSize)contentSize

    Parameters

    sender

    The drawer being resized.

    contentSize

    The proposed new size of the drawer.

    Return Value

    The size that the drawer should be resized to. To resize to a different size, simply return the desired size from this method; to avoid resizing, return the current size.

    Discussion

    The receiver’s minimum and maximum size constraints have already been applied when this method is invoked. While the user is resizing an NSDrawer or its parent, the delegate is sent a series of windowWillResize messages as the NSDrawer or parent window is dragged.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

    Available as part of an informal protocol prior to OS X v10.6.