Next Page > Hide TOC

NSPathControlDelegate Protocol Reference

Conforms to
Framework
/System/Library/Frameworks/AppKit.framework
Availability
Available in Mac OS X v10.5 and later.
Declared in
NSPathControl.h

Overview

The NSPathControlDelegate optional protocol is implemented by the delegate of an NSPathControl object to support dragging to and from the control.

Tasks

Dragging Support

Customizing a Pop-Up–Style Path

Instance Methods

pathControl:acceptDrop:

Implement this method to accept previously validated contents dropped onto the control.

- (BOOL)pathControl:(NSPathControl *)pathControl acceptDrop:(id <NSDraggingInfo>)info

Parameters
pathControl

The path control that sent the message.

info

An object containing details about this dragging operation.

Discussion

In order to accept the dropped contents previously accepted from pathControl:validateDrop:, you must implement this method. This method is called from performDragOperation:. You should change the URL value based on the dragged information.

If not implemented, and the control's cell is editable, the drop is accepted if it contains an NSURLPboardType or NSFilenamesPboardType that conforms to the cell’s allowed types. The cell's URL value is automatically changed, and the action is invoked. Implementation of this method is optional.

Availability
Declared In
NSPathControl.h

pathControl:shouldDragPathComponentCell:withPasteboard:

Implement this method to enable dragging from the control.

- (BOOL)pathControl:(NSPathControl *)pathControl shouldDragPathComponentCell:(NSPathComponentCell *)pathComponentCell withPasteboard:(NSPasteboard *)pasteboard

Parameters
pathControl

The path control that sent the message.

pathComponentCell

The path component cell from which the drag is beginning.

pasteboard

The pasteboard.

Discussion

This method is called when a drag is about to begin. You can refuse to allow the drag to happen by returning NO and allow it by returning YES. By default, the pasteboard automatically has the following types on it: NSStringPboardType, NSURLPboardType (if there is a URL value for the cell being dragged), and NSFilenamesPboardType (if the URL value returns YES from -isFileURL). You can customize the types placed on the pasteboard at this time, if desired. Implementation of this method is optional.

Availability
Declared In
NSPathControl.h

pathControl:validateDrop:

Implement this method to enable dragging onto the control.

- (NSDragOperation)pathControl:(NSPathControl *)pathControl validateDrop:(id <NSDraggingInfo>)info

Parameters
pathControl

The path control that sent the message.

info

An object containing details about this dragging operation.

Discussion

This method is called when something is dragged over the control. Return NSDragOperationNone to refuse the drop, or return anything else to accept it.

If not implemented, and the control's cell is editable, the drop is accepted if it contains an NSURLPboardType or NSFilenamesPboardType that conforms to the cell’s allowed types. Implementation of this method is optional.

Availability
Declared In
NSPathControl.h

pathControl:willDisplayOpenPanel:

Implement this method to customize the Open panel shown by a pop-up–style path.

- (void)pathControl:(NSPathControl *)pathControl willDisplayOpenPanel:(NSOpenPanel *)openPanel

Parameters
pathControl

The path control displaying the Open panel.

openPanel

The Open panel to be displayed.

Discussion

This method is called before the Open panel is shown but after its allowed file types are set to the cell's allowed types. At this time, you can further customize the Open panel as required. This method is called only when the style is set to NSPathStylePopUp. Implementation of this method is optional.

Availability
Declared In
NSPathControl.h

pathControl:willPopUpMenu:

Implement this method to customize the menu of a pop-up–style path.

- (void)pathControl:(NSPathControl *)pathControl willPopUpMenu:(NSMenu *)menu

Parameters
pathControl

The path control displaying the pop-up menu.

menu

The pop-up menu to be displayed.

Discussion

This method is called before the pop-up menu is shown. At this time, you can further customize the menu as required, adding and removing items. This method is called only when the style is set to NSPathStylePopUp. Implementation of this method is optional.

Availability
Declared In
NSPathControl.h

Next Page > Hide TOC


© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-11)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.