Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.5 and later. |
Declared in | NSPathControl.h |
Related sample code |
NSPathControl
is a subclass of NSControl
that represents a file system path or virtual path.
The NSPathControl
class uses NSPathCell
to implement its user interface. NSPathControl
provides cover methods for most NSPathCell
methods—the cover method simply invokes the corresponding cell method. See also NSPathComponentCell
, which represents individual components of the path, and two associated protocols: NSPathCellDelegate
and NSPathControlDelegate
.
NSPathControl
has three styles represented by the NSPathStyle
enumeration constants NSPathStyleStandard
, NSPathStyleNavigationBar
, and NSPathStylePopUp
. The represented path can be a file system path or any other type of path leading through a sequence of nodes or components, as defined by the programmer.
NSPathControl
automatically supports drag and drop, which can be further customized via delegate methods. To accept drag and drop, NSPathControl
calls registerForDraggedTypes:
with NSFilenamesPboardType
and NSURLPboardType
. When the URL value in the NSPathControl
object changes because of an automatic drag and drop operation or the user selecting a new path via the open panel, the action is sent, but the value returned by clickedPathComponentCell
is nil
.
Returns the current background color of the receiver.
- (NSColor *)backgroundColor
The background color.
NSPathControl.h
Returns the clicked cell, or nil
, if no cell was clicked.
- (NSPathComponentCell *)clickedPathComponentCell
The component cell that was clicked.
The value returned is generally valid only when the action or double action is being sent.
NSPathControl.h
Returns the receiver’s delegate.
- (id)delegate
The receiver’s delegate.
NSPathControl.h
Returns the receiver’s double-click action method.
- (SEL)doubleAction
The action method invoked when the user double-clicks the receiver.
NSPathControl.h
Returns an array of the NSPathComponentCell
objects currently being displayed.
- (NSArray *)pathComponentCells
The array of NSPathComponentCell
objects.
NSPathControl.h
Returns the receiver’s path style.
- (NSPathStyle)pathStyle
The style of the path control.
NSPathControl.h
Sets the receiver’s background color.
- (void)setBackgroundColor:(NSColor *)color
The color to draw.
By default, the background is set to a light blue color for NSPathStyleStandard
and nil
for the other styles. You can use [NSColor clearColor]
to make the background transparent.
NSPathControl.h
Sets the receiver’s delegate.
- (void)setDelegate:(id)delegate
The object to set as the receiver’s delegate.
NSPathControl.h
Sets the receiver’s double-click action.
- (void)setDoubleAction:(SEL)action
The action method to invoke when the receiver is double-clicked.
NSPathControl.h
Configures the default value returned from draggingSourceOperationMaskForLocal:
.
- (void)setDraggingSourceOperationMask:(NSDragOperation)mask forLocal:(BOOL)isLocal
The types of drag operations allowed.
If YES
, mask applies when the drag destination object is in the same application as the receiver; if NO
, mask applies when the destination object is outside the receiver’s application.
By default, draggingSourceOperationMaskForLocal:
returns NSDragOperationEvery
when isLocal is YES
and NSDragOperationNone
when isLocal is NO
.
NSPathControl.h
Sets the array of NSPathComponentCell
objects currently being displayed.
- (void)setPathComponentCells:(NSArray *)cells
An array of NSPathComponentCell
objects.
Each item in the array must be an instance of NSPathComponentCell
or a subclass thereof. You cannot set this value to nil
, but you can set it to an empty array using, for example, [NSArray array]
.
NSPathControl.h
Sets the receiver’s path style.
- (void)setPathStyle:(NSPathStyle)style
The new path style.
NSPathControl.h
Sets the path value displayed by the receiver.
- (void)setURL:(NSURL *)url
The new path value to display.
When setting, an array of NSPathComponentCell
objects is automatically set based on the path in url. If url is a file URL (returns YES
from isFileURL
), the images are automatically filled with file icons, if the path exists. The URL value itself is stored in the objectValue
property of the cell.
NSPathControl.h
Returns the path value displayed by the receiver.
- (NSURL *)URL
The path value.
NSPathControl.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-11)