NSBrowserCell Class Reference

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

Overview

The NSBrowserCell class is the subclass of NSCell used by default to display data in the columns of an NSBrowser object. (Each column contains an NSMatrix filled with NSBrowserCell objects.)

The NSBrowserCell class implements the user interface of NSBrowser.

Tasks

Getting Browser Cell Information

Configuring Browser Cells

Managing Browser Cell State

Class Methods

branchImage

Returns the default image for branch cells in a browser.

+ (NSImage *)branchImage
Return Value

The default image used for branch NSBrowserCell objects. The default image is a right-pointing triangle.

Discussion

Override this method if you want a different image. To have a branch NSBrowserCell with no image (and no space reserved for an image), override this method to return nil.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSBrowserCell.h

highlightedBranchImage

Returns the default image for branch browser cells that are highlighted.

+ (NSImage *)highlightedBranchImage
Return Value

The default image used for branch NSBrowserCell objects that are highlighted. This is a lighter version of the image returned by branchImage.

Discussion

Override this method if you want a different image.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSBrowserCell.h

Instance Methods

alternateImage

Returns the receiver’s image for the highlighted state.

- (NSImage *)alternateImage
Return Value

The image used for the browser cell in its highlighted state or nil if no image is set.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSBrowserCell.h

highlightColorInView:

Returns the highlight color that the receiver wants to display.

- (NSColor *)highlightColorInView:(NSView *)controlView
Parameters
controlView

The view for which to return the highlight color.

Return Value

The highlight color.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSBrowserCell.h

image

Returns the receiver’s image.

- (NSImage *)image
Return Value

The image of the receiver or nil if no image is set.

Availability
  • Available in OS X v10.2 and later.
Declared In
NSBrowserCell.h

isLeaf

Returns whether the receiver is a leaf or a branch cell.

- (BOOL)isLeaf
Return Value

YES if the receiver is a leaf cell; otherwise NO.

Discussion

A branch NSBrowserCell has an image near its right edge indicating that more, hierarchically related information is available; when the user selects the cell, the NSBrowser displays a new column of NSBrowserCell objects. A leaf NSBrowserCell has no image, indicating that the user has reached a terminal piece of information; it doesn’t point to additional information.

Availability
  • Available in OS X v10.0 and later.
See Also
Declared In
NSBrowserCell.h

isLoaded

Returns a Boolean value indicating whether the cell is ready to display.

- (BOOL)isLoaded
Return Value

YES if the receiver’s state has been set and the cell is ready to display; otherwise NO.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSBrowserCell.h

reset

Unhighlights the receiver and unsets its state.

- (void)reset
Availability
  • Available in OS X v10.0 and later.
See Also
Declared In
NSBrowserCell.h

set

Highlights the receiver and sets its state.

- (void)set
Availability
  • Available in OS X v10.0 and later.
See Also
Declared In
NSBrowserCell.h

setAlternateImage:

Sets the receiver’s image for the highlighted state, retaining the image.

- (void)setAlternateImage:(NSImage *)newAltImage
Parameters
newAltImage

The new image for the browser cell in its highlighted state. If newAltImage is nil, it removes the alternate image for the receiver. newAltImage is drawn vertically centered on the left edge of the browser cell.

Note that newAltImage is drawn at the given size of the image. NSBrowserCell does not set the size of the image, nor does it clip the drawing of the image. Make sure newAltImage is the correct size for drawing in the browser cell.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSBrowserCell.h

setImage:

Sets the receiver’s image, retaining the image.

- (void)setImage:(NSImage *)newImage
Parameters
newImage

The new image. If newImage is nil, it removes the image for the receiver. newImage is drawn vertically centered on the left edge of the browser cell.

Note that newImage is drawn at the given size of the image. NSBrowserCell does not set the size of the image, nor does it clip the drawing of the image. Make sure newImage is the correct size for drawing in the browser cell.

Availability
  • Available in OS X v10.2 and later.
See Also
Declared In
NSBrowserCell.h

setLeaf:

Sets whether the receiver is a leaf or a branch cell.

- (void)setLeaf:(BOOL)flag
Parameters
flag

YES if the receiver is a leaf cell; otherwise NO.

Discussion

A branch NSBrowserCell has an image near its right edge indicating that more, hierarchically related information is available; when the user selects the cell, the NSBrowser displays a new column of NSBrowserCell objects. A leaf NSBrowserCell has no image, indicating that the user has reached a terminal piece of information; it doesn’t point to additional information.

Availability
  • Available in OS X v10.0 and later.
See Also
Related Sample Code
Declared In
NSBrowserCell.h

setLoaded:

Sets whether the receiver’s state has been set and the cell is ready to display.

- (void)setLoaded:(BOOL)flag
Parameters
flag

YES if the receiver’s state has been set and the cell is ready to display; otherwise NO.

Availability
  • Available in OS X v10.0 and later.
See Also
Declared In
NSBrowserCell.h