Up

# NSBrowser

### Authors

Scott Christley (`scottc@net-community.com`)
Felipe A. Rodriguez (`far@ix.netcom.com`)
Franck Wolff (`wolff@cybercable.fr`)
Mirko Viviani (`mirko.viviani@rccr.cremona.it`)
Fred Kiefer (`FredKiefer@gmx.de`)

> Control to display and select from hierarchal lists

Copyright: (C) 1996, 1997, 2002 Free Software Foundation, Inc.

# Software documentation for the NSBrowser class

## NSBrowser : NSControl

> Declared in:
>   AppKit/NSBrowser.h

> Conforms to:
>   NSCoding

Availability: OpenStep
Description forthcoming.

Instance Variables
Method summary

- +cellClass
- +removeSavedColumnsWithAutosaveName:
- -acceptsArrowKeys
- -addColumn
- -allowsBranchSelection
- -allowsEmptySelection
- -allowsMultipleSelection
- -allowsTypeSelect
- -autohidesScroller
- -backgroundColor
- -canDragRowsWithIndexes:inColumn:withEvent:
- -cellPrototype
- -clickedColumn
- -clickedRow
- -columnContentWidthForColumnWidth:
- -columnOfMatrix:
- -columnResizingType
- -columnWidthForColumnContentWidth:
- -columnsAutosaveName
- -delegate
- -displayAllColumns
- -displayColumn:
- -doClick:
- -doDoubleClick:
- -doubleAction
- -drawTitle:inRect:ofColumn:
- -drawTitleOfColumn:inRect:
- -firstVisibleColumn
- -frameOfColumn:
- -frameOfInsideOfColumn:
- -hasHorizontalScroller
- -isLoaded
- -isTitled
- -lastColumn
- -lastVisibleColumn
- -loadColumnZero
- -loadedCellAtRow:column:
- -matrixClass
- -matrixInColumn:
- -maxVisibleColumns
- -minColumnWidth
- -numberOfVisibleColumns
- -path
- -pathSeparator
- -pathToColumn:
- -prefersAllColumnUserResizing
- -reloadColumn:
- -reusesColumns
- -scrollColumnToVisible:
- -scrollColumnsLeftBy:
- -scrollColumnsRightBy:
- -scrollRowToVisible:inColumn:
- -scrollViaScroller:
- -selectAll:
- -selectRow:inColumn:
- -selectedCell
- -selectedCellInColumn:
- -selectedCells
- -selectedColumn
- -selectedRowInColumn:
- -selectionIndexPath

### cellClass

+ (Class) cellClass;
Availability: OpenStep

Returns the NSBrowserCell class (regardless of whether a -setCellClass: message has been sent to a particular instance). This method is not meant to be used by applications.

See Also: -setCellClass:

### removeSavedColumnsWithAutosaveName:

+ (void) removeSavedColumnsWithAutosaveName: (NSString*)name;
Availability: MacOS-X 10.3.0
Description forthcoming.

### acceptsArrowKeys

- (BOOL) acceptsArrowKeys;
Availability: OpenStep

Returns whether the arrow keys are enabled. By default `YES`.

See Also: -setAcceptsArrowKeys:

### addColumn

- (void) addColumn;
Availability: OpenStep

Adds a column to the right of the last column, adjusts subviews and scrolls to make the new column visible if needed.

### allowsBranchSelection

- (BOOL) allowsBranchSelection;
Availability: OpenStep

Returns whether the user can select branch items when multiple selection is enabled. By default `YES`.

See Also: -setAllowsBranchSelection:

### allowsEmptySelection

- (BOOL) allowsEmptySelection;
Availability: OpenStep

Returns whether there can be nothing selected. By default `YES`.

See Also: -setAllowsEmptySelection:

### allowsMultipleSelection

- (BOOL) allowsMultipleSelection;
Availability: OpenStep

Returns whether the user can select multiple items. By default `YES`.

See Also: -allowsMultipleSelection

### allowsTypeSelect

- (BOOL) allowsTypeSelect;
Availability: MacOS-X 10.5.0
Description forthcoming.

### autohidesScroller

- (BOOL) autohidesScroller;
Availability: MacOS-X 10.6.0
Description forthcoming.

### backgroundColor

