(Preliminary Documentation) Copyright ã1994 by NeXT Computer, Inc.  All Rights Reserved.

NSBrowser 

Inherits From:	NSControl : NSView : NSResponder : NSObject 

Declared In:	appkit/NSBrowser.h 

Setting the Delegate 

- (id)delegate	Returns the NSBrowser's delegate.
- (void)setDelegate:(id)anObject	Sets the NSBrowser's delegate to anObject.

Target and Action 

- (SEL)doubleAction	Returns the NSBrowser's double-click action method.
- (BOOL)sendAction	Sends the action message to the target. Returns YES upon success, NO if no responder for the message could be found. 
- (void)setDoubleAction:(SEL)aSelector	Sets the NSBrowser's double-click action to aSelector.

Setting Component Classes 

- (id)cellPrototype	Returns the NSBrowser's prototype NSCell.
- (Class)matrixClass	Returns the class of NSMatrix used in the NSBrowser's columns.
- (void)setCellClass:(Class)classId	Sets the class of NSCell used in the columns of the NSBrowser.
- (void)setCellPrototype:(NSCell *)aCell	Sets the NSCell instance copied to display items in the columns of NSBrowser.
- (void)setMatrixClass:(Class)classId	Sets the class of NSMatrix used in the NSBrowser's columns.

Setting NSBrowser Behavior 

- (BOOL)reusesColumns	Returns YES if NSMatrix objects aren't freed when their columns are unloaded. 
- (void)setReusesColumns:(BOOL)flag	If flag is YES, prevents NSMatrix objects from being freed when their columns are unloaded, so they can be reused.
- (void)setTakesTitleFromPreviousColumn:(BOOL)flag
	Sets whether the title of a column is set to the string value of the selected NSCell in the previous column.
- (BOOL)takesTitleFromPreviousColumn	Returns YES if the title of a column is set to the string value of the selected NSCell in the previous column.

Allowing Different Types of Selection 

- (BOOL)allowsBranchSelection	Returns whether the user can select branch items when multiple selection is enabled.
- (BOOL)allowsEmptySelection	Returns whether there can be nothing selected.
- (BOOL)allowsMultipleSelection	Returns whether the user can select multiple items.
- (void)setAllowsBranchSelection:(BOOL)flag	Sets whether the user can select branch items when multiple selection is enabled.
- (void)setAllowsEmptySelection:(BOOL)flag	Sets whether there can be nothing selected.
- (void)setAllowsMultipleSelection:(BOOL)flag	Sets whether the user can select multiple items.

Setting Arrow Key Behavior

- (BOOL)acceptsArrowKeys	Returns YES if the arrow keys are enabled.	
- (BOOL)sendsActionOnArrowKeys	Returns NO if pressing an arrow key only scrolls the browser, YES if it also sends the action message specified by setAction:.
- (void)setAcceptsArrowKeys:(BOOL)flag	Enables or disables the arrow keys.
- (void)setSendsActionOnArrowKeys:(BOOL)flag  Sets whether pressing an arrow key will cause the action message to be sent (in addition to causing scrolling). 

Showing a Horizontal Scroller 

- (void)setHasHorizontalScroller:(BOOL)flag	Sets whether an NSScroller is used to scroll horizontally.
- (BOOL)hasHorizontalScroller	Returns whether an NSScroller is used to scroll horizontally.

Setting the NSBrowser's Appearance 

- (int)maxVisibleColumns	Returns the maximum number of visible columns. 
- (int)minColumnWidth	Returns the minimum column width.
- (BOOL)separatesColumns	Returns whether columns are separated by bezeled borders.
- (void)setMaxVisibleColumns:(int)columnCount	Sets the maximum number of columns displayed.
- (void)setMinColumnWidth:(int)columnWidth	Sets the minimum column width.
- (void)setSeparatesColumns:(BOOL)flag	Sets whether to separate columns with bezeled borders.

Manipulating Columns 

- (void)addColumn	Adds a column to the right of the last column.
- (int)columnOfMatrix:(NSMatrix *)matrix	Returns the column number in which matrix is located.
- (void)displayAllColumns	Updates the NSBrowser to display all loaded columns.
- (void)displayColumn:(int)column	Updates the NSBrowser to display the column with the given index.
- (int)firstVisibleColumn	Returns the index of the first visible column.
- (BOOL)isLoaded	Returns whether column zero is loaded.
- (int)lastColumn	Returns the index of the last column loaded.
- (int)lastVisibleColumn	Returns the index of the last visible column.
- (void)loadColumnZero	Loads column zero; unloads previously loaded columns.
- (int)numberOfVisibleColumns	Returns the number of columns visible.
- (void)reloadColumn:(int)column	Reloads column if it is loaded; sets it as the last column.
- (void)selectAll:(id)sender	Selects all NSCells in the last column of the NSBrowser.
- (int)selectedColumn	Returns the index of the last column with a selected item. 
- (void)setLastColumn:(int)column	Sets the last column to column.
- (void)validateVisibleColumns	Invokes delegate method browser:isColumnValid: for visible columns.

