Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.

NXBrowserCell



Inherits From: Cell : Object
Declared In: appkit/NXBrowserCell.h



Class Description

NXBrowserCell is the subclass of Cell used by default to display data in the column Matrices of NXBrowser.  Many of NXBrowserCell's methods are designed to interact with NXBrowser and NXBrowser's delegate.  The delegate implements methods for loading the Cells in NXBrowser by setting their values and status.  If your code needs access to a specific NXBrowserCell, you can use the NXBrowser method getLoadedCellAtRow:inColumn:.

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

See the NXBrowser class specification for more details.  In particular, the "Methods Implemented by the Delegate" section describes how the NXBrowser's delegate interacts with both NXBrowser and NXBrowserCells.



Instance Variables

None declared in this class.



Method Types

Initializing and freeing an NXBrowserCell
init
initTextCell:
free
Determining component sizes calcCellSize:inRect:
Accessing graphic attributes isOpaque
setImage:
image
setAltImage:
altImage
+ branchIcon
+ branchIconH
Displaying drawInside:inView:
drawSelf:inView:
highlight:inView:lit:
Placing in browser hierarchy setLeaf:
isLeaf
Determining loaded status setLoaded:
isLoaded
Setting state set
reset



Class Methods

branchIcon
+ branchIcon

Returns the NXImage object named "NXmenuArrow".  This is the icon displayed to indicate a branch node in an NXBrowserCell.  Override this method if you want your subclass to display a different branch icon.

See also:  isLeaf



branchIconH
+ branchIconH

Returns the NXImage object named "NXmenuArrowH".  This is the highlighted icon displayed to indicate a selected branch node in an NXBrowserCell.  Override this method if you want your subclass to display a different branch icon.

See also:  isLeaf



Instance Methods



altImage
altImage

Returns the NXImage that appears on the NXBrowserCell when it's in its alternate state, or nil if there's no such image.

See also:  setAltImage:, setImage, image



calcCellSize:inRect:
calcCellSize:(NXSize *)theSize inRect:(const NXRect *)aRect

Returns self, and, by reference in theSize, the minimum width and height required for displaying the NXBrowserCell in a given rectangle.  Makes sure theSize remains large enough to accommodate the branch arrow icon.  If it isn't possible for the NXBrowserCell to fit in aRect, the width or height returned in theSize could be bigger than those of the rectangle.  Returns self.



drawInside:inView:
drawInside:(const NXRect *)cellFrame inView:aView

Draws the inside of the NXBrowserCell.  Unlike other Cells, NXBrowserCell never draws a border or bezel.  Override this method to draw the cell differently.  Returns self.

See also:  drawSelf:inView:



drawSelf:inView:
drawSelf:(const NXRect *)cellFrame inView:aView

Draws the inside of the NXBrowserCell by invoking drawInside:inView:.  Unlike other Cells, NXBrowserCell never draws a border or bezel.  Returns self.

See also:  drawInside:inView:



free
free

Frees the memory used by the NXBrowserCell.  If an image has been set using setImage:, it's also freed.  The alternate image--if any--is not freed.



highlight:inView:lit:
highlight:(const NXRect *)cellFrame inView:aView lit:(BOOL)lit

If the highlighted state would change, sets the NXBrowserCell's highlighted state to lit and redraws it if needed within cellFrame in aView.  Override this method to highlight the NXBrowserCell differently.  Returns self.

See also:  set, reset, highlight:inView:lit: (Cell)



image
image

Returns the NXImage that was set with the setImage: method, or nil if no such image has been set.

See also:  setImage:, setAltImage:, altImage



init
init

Initializes and returns the receiver, a new NXBrowserCell instance, sets its title to "BrowserItem" and returns self.

See also:  initTextCell:



initTextCell:
initTextCell:(const char *)aString

Initializes the receiver, a new NXBrowserCell instance with aString as its title.  Sets the NXBrowserCell so it doesn't wrap text.  This method is the designated initializer for the NXBrowserCell class.  Override this method if you create a subclass of NXBrowserCell that performs its own initialization.  Returns self.

See also:  init



isLeaf
(BOOL)isLeaf

Determines whether the entry in the receiver represents a leaf node (such as a file) or branch node (such as a directory).  This method is invoked by NXBrowser to check whether to display the branch icon in the Cell and, when an NXBrowserCell is selected, whether to load a column to the right of the column containing the receiving Cell.  Returns YES if the cell represents a leaf, NO if the cell represents a branch.

See also:  setLeaf:



isLoaded
(BOOL)isLoaded

Returns YES if the NXBrowserCell is loaded, NO if it isn't.  Used by NXBrowser to determine if a particular Cell is loaded in a column.  When an NXBrowserCell is created, this value is YES; however, if the NXBrowserCell is created by the NXBrowser, it sets the value to NO so the delegate can properly set the loaded status.  NXBrowser and its delegate change the value returned by this method using the setLoaded: method to reflect the current status of the cell.

See also:  setLoaded:, NXBrowser



isOpaque
(BOOL)isOpaque

Returns YES since an NXBrowserCell is always opaque.



reset
reset

Sets the NXBrowserCell's state to 0 and sets the highlighted flag to NO.  Does not display the NXBrowserCell, even if autodisplay is on.  Returns self.

See also:  set, highlight:inView:lit



set
set

Sets the NXBrowserCell's state to 1 and sets the highlighted flag to YES.  Does not display the NXBrowserCell, even if autodisplay is on.  Returns self.

See also:  reset, highlight:inView:lit



setAltImage:
setAltImage:altImage

Sets the NXBrowserCell's alternate image to altImage.  If one has been set, the alternate image is displayed when an NXBrowserCell is highlighted.

This method frees the previous alternate image--if any--before the new image is set.  Consequently, if you will be resetting the alternate image and you don't want a particular image freed, use a copy:

[theCell setAltImage:[[NXImage findImageNamed:"sharedImage"] copy]];

See also:  altImage, setImage:, image



setImage:
setImage:image

Sets the NXBrowserCell's normal image to image.  The normal image is displayed when the NXBrowserCell is in the unhighlighted state.  In the highlighted state, it displays the alternate image (see setAltImage:) if one exists, or a highlighted version of the normal image, if not.

This method frees the previous image--if any--before the new image is set.  Consequently, if you will be resetting an NXBrowserCell's image and you don't want a particular image freed, use a copy:

[theCell setImage:[[NXImage findImageNamed:"sharedImage"] copy]];

See also:  image, setAltImage:, altImage



setLeaf:
setLeaf:(BOOL)flag

Invoked by NXBrowser's delegate when it loads an NXBrowserCell.  If flag is YES, the NXBrowserCell is set to represent a leaf node; it will display without the branch icon.  When flag is NO, the NXBrowserCell is set to represent a branch node; it will display with the branch icon.  Does not display the NXBrowserCell, even if autodisplay is on.  Returns self.

See also:  isLeaf, branchIcon, branchIconH



setLoaded:
setLoaded:(BOOL)flag

Sets the loaded status of the NXBrowser cell to flag.  This method is invoked by NXBrowser or its delegate to set the status of the NXBrowserCell.  The delegate should send the setLoaded: message with YES as the argument when it loads the cell.

See also:  isLoaded, NXBrowser delegate methods