- (NSColor*) backgroundColor;
Availability: MacOS-X 10.6.0
Description forthcoming.

### canDragRowsWithIndexes: inColumn: withEvent:

- (BOOL) canDragRowsWithIndexes: (NSIndexSet*)rowIndexes inColumn: (NSInteger)columnIndex withEvent: (NSEvent*)dragEvent;
Availability: MacOS-X 10.5.0
Description forthcoming.

### cellPrototype

- (id) cellPrototype;
Availability: OpenStep

Returns the NSBrowser's prototype NSCell instance.

See Also: -setCellPrototype:

### clickedColumn

- (NSInteger) clickedColumn;
Availability: MacOS-X 10.6.0
Description forthcoming.

### clickedRow

- (NSInteger) clickedRow;
Availability: MacOS-X 10.6.0
Description forthcoming.

### columnContentWidthForColumnWidth:

- (CGFloat) columnContentWidthForColumnWidth: (CGFloat)columnWidth;
Availability: MacOS-X 10.3.0
Description forthcoming.

### columnOfMatrix:

- (NSInteger) columnOfMatrix: (NSMatrix*)matrix;
Availability: OpenStep

Returns the column number in which matrix is located. Returns -1 if matrix is not found.

### columnResizingType

- (NSBrowserColumnResizingType) columnResizingType;
Availability: MacOS-X 10.3.0
Description forthcoming.

### columnWidthForColumnContentWidth:

- (CGFloat) columnWidthForColumnContentWidth: (CGFloat)columnContentWidth;
Availability: MacOS-X 10.3.0
Description forthcoming.

### columnsAutosaveName

- (NSString*) columnsAutosaveName;
Availability: MacOS-X 10.3.0
Description forthcoming.

### delegate

- (id) delegate;
Availability: OpenStep

Returns the NSBrowser's delegate.

See Also: -setDelegate:

### displayAllColumns

- (void) displayAllColumns;
Availability: OpenStep

Updates the NSBrowser to display all loaded columns.

See Also: -displayColumn: -tile

### displayColumn:

- (void) displayColumn: (NSInteger)column;
Availability: OpenStep

Updates the NSBrowser to display the column with the given index.

### doClick:

- (void) doClick: (id)sender;
Availability: OpenStep

Responds to (single) mouse clicks in a column of the NSBrowser.

See Also: -doDoubleClick:

### doDoubleClick:

- (void) doDoubleClick: (id)sender;
Availability: OpenStep

Responds to double-clicks in a column of the NSBrowser.

See Also: -doClick: -sendAction:to:

### doubleAction

- (SEL) doubleAction;
Availability: OpenStep

Returns the NSBrowser's double-click action method.

See Also: -setDoubleAction:

### drawTitle: inRect: ofColumn:

- (void) drawTitle: (NSString*)title inRect: (NSRect)aRect ofColumn: (NSInteger)column;
Availability: OpenStep
Draws the title for the column at index column within the rectangle defined by aRect.

### drawTitleOfColumn: inRect:

- (void) drawTitleOfColumn: (NSInteger)column inRect: (NSRect)aRect;
Availability: MacOS-X 10.0.0
Description forthcoming.

### firstVisibleColumn

- (NSInteger) firstVisibleColumn;
Availability: OpenStep
Returns the index of the first visible column.

### frameOfColumn:

- (NSRect) frameOfColumn: (NSInteger)column;
Availability: OpenStep

Returns the rectangle containing the column at index column.

### frameOfInsideOfColumn:

- (NSRect) frameOfInsideOfColumn: (NSInteger)column;
Availability: OpenStep
Returns the rectangle containing the column at index column,

### hasHorizontalScroller

- (BOOL) hasHorizontalScroller;
Availability: OpenStep

Returns whether an NSScroller is used to scroll horizontally. By default a NSBrowser has a horizontal scroller.

See Also: -setHasHorizontalScroller:

### isLoaded

- (BOOL) isLoaded;
Availability: OpenStep
Returns whether column zero is loaded.

### isTitled

- (BOOL) isTitled;
Availability: OpenStep

Returns whether columns display titles. By default a NSBrowser displays titles.

See Also: -setTitled:

### lastColumn

- (NSInteger) lastColumn;
Availability: OpenStep

Returns the index of the last column loaded.

