| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.5 and later. |
| Declared in | NSPathCell.h |
NSPathCell implements the user interface of an NSPathControl object. It maintains a collection of NSPathComponentCell objects that represent a particular path to be displayed to the user.
– placeholderAttributedString
– setPlaceholderAttributedString:
– setPlaceholderString:
– placeholderString
– setBackgroundColor:
– backgroundColor
+ pathComponentCellClass
– rectOfPathComponentCell:withFrame:inView:
– pathComponentCellAtPoint:withFrame:inView:
– clickedPathComponentCell
– pathComponentCells
– setPathComponentCells:
Returns the class used to create pathComponentCell objects when automatically filling up the control.
+ (Class)pathComponentCellClass;
The class used to create NSPathComponentCell objects.
Subclasses can override this method to return a custom cell class that is automatically used. By default, the method returns [NSPathComponentCell class], or a specialized subclass thereof.
NSPathCell.hReturns the component types allowed in the path when the cell is editable.
- (NSArray *)allowedTypes;
An array of strings representing either file extensions or UTIs. Can be nil, the default value, allowing all types, or an empty array, allowing nothing.
NSPathCell.hReturns the current background color of the receiver.
- (NSColor *)backgroundColor
The background color.
NSPathCell.hReturns the clicked cell.
- (NSPathComponentCell *)clickedPathComponentCell
The component cell that was clicked, or nil, if no cell has been clicked.
The value returned is generally valid only when the action or double-click action is being sent.
NSPathCell.hReturns the receiver’s delegate.
- (id)delegate
The receiver’s delegate.
NSPathCell.hReturns the receiver’s double-click action method.
- (SEL)doubleAction
The action method invoked when the user double-clicks the receiver.
NSPathCell.hDisplays the cell component over which the mouse is hovering.
- (void)mouseEntered:(NSEvent *)event withFrame:(NSRect)frame inView:(NSView *)view;
The mouse-entered event.
The frame in which the cell is located.
The view in which the cell is located.
The NSPathCell object dynamically animates to display the component that the mouse is hovering over using mouse-entered and mouse-exited events. The control should call these methods to correctly display the hovered component to the user. The control can acquire rectangles to track using rectOfPathComponentCell:withFrame:inView:.
NSPathCell.hHides the cell component over which the mouse is hovering.
- (void)mouseExited:(NSEvent *)event withFrame:(NSRect)frame inView:(NSView *)view;
The mouse-exited event.
The frame in which the cell is located.
The view in which the cell is located.
NSPathCell.hReturns the cell located at the given point within the given frame of the given view.
- (NSPathComponentCell *)pathComponentCellAtPoint:(NSPoint)point withFrame:(NSRect)frame inView:(NSView *)view;
The point within the returned cell.
The frame within which the point is located.
The view within which the frame is located.
The component cell within which the given point is located, or nil if no cell exists at that location.
NSPathCell.hReturns an array of the NSPathComponentCell objects currently being displayed.
- (NSArray *)pathComponentCells
The array of NSPathComponentCell objects.
NSPathCell.hReturns the receiver’s path style.
- (NSPathStyle)pathStyle
The style of the path.
– setPathStyle:NSPathCell.hReturns the placeholder attributed string.
- (NSAttributedString *)placeholderAttributedString;
The placeholder attributed string.
If the NSPathCell object contains no NSPathComponentCell objects, the placeholder attributed string is drawn in their place, if it is not nil. If the placeholder attributed string is nil, the (non-attributed) placeholder string is drawn with default attributes, if it is not nil.
NSPathCell.hReturns the placeholder string.
- (NSString *)placeholderString;
The placeholder string.
If the NSPathCell object contains no NSPathComponentCell objects, the placeholder attributed string is drawn in their place, if it is not nil. If the placeholder attributed string is nil, the (non-attributed) placeholder string is drawn with default attributes, if it is not nil.
NSPathCell.hReturns the current rectangle being displayed for a given path component cell, with respect to a given frame in a given view.
- (NSRect)rectOfPathComponentCell:(NSPathComponentCell *)cell withFrame:(NSRect)frame inView:(NSView *)view;
The path component cell.
The frame of the view in which the cell appears.
The view in which the cell appears.
The rectangle occupied by the path component cell. NSZeroRect is returned if cell is not found or is not currently visible.
NSPathCell.hSets the component types allowed in the path when the cell is editable.
- (void)setAllowedTypes:(NSArray *)allowedTypes;
An array of strings representing either file extensions or UTIs. Can be nil, the default value, allowing all types.
The allowedTypes array can contain file extensions (without the period that begins the extension) or UTIs. To allow folders, include the public.folder identifier. To allow any type, use nil. If the value of allowedTypes is an empty array, nothing is allowed. The default value is nil, allowing all types.
If the cell is editable and its type is NSPathStylePopUp, a Choose item is included to enable selection of a different path by invoking an Open panel. The allowed types are passed to the Open panel to filter out other types. The allowed types are also used with drag and drop to indicate if a drop is allowed.
NSPathCell.hSets the receiver’s background color.
- (void)setBackgroundColor:(NSColor *)color
The color to be drawn.
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.
NSPathCell.hSets the receiver’s control size.
- (void)setControlSize:(NSControlSize)size
The new control size.
NSPathCell properly respects the control size for the NSPathStyleStandard and NSPathStylePopUp styles. When the control size is set, the new size is propagated to subcells. When the path style is set to NSPathStyleNavigationBar, you cannot change the control size, and it is always set to NSSmallControlSize. Attempting to change the control size when the path style is NSPathStyleNavigationBar causes an assertion. Setting the path style to NSPathStyleNavigationBar forces the control size to be NSSmallControlSize.
NSPathCell.hSets the receiver’s delegate.
- (void)setDelegate:(id)delegate
the object to set as the receiver’s delegate.
NSPathCell.hSets the receiver’s double-click action.
- (void)setDoubleAction:(SEL)action
The action method to invoke when the receiver is double-clicked.
NSPathCell.hSets the receiver’s object value.
- (void)setObjectValue:(id <NSCopying>)obj;
The new object value for the cell.
If setObjectValue: is called with an NSURL object, setURL: is automatically called. The objectValue method returns the most recently set URL value. The setObjectValue: method can also take a string value, with the items separated by the path separator (/). Any other value is a programming error and will cause an assertion.
NSPathCell.hSets 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].
NSPathCell.hSets the receiver’s path style.
- (void)setPathStyle:(NSPathStyle)style
The new path style.
See setControlSize: for information about path style and control size dependencies.
NSPathCell.hSets the value of the placeholder attributed string.
- (void)setPlaceholderAttributedString:(NSAttributedString *)string;
The string to set for the placeholder attributed string.
If the NSPathCell object contains no NSPathComponentCell objects, the placeholder attributed string is drawn in their place, if it is not nil. If the placeholder attributed string is nil, the (non-attributed) placeholder string is drawn with default attributes, if it is not nil.
NSPathCell.hSets the value of the placeholder string.
- (void)setPlaceholderString:(NSString *)string;
The string to set for the placeholder.
If the NSPathCell object contains no NSPathComponentCell objects, the placeholder attributed string is drawn in their place, if it is not nil. If the placeholder attributed string is nil, the (non-attributed) placeholder string is drawn with default attributes, if it is not nil.
NSPathCell.hSets the value of the path 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. The type of NSPathComponentCell objects created can be controlled by subclassing NSPathCell and overriding pathComponentCellClass.
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.
Para
NSPathCell.hReturns the path displayed by the receiver.
- (NSURL *)URL
The path value.
NSPathCell.hNSPathStyle constants represent the different visual and behavioral styles an NSPathControl or NSPathCell object can have.
enum {
NSPathStyleStandard,
NSPathStyleNavigationBar,
NSPathStylePopUp,
};
typedef NSInteger NSPathStyle;
NSPathStyleStandardThe standard display style and behavior. All path component cells are displayed with an icon image and component name. If the path can not fully be displayed, the middle parts are truncated as required.
Available in Mac OS X v10.5 and later.
Declared in NSPathCell.h.
NSPathStyleNavigationBarThe navigation bar display style and behavior. Similar to the NSPathStyleStandard with the navigation bar drawing style. Also known as the breadcrumb style.
Available in Mac OS X v10.5 and later.
Declared in NSPathCell.h.
NSPathStylePopUpThe pop-up display style and behavior. Only the last path component is displayed with an icon image and component name. The full path is shown when the user clicks on the cell. If the cell is editable, a Choose item is included to enable selecting a different path.
Available in Mac OS X v10.5 and later.
Declared in NSPathCell.h.
NSPathCell.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-11)