Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.5 and later. |
Declared in | NSPathControl.h |
The NSPathControlDelegate
optional protocol is implemented by the delegate of an NSPathControl
object to support dragging to and from the control.
– pathControl:shouldDragPathComponentCell:withPasteboard:
– pathControl:validateDrop:
– pathControl:acceptDrop:
Implement this method to accept previously validated contents dropped onto the control.
- (BOOL)pathControl:(NSPathControl *)pathControl acceptDrop:(id <NSDraggingInfo>)info
The path control that sent the message.
An object containing details about this dragging operation.
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.
NSPathControl.h
Implement this method to enable dragging from the control.
- (BOOL)pathControl:(NSPathControl *)pathControl shouldDragPathComponentCell:(NSPathComponentCell *)pathComponentCell withPasteboard:(NSPasteboard *)pasteboard
The path control that sent the message.
The path component cell from which the drag is beginning.
The pasteboard.
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.
NSPathControl.h
Implement this method to enable dragging onto the control.
- (NSDragOperation)pathControl:(NSPathControl *)pathControl validateDrop:(id <NSDraggingInfo>)info
The path control that sent the message.
An object containing details about this dragging operation.
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.
NSPathControl.h
Implement this method to customize the Open panel shown by a pop-up–style path.
- (void)pathControl:(NSPathControl *)pathControl willDisplayOpenPanel:(NSOpenPanel *)openPanel
The path control displaying the Open panel.
The Open panel to be displayed.
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.
NSPathControl.h
Implement this method to customize the menu of a pop-up–style path.
- (void)pathControl:(NSPathControl *)pathControl willPopUpMenu:(NSMenu *)menu
The path control displaying the pop-up menu.
The pop-up menu to be displayed.
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.
NSPathControl.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-11)