See Also: -setLastColumn:

### lastVisibleColumn

- (NSInteger) lastVisibleColumn;
Availability: OpenStep
Returns the index of the last visible column.

### loadColumnZero

- (void) loadColumnZero;
Availability: OpenStep
Loads column zero; unloads previously loaded columns.

### loadedCellAtRow: column:

- (id) loadedCellAtRow: (NSInteger)row column: (NSInteger)column;
Availability: OpenStep
Loads if necessary and returns the NSCell at row in column. if you change this code, you may want to look at the __performLoadOfColumn: method in which the following code is integrated (for speed)

### matrixClass

- (Class) matrixClass;
Availability: OpenStep

Returns the class of NSMatrix used in the NSBrowser's columns.

See Also: -setMatrixClass:

### matrixInColumn:

- (NSMatrix*) matrixInColumn: (NSInteger)column;
Availability: OpenStep

Returns the matrix located in the column identified by index column. Returns `nil` if the matrix does not exists

### maxVisibleColumns

- (NSInteger) maxVisibleColumns;
Availability: OpenStep

Returns the maximum number of visible columns. By default a NSBrowser has 3 visible columns.

See Also: -setMaxVisibleColumns:

### minColumnWidth

- (CGFloat) minColumnWidth;
Availability: OpenStep

Returns the minimum column width in pixels.

See Also: -setMinColumnWidth:

### numberOfVisibleColumns

- (NSInteger) numberOfVisibleColumns;
Availability: OpenStep

Returns the number of columns visible.

See Also: -firstVisibleColumn -lastVisibleColumn

### path

- (NSString*) path;
Availability: OpenStep

Returns the browser's current path.

See Also: -pathToColumn:

### pathSeparator

- (NSString*) pathSeparator;
Availability: OpenStep

Returns the path separator. The default is "/".

See Also: -setPathSeparator:

### pathToColumn:

- (NSString*) pathToColumn: (NSInteger)column;
Availability: OpenStep

Returns a string representing the path from the first column up to, but not including, the column at index column.

See Also: -path

### prefersAllColumnUserResizing

- (BOOL) prefersAllColumnUserResizing;
Availability: MacOS-X 10.3.0
Description forthcoming.

### reloadColumn:

- (void) reloadColumn: (NSInteger)column;
Availability: OpenStep
Reloads column if it is loaded; sets it as the last column. Reselects previously selected cells, if they remain.

### reusesColumns

- (BOOL) reusesColumns;
Availability: OpenStep

Returns `YES` if NSMatrix objects aren't freed when their columns are unloaded. By default a NSBrowser does not reuses their columns.

See Also: -setReusesColumns: [NSMatrix -renewRows:columns:]

### scrollColumnToVisible:

- (void) scrollColumnToVisible: (NSInteger)column;
Availability: OpenStep

Scrolls to make the column at index column visible.

See Also: -scrollColumnsRightBy: -scrollColumnsLeftBy:

### scrollColumnsLeftBy:

- (void) scrollColumnsLeftBy: (NSInteger)shiftAmount;
Availability: OpenStep

Scrolls columns left by shiftAmount columns.

See Also: -scrollColumnsRightBy: -scrollColumnToVisible:

### scrollColumnsRightBy:

- (void) scrollColumnsRightBy: (NSInteger)shiftAmount;
Availability: OpenStep

Scrolls columns right by shiftAmount columns.

See Also: -scrollColumnsLeftBy: -scrollColumnToVisible:

### scrollRowToVisible: inColumn:

- (void) scrollRowToVisible: (NSInteger)row inColumn: (NSInteger)column;
Availability: MacOS-X 10.6.0
Description forthcoming.

### scrollViaScroller:

- (void) scrollViaScroller: (NSScroller*)sender;
Availability: OpenStep
Scrolls columns left or right based on an NSScroller.

### selectAll:

- (void) selectAll: (id)sender;
Availability: OpenStep

Selects all NSCells in the last column of the NSBrowser.

See Also: [NSMatrix -selectAll:]

### selectRow: inColumn:

- (void) selectRow: (NSInteger)row inColumn: (NSInteger)column;
Availability: OpenStep

Selects the cell at index row in the column identified by index column. If the delegate method -browser:selectRow:inColumn: is implemented, this is its responsability to select the cell. This method adds a NSBrowser column if needed and deselects other selections if the browser does not allows multiple selection.

See Also: -loadedCellAtRow:column: -browser:selectRow:inColumn: [NSMatrix -selectCellAtRow:column:]

### selectedCell

- (id) selectedCell;
Availability: OpenStep

Returns the last (rightmost and lowest) selected NSCell. Returns `nil` if no cell is selected

See Also: -selectedCells -selectedCellInColumn:

### selectedCellInColumn:

- (id) selectedCellInColumn: (NSInteger)column;
Availability: OpenStep

Returns the last (lowest) NSCell that's selected in column. Returns `nil` if no cell is selected

See Also: -selectedCell -selectedCells

### selectedCells

- (NSArray*) selectedCells;
Availability: OpenStep

Returns a NSArray of selected cells in the rightmost column. Returns `nil` if no cell is selected.

See Also: -selectedCell -selectedCellInColumn: [NSMatrix selectedCells]

### selectedColumn

- (NSInteger) selectedColumn;
Availability: OpenStep
Returns the index of the last column with a selected item.

### selectedRowInColumn:

- (NSInteger) selectedRowInColumn: (NSInteger)column;
Availability: OpenStep

Returns the row index of the selected cell in the column specified by index column. Returns -1 if no cell is selected

See Also: -selectedCellInColumn: [NSMatrix -selectedRow]

### selectionIndexPath

- (NSIndexPath*) selectionIndexPath;
Availability: MacOS-X 10.6.0

Returns the index path of the selected item, or `nil` if there is no selection.

## Instance Variables for NSBrowser Class

### _acceptsAlphaNumericalKeys

@protected BOOL _acceptsAlphaNumericalKeys;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _acceptsArrowKeys

@protected BOOL _acceptsArrowKeys;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _action

@protected SEL _action;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _allowsBranchSelection

@protected BOOL _allowsBranchSelection;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _allowsEmptySelection

@protected BOOL _allowsEmptySelection;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _allowsMultipleSelection

@protected BOOL _allowsMultipleSelection;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _alphaNumericalLastColumn

@protected int _alphaNumericalLastColumn;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _browserCellPrototype

@protected NSCell* _browserCellPrototype;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _browserColumns

@protected NSMutableArray* _browserColumns;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _browserDelegate

@protected id _browserDelegate;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _browserMatrixClass

@protected Class _browserMatrixClass;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _charBuffer

@protected NSString* _charBuffer;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _columnResizing

@protected NSBrowserColumnResizingType _columnResizing;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _columnSize

@protected NSSize _columnSize;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _columnsAutosaveName

@protected NSString* _columnsAutosaveName;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _doubleAction

@protected SEL _doubleAction;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _firstVisibleColumn

@protected int _firstVisibleColumn;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _hasHorizontalScroller

@protected BOOL _hasHorizontalScroller;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _horizontalScroller

@protected NSScroller* _horizontalScroller;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _isLoaded

@protected BOOL _isLoaded;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _isTitled

@protected BOOL _isTitled;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _lastColumnLoaded

@protected int _lastColumnLoaded;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _lastKeyPressed

@protected NSTimeInterval _lastKeyPressed;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _lastVisibleColumn

@protected int _lastVisibleColumn;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _maxVisibleColumns

@protected int _maxVisibleColumns;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _minColumnWidth

@protected CGFloat _minColumnWidth;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _passiveDelegate

@protected BOOL _passiveDelegate;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _pathSeparator

@protected NSString* _pathSeparator;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _prefersAllColumnUserResizing

@protected BOOL _prefersAllColumnUserResizing;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _reusesColumns

@protected BOOL _reusesColumns;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _scrollerRect

@protected NSRect _scrollerRect;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _sendsActionOnAlphaNumericalKeys

@protected BOOL _sendsActionOnAlphaNumericalKeys;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _sendsActionOnArrowKeys

@protected BOOL _sendsActionOnArrowKeys;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _separatesColumns

@protected BOOL _separatesColumns;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _skipUpdateScroller

@protected BOOL _skipUpdateScroller;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _takesTitleFromPreviousColumn

@protected BOOL _takesTitleFromPreviousColumn;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

### _target

@protected id _target;
Availability: OpenStep
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.

Up