Developer Documentation
PATH  Mac OS X Documentation > Application Kit Reference: Objective-C

Table of Contents

NSBrowserCell


Inherits from:
NSCell : NSObject
Conforms to:
NSCoding
(NSCell)
NSCopying (NSCell)
NSObject (NSObject)
Declared in:
AppKit/NSBrowserCell.h




Class Description


NSBrowserCell is the subclass of NSCell used by default to display data in the columns of an NSBrowser. (Each column contains an NSMatrix filled with NSBrowserCells.) An NSBrowserCell can be a leaf or branch cell. A branch cell displays an image indicating that, when the cell is clicked, the NSBrowser will display a new column of NSBrowserCells; branch cells are thus important to the display of hierarchical information typical of NSBrowsers. An NSBrowserCell can also be loaded or unloaded; loaded NSBrowserCells have their state set and are ready for display.

Many of NSBrowserCell's methods are designed to interact with NSBrowser and NSBrowser's delegate. The delegate implements methods for loading the NSCells in NSBrowser by setting their values and status. If your code needs access to a specific NSBrowserCell, you can use the NSBrowser method loadedCellAtRow:column:.

Because NSBrowserCells do not inherit from NSActionCell, they don't hold target and action values and thus don't participate in the target/action paradigm of the Application Kit. However, NSBrowser does allow you to specify a target and an action, and you can obtain the last selected NSBrowserCell by sending selectedCell to an NSBrowser.

You may find it useful to create a subclass of NSBrowserCell to alter its behavior and to enable it to work with and display the type of data you wish to represent. Use NSBrowser's setCellClass: or setCellPrototype: methods to have it use your subclass.

See the NSBrowser class specification for more details. In particular, the class description and the "Methods Implemented By the Delegate" (page 178) describe how the NSBrowser's delegate interacts with both NSBrowser and NSBrowserCells.




Method Types


Accessing graphic images
+ branchImage
+ highlightedBranchImage
- alternateImage
- setAlternateImage:
Setting state
- reset
- set
Determining cell attributes
- isLeaf
- setLeaf:
- isLoaded
- setLoaded:


Class Methods



branchImage

+ (NSImage *)branchImage

Returns the default image for branch NSBrowserCells (a right-pointing triangle). 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.

See Also: + highlightedBranchImage, - alternateImage, - setAlternateImage:



highlightedBranchImage

+ (NSImage *)highlightedBranchImage

Returns the default NSImage for branch NSBrowserCells that are highlighted (a lighter version of the image returned by branchImage). Override this method if you want a different image.

See Also: + branchImage, - alternateImage, - setAlternateImage:




Instance Methods



alternateImage

- (NSImage *)alternateImage

Returns this NSBrowserCell's image for the highlighted state or nil if no image is set.

See Also: - setAlternateImage:



isLeaf

- (BOOL)isLeaf

Returns whether the NSBrowserCell is a leaf or a branch cell. 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 NSBrowserCells. A leaf NSBrowserCell has no image, indicating that the user has reached a terminal piece of information; it doesn't point to additional information.

See Also: - setLeaf:



isLoaded

- (BOOL)isLoaded

Returns YES if all the NSBrowserCell's state has been set and the cell is ready to display.

See Also: - setLoaded:



reset

- (void)reset

Unhighlights the NSBrowserCell and sets its state to 0 (NO).

See Also: - set



set

- (void)set

Highlights the NSBrowserCell and sets its state to 1 (YES).

See Also: - reset



setAlternateImage:

- (void)setAlternateImage:(NSImage *)newAltImage

Sets this NSBrowserCell's image for the highlighted state, retaining the image. If newAltImage is nil, it removes the alternate image for the NSBrowserCell.

See Also: - alternateImage



setLeaf:

- (void)setLeaf:(BOOL)flag

Sets whether the NSBrowserCell is a leaf or a branch cell. 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 NSBrowserCells. A leaf NSBrowserCell has no image, indicating that the user has reached a terminal piece of information; it doesn't point to additional information.

See Also: - isLeaf



setLoaded:

- (void)setLoaded:(BOOL)flag

Sets whether the NSBrowserCell's state has been set to 1 (YES) and the cell is ready to display.

See Also: - isLoaded




Table of Contents