Manipulating Column Titles 

- (void)drawTitle:(NSString *)title	Draws the title for the column at index column.
inRect:(NSRect)aRect
ofColumn:(int)column
- (BOOL)isTitled	Returns whether columns display titles.
- (void)setTitled:(BOOL)flag	Sets whether columns display titles.
- (void)setTitle:(NSString *)aString	Sets the title of the column at index column to aString. 
ofColumn:(int)column
- (NSRect)titleFrameOfColumn:(int)column	Returns the bounds of the title frame for the column at index column.
- (float)titleHeight	Returns the height of column titles. 
- (NSString *)titleOfColumn:(int)column	Returns the title displayed for the column at index column.

Scrolling an NSBrowser 

- (void)scrollColumnsLeftBy:(int)shiftAmount	Scrolls columns left by shiftAmount columns.
- (void)scrollColumnsRightBy:(int)shiftAmount	Scrolls columns right by shiftAmount columns. 
- (void)scrollColumnToVisible:(int)column	Scrolls to make the column at index column visible.
- (void)scrollViaScroller:(NSScroller *)sender	Scrolls columns left or right based on an NSScroller. 
- (void)updateScroller	Updates the horizontal scroller to reflect column positions.

Event Handling 

- (void)doClick:(id)sender	Responds to mouse clicks in a column of the NSBrowser.
- (void)doDoubleClick:(id)sender	Responds to double-clicks in a column of the NSBrowser. 

Getting Matrices and Cells 

- (id)loadedCellAtRow:(int)row	Loads if necessary and returns the NSCell at row in 
column:(int)column		column.
- (NSMatrix *)matrixInColumn:(int)column	Returns the matrix located in column.
- (id)selectedCell	Returns the last (rightmost and lowest) selected NSCell.
- (id)selectedCellInColumn:(int)column	Returns the last (lowest) NSCell that's selected in column.
- (NSArray *)selectedCells	Returns all the rightmost selected NSCells.

Getting Column Frames 

- (NSRect)frameOfColumn:(int)column	Returns the rectangle containing the column at index column.
- (NSRect)frameOfInsideOfColumn:(int)column	Returns the rectangle containing the column at index column, not including borders.

Manipulating Paths 

- (NSString *)path	Returns the browser's current path. 
- (NSString *)pathSeparator	Returns the path separator.
- (NSString *)pathToColumn:(int)column	Returns a string representing the path from the first column to the column at index column.
- (BOOL)setPath:(NSString *)path	Parses path and selects corresponding items in columns.
- (void)setPathSeparator:(NSString *)aString	Sets the path separator to aString.

Arranging an NSBrowser's Components 

- (void)tile	Adjusts the NSBrowser's components.

Methods Implemented by the Delegate 

- (void)browser:(NSBrowser *)sender 	Creates a row in matrix for each row of data to be displayed
createRowsForColumn:(int)column 		 in column of the browser. Either this method or 
inMatrix:(NSMatrix *)matrix		browser:numberOfRowsInColumn: must be implemented, but not both.

- (void)browserDidScroll:(NSBrowser *)sender	Notifies the delegate when the NSBrowser has scrolled.
- (BOOL)browser:(NSBrowser *)sender	 
isColumnValid:(int)column	Returns whether the contents of the specified column are valid.
- (int)browser:(NSBrowser *)sender	Returns the number of rows of data in the column at index 
numberOfRowsInColumn:(int)column		column. Either this method or 
inMatrix:(NSMatrix *)matrix		browser:createRowsForColumn:inMatrix: must be implemented, but not both.
- (BOOL)browser:(NSBrowser *)sender	Requests the delegate to select the NSCell with title title in the column at index 
selectCell:(NSString *)title	 	column.
inColumn:(int)column	
- (NSString *)browser:(NSBrowser *)sender	 
titleOfColumn:(int)column	Queries the delegate for the title to display above the column at index column.
- (void)browser:(NSBrowser *)sender 	Notifies the delegate when the NSBrowser will display 
willDisplayCell:(id)cell 		the specified cell. The delegate should set any state
atRow:(int)row 		necessary for correct display of the cell.
column:(int)column
- (void)browserWillScroll:(NSBrowser *)sender	Notifies the delegate when the NSBrowser will scroll.