NSDrawerDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in OS X v10.6 and later.
Companion guide
Declared in
NSDrawer.h
Related sample code

Overview

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

Tasks

Opening and Closing Drawers

Managing Drawer Size

Instance Methods

drawerDidClose:

Notifies the delegate that the drawer has closed.

- (void)drawerDidClose:(NSNotification *)notification
Parameters
notification

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

Availability
  • Available in OS X v10.0 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSDrawer.h

drawerDidOpen:

Notifies the delegate that the drawer has opened.

- (void)drawerDidOpen:(NSNotification *)notification
Parameters
notification

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

Availability
  • Available in OS X v10.0 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSDrawer.h

drawerShouldClose:

Asks the delegate if the specified drawer should close.

- (BOOL)drawerShouldClose:(NSDrawer *)sender
Parameters
sender

The drawer being closed.

Return Value

YES to allow the drawer to close; NO 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.

Availability
  • Available in OS X v10.0 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSDrawer.h

drawerShouldOpen:

Asks the delegate if the specified drawer should open.

- (BOOL)drawerShouldOpen:(NSDrawer *)sender
Parameters
sender

The drawer requesting permission to open.

Return Value

YES if the drawer should open; NO 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.

Availability
  • Available in OS X v10.0 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSDrawer.h

drawerWillClose:

Notifies the delegate the the drawer will close.

- (void)drawerWillClose:(NSNotification *)notification
Parameters
notification

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

Availability
  • Available in OS X v10.0 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSDrawer.h

drawerWillOpen:

Notifies the delegate that the drawer will open.

- (void)drawerWillOpen:(NSNotification *)notification
Parameters
notification

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

Availability
  • Available in OS X v10.0 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSDrawer.h

drawerWillResizeContents:toSize:

Invoked when the user resizes the drawer or parent.

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

Availability
  • Available in OS X v10.0 and later.
  • Available as part of an informal protocol prior to OS X v10.6.
Declared In
NSDrawer.h