| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in Mac OS X v10.0 and later.
|
| Companion guide | |
| Declared in | NSBrowser.h |
This class provides a user interface for displaying and selecting items from a list of data or from hierarchically organized lists of data such as directory paths. Instances of this class are known as browsers. When working with a hierarchy of data, the levels are displayed in columns, which are indexed from left to right.
This class uses the NSBrowserCell class to implement its user interface.
Browsers have the following components:
Columns
Scroll views
Matrices
Browser cells
To the user, browsers display data in columns and rows within each column. These components are arranged in the following component hierarchy:
Browser |
|---Columns [1..*] |
|---Scroll view |
|---Matrix |
|---Rows [0..*] |
– reusesColumns
– setReusesColumns:
– maxVisibleColumns
– setMaxVisibleColumns:
– backgroundColor
– setBackgroundColor:
– minColumnWidth
– setMinColumnWidth:
– separatesColumns
– setSeparatesColumns:
– takesTitleFromPreviousColumn
– setTakesTitleFromPreviousColumn:
– tile
– acceptsArrowKeys
– setAcceptsArrowKeys:
– delegate
– setDelegate:
– isOpaque
– browser:isColumnValid: delegate method
– browser:numberOfRowsInColumn: delegate method
– browser:titleOfColumn: delegate method
– allowsBranchSelection
– setAllowsBranchSelection:
– allowsEmptySelection
– setAllowsEmptySelection:
– allowsMultipleSelection
– setAllowsMultipleSelection:
– selectedRowIndexesInColumn:
– selectRowIndexes:inColumn:
– allowsTypeSelect
– setAllowsTypeSelect:
– browser:shouldTypeSelectForEvent:withCurrentSearchString: delegate method
– browser:typeSelectStringForRow:inColumn: delegate method
– browser:nextTypeSelectMatchFromRow:toRow:inColumn:forString: delegate method
– selectedCell
– selectedCellInColumn:
– selectedCells
– selectAll:
– selectedRowInColumn:
– selectRow:inColumn:
– browser:selectCellWithString:inColumn: delegate method
– browser:selectRow:inColumn: delegate method
– addColumn
– displayAllColumns
– displayColumn:
– columnOfMatrix:
– selectedColumn
– lastColumn
– setLastColumn:
– firstVisibleColumn
– numberOfVisibleColumns
– lastVisibleColumn
– validateVisibleColumns
– isLoaded
– loadColumnZero
– reloadColumn:
– browser:createRowsForColumn:inMatrix: delegate method
– browser:willDisplayCell:atRow:column: delegate method
– titleOfColumn:
– setTitle:ofColumn:
– isTitled
– setTitled:
– drawTitleOfColumn:inRect:
– titleHeight
– titleFrameOfColumn:
– updateScroller
– hasHorizontalScroller
– setHasHorizontalScroller:
– scrollColumnToVisible:
– scrollColumnsLeftBy:
– scrollColumnsRightBy:
– scrollViaScroller:
– browserWillScroll: delegate method
– browserDidScroll: delegate method
– draggingSourceOperationMaskForLocal:
– setDraggingSourceOperationMask:forLocal:
– canDragRowsWithIndexes:inColumn:withEvent:
– browser:canDragRowsWithIndexes:inColumn:withEvent: delegate method
– draggingImageForRowsWithIndexes:inColumn:withEvent:offset:
– browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset: delegate method
– browser:validateDrop:proposedRow:column:dropOperation: delegate method
– browser:acceptDrop:atRow:column:dropOperation: delegate method
– namesOfPromisedFilesDroppedAtDestination:
– browser:writeRowsWithIndexes:inColumn:toPasteboard: delegate method
– browser:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:inColumn: delegate method
– doubleAction
– setDoubleAction:
– sendsActionOnArrowKeys
– setSendsActionOnArrowKeys:
– sendAction
+ removeSavedColumnsWithAutosaveName:
– columnsAutosaveName
– setColumnsAutosaveName:
– columnContentWidthForColumnWidth:
– columnWidthForColumnContentWidth:
– columnResizingType
– setColumnResizingType:
– prefersAllColumnUserResizing
– setPrefersAllColumnUserResizing:
– widthOfColumn:
– setWidth:ofColumn:
– browser:shouldSizeColumn:forUserResize:toWidth: delegate method
– browser:sizeToFitWidthOfColumn: delegate method
– browserColumnConfigurationDidChange: delegate method
– browser:shouldShowCellExpansionForRow:column: delegate method
Returns the NSBrowserCell class.
+ (Class)cellClass
Always returns the NSBrowserCell class (even if the developer has sent a setCellClass: message to a particular instance).
This method is used by NSControl during initialization and is not meant to be used by applications.
NSBrowser.h
Removes the column configuration data stored under the given name from the application’s user defaults.
+ (void)removeSavedColumnsWithAutosaveName:(NSString *)name
The name of the column configuration data to remove.
NSBrowser.hReturns a Boolean value indicating whether the browser allows navigation using the arrow keys.
- (BOOL)acceptsArrowKeys
YES if the arrow keys are enabled; otherwise NO.
NSBrowser.hAdds a column to the right of the last column.
- (void)addColumn
NSBrowser.hReturns a Boolean value indicating whether the user can select branch items.
- (BOOL)allowsBranchSelection
YES if the user can select branch items when multiple selection is enabled; otherwise NO.
NSBrowser.hReturns a Boolean value indicating whether there can be nothing selected.
- (BOOL)allowsEmptySelection
YES if the browser allows the selection to be empty; otherwise NO.
NSBrowser.hReturns a Boolean value indicating whether the user can select multiple items.
- (BOOL)allowsMultipleSelection
YES if the browser allows the user to select multiple items at once; otherwise NO.
NSBrowser.hIndicates whether the receiver allows keystroke-based selection (type select).
- (BOOL)allowsTypeSelect
YES (default) when the receiver allows keystroke-based selection, NO otherwise.
NSBrowser.hProvides the receiver’s background color. Default: [NSColor whiteColor].
- (NSColor *)backgroundColor
The receiver’s background color.
Default: [NSColor whiteColor]
NSBrowser.hIndicates whether the receiver can attempt to initiate a drag of the given rows for the given event.
- (BOOL)canDragRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)columnIndex withEvent:(NSEvent *)dragEvent
Rows the user is dragging
Column containing the rows the user is dragging.
Mouse-drag event.
YES when rowIndexes identifies at least one row and all the identified rows are enabled, NO otherwise.
NSBrowser.hReturns the receiver’s prototype NSCell.
- (id)cellPrototype
The prototype NSCell. The prototype NSCell instance is copied to display items in the matrices of the browser.
NSBrowser.hGiven the column width, returns the content width.
- (CGFloat)columnContentWidthForColumnWidth:(CGFloat)columnWidth
The width of the column. This width is the entire scrolling text view.
The width of the content for the column. This is the width of the matrix in the column.
NSBrowser.hReturns the column number in which the given matrix is located.
- (NSInteger)columnOfMatrix:(NSMatrix *)matrix
The matrix for which to return the column number.
The index of the column in which the specified matrix appears.
NSBrowser.hReturns the receiver’s column resizing type.
- (NSBrowserColumnResizingType)columnResizingType
A constant indicating the column resizing type. Possible return values are described in NSBrowserColumnResizingType. The default is NSBrowserAutoColumnResizing
NSBrowser.hReturns the name used to automatically save the receiver’s column configuration.
- (NSString *)columnsAutosaveName
The name used to save the column configuration.
NSBrowser.hGiven the content width, returns the column width.
- (CGFloat)columnWidthForColumnContentWidth:(CGFloat)columnContentWidth
The width of the column's content (the width of the the matrix in the column).
The width of the column (the width of the entire scrolling text view).
For example, to guarantee that 16 pixels of your browser cell are always visible, call:
[browser setMinColumnWidth: [browser columnWidthForColumnContentWidth:16]] |
NSBrowser.hReturns the receiver’s delegate.
- (id)delegate
The receiver's delegate.
NSBrowser.h
Updates the receiver to display all loaded columns.
- (void)displayAllColumns
NSBrowser.hUpdates the receiver to display the given column.
- (void)displayColumn:(NSInteger)column
The index of the column to display.
NSBrowser.hResponds to (single) mouse clicks in a column of the receiver.
- (void)doClick:(id)sender
NSBrowser.h
Responds to double clicks in a column of the receiver.
- (void)doDoubleClick:(id)sender
NSBrowser.hReturns the receiver’s double-click action method.
- (SEL)doubleAction
The action method invoked when the user double-clicks on the browser.
NSBrowser.hProvides an image to represent dragged rows during a drag operation on the receiver.
- (NSImage *)draggingImageForRowsWithIndexes:(NSIndexSet *)rowIndexes inColumn:(NSInteger)columnIndex withEvent:(NSEvent *)dragEvent offset:(NSPointPointer)dragImageOffset
Rows the user is dragging.
Column with the rows the user is dragging.
Mouse drag event.
Offset for the returned image:
NSZeroPoint: The image is centered under the pointer.
Image representing the visible cells identified by rowIndexes.
NSBrowser.hIndicates the types of dragging operations the source object allows on the dragged image’s data.
- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)localDestination
Indicates the location of the dragging operation’s destination object: YES for this application, NO for another application.
NSDragOperationEvery when localDestination is YES.
NSDragOperationNone when localDestination is NO.
This method overrides NSDraggingSource draggingSourceOperationMaskForLocal:.
Draws the title for the specified column within the given rectangle.
- (void)drawTitleOfColumn:(NSInteger)column inRect:(NSRect)aRect
The index of the column for which to draw the title.
The rectangle within which to draw the title.
NSBrowser.hReturns the index of the first visible column.
- (NSInteger)firstVisibleColumn
The index of the first visible column.
NSBrowser.h
Returns the rectangle containing the given column.
- (NSRect)frameOfColumn:(NSInteger)column
The index of the column for which to retrieve the frame.
The rectangle containing the specified column.
NSBrowser.h
Returns the rectangle containing the specified column, not including borders.
- (NSRect)frameOfInsideOfColumn:(NSInteger)column
The index of the column for which to retrieve the inside frame.
The rectangle containing the column, not including the column borders.
NSBrowser.hReturns a Boolean value indicating whether the browser has a horizontal scroller.
- (BOOL)hasHorizontalScroller
YES if the browser uses an NSScroller object to scroll horizontally; otherwise NO.
NSBrowser.hReturns whether column 0 is loaded.
- (BOOL)isLoaded
YES if column 0 is loaded; otherwise NO.
NSBrowser.hIndicates whether the receiver is opaque.
- (BOOL)isOpaque
YES when the receiver doesn’t have a title and its background color’s alpha component is 1.0, NO otherwise.
This method overrides NSView isOpaque.
Returns a Boolean value indicating whether columns display titles.
- (BOOL)isTitled
YES if the columns in a browser display titles; otherwise NO.
NSBrowser.hReturns the index of the last column loaded.
- (NSInteger)lastColumn
The index of the last loaded column.
NSBrowser.hReturns the index of the last visible column.
- (NSInteger)lastVisibleColumn
The index of the last visible column.
NSBrowser.hLoads column 0; unloads previously loaded columns.
- (void)loadColumnZero
NSBrowser.hLoads, if necessary, and returns the NSCell at the specified row and column location.
- (id)loadedCellAtRow:(NSInteger)row column:(NSInteger)column
The row index of the cell to return.
The column index of the cell to return.
NSBrowser.hReturns the matrix class used in the receiver’s columns.