NSTableView

NSTableView Mac OS X 10.0

This subclass of NSView organizes information into rows and columns. The information displayed in the table comes from an object that serves as the table view's data source object; data source objects must implement a minimum set of methods declared by the NSTableDataSource informal protocol. Instances of NSTableView are composite objects that manage NSTableColumn objects (one for each column in a table), and NSTableHeaderView objects (to draw the headers over the table columns).

figs/cocn_15101.gif

@interface NSTableView : NSControl
 // Accessor Methods
   - (void)setRowHeight:(float)rowHeight;
   - (float)rowHeight;
   - (void)setDelegate:(id)delegate;
   - (id)delegate;
   - (void)setHeaderView:(NSTableHeaderView *)headerView;
   - (NSTableHeaderView *)headerView;
   - (void)setCornerView:(NSView *)cornerView;
   - (NSView *)cornerView;
   - (void)setAllowsColumnReordering:(BOOL)flag;
   - (BOOL)allowsColumnReordering;
   - (void)setAllowsColumnResizing:(BOOL)flag;
   - (BOOL)allowsColumnResizing;
   - (void)setAutoresizesAllColumnsToFit:(BOOL)flag;
   - (BOOL)autoresizesAllColumnsToFit;
   - (void)setIntercellSpacing:(NSSize)aSize;
   - (NSSize)intercellSpacing;
   - (void)setBackgroundColor:(NSColor *)color;
   - (NSColor *)backgroundColor;
   - (void)setGridColor:(NSColor *)color;
   - (NSColor *)gridColor;
   - (void)setIndicatorImage:(NSImage *)anImage  inTableColumn:(NSTableColumn *)tc;
   - (void)setAllowsColumnSelection:(BOOL)flag;
   - (BOOL)allowsColumnSelection;
   - (void)setAutosaveTableColumns:(BOOL)save;
   - (BOOL)autosaveTableColumns;
   - (void)setAllowsEmptySelection:(BOOL)flag;
   - (BOOL)allowsEmptySelection;
   - (void)setAllowsMultipleSelection:(BOOL)flag;
   - (BOOL)allowsMultipleSelection;
   - (void)setDropRow:(int)row dropOperation:(NSTableViewDropOperation)op;
   - (void)setDataSource:(id)aSource;
   - (id)dataSource;
   - (void)setAutosaveName:(NSString *)name;
   - (NSString *)autosaveName;
   - (void)setDoubleAction:(SEL)aSelector;
   - (SEL)doubleAction;
   - (void)setHighlightedTableColumn:(NSTableColumn *)tc;
   - (NSTableColumn *)highlightedTableColumn;
   - (void)setDrawsGrid:(BOOL)flag;
   - (BOOL)drawsGrid;
   - (void)setVerticalMotionCanBeginDrag:(BOOL)flag;
   - (BOOL)verticalMotionCanBeginDrag;
 // Instance Methods
   - (void)highlightSelectionInClipRect:(NSRect)rect;
   - (void)deselectRow:(int)row;
   - (void)deselectAll:(id)sender;
   - (void)deselectColumn:(int)column;
   - (void)addTableColumn:(NSTableColumn *)column;
   - (NSImage*)dragImageForRows:(NSArray*)dragRows event:(NSEvent*)dragEvent
        dragImageOffset:(NSPointPointer)dragImageOffset;
   - (NSRect)frameOfCellAtColumn:(int)column row:(int)row;
   - (int)clickedColumn;
   - (int)clickedRow;
   - (NSImage *)indicatorImageInTableColumn:(NSTableColumn *)tc;
   - (BOOL)isColumnSelected:(int)row;
   - (BOOL)isRowSelected:(int)row;
   - (void)moveColumn:(int)column toColumn:(int)newIndex;
   - (void)noteNumberOfRowsChanged;
   - (int)numberOfColumns;
   - (int)numberOfRows;
   - (int)numberOfSelectedColumns;
   - (int)numberOfSelectedRows;
   - (void)reloadData;
   - (void)removeTableColumn:(NSTableColumn *)column;
   - (int)rowAtPoint:(NSPoint)point;
   - (NSRange)rowsInRect:(NSRect)rect;
   - (void)scrollColumnToVisible:(int)column;
   - (void)scrollRowToVisible:(int)row;
   - (void)selectAll:(id)sender;
   - (void)selectColumn:(int)column byExtendingSelection:(BOOL)extend;
   - (void)selectRow:(int)row byExtendingSelection:(BOOL)extend;
   - (int)selectedColumn;
   - (NSEnumerator *)selectedColumnEnumerator;
   - (int)selectedRow;
   - (NSEnumerator *)selectedRowEnumerator;
   - (void)sizeLastColumnToFit;
   - (NSTableColumn *)tableColumnWithIdentifier:(id)identifier;
   - (NSArray *)tableColumns;
   - (void)tile;
   - (int)columnAtPoint:(NSPoint)point;
   - (int)columnWithIdentifier:(id)identifier;
   - (NSRange)columnsInRect:(NSRect)rect;
   - (void)drawGridInClipRect:(NSRect)rect;
   - (void)drawRow:(int)row clipRect:(NSRect)rect;
   - (void)editColumn:(int)column row:(int)row withEvent:(NSEvent *)theEvent select:(BOOL)select;
   - (int)editedColumn;
   - (int)editedRow;
   - (NSRect)rectOfColumn:(int)column;
   - (NSRect)rectOfRow:(int)row;
   - (void)textDidBeginEditing:(NSNotification *)notification;
   - (void)textDidChange:(NSNotification *)notification;
   - (void)textDidEndEditing:(NSNotification *)notification;
   - (BOOL)textShouldBeginEditing:(NSText *)textObject;
   - (BOOL)textShouldEndEditing:(NSText *)textObject;
// Methods Implemented by the Delegate
   - (void)tableView:(NSTableView*)tableView didClickTableColumn:(NSTableColumn *)tableColumn;
   - (void)tableView:(NSTableView*)tableView didDragTableColumn:(NSTableColumn *)tableColumn;
   - (void)tableView:(NSTableView*)tableView mouseDownInHeaderOfTableColumn:(NSTableColumn *)tableColumn;
   - (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView;
   - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(int)row;
   - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(int)row;
   - (BOOL)tableView:(NSTableView *)tableView shouldSelectTableColumn:(NSTableColumn *)tableColumn;
   - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
        forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
   - (void)tableViewColumnDidMove:(NSNotification *)notification;
   - (void)tableViewColumnDidResize:(NSNotification *)notification;
   - (void)tableViewSelectionDidChange:(NSNotification *)notification;
   - (void)tableViewSelectionIsChanging:(NSNotification *)notification;
// Notifications
   NSTableViewSelectionDidChangeNotification;
   NSTableViewSelectionIsChangingNotification;

Subclasses

NSOutlineView



    Part II: API Quick Reference
    Chapter 13. Foundation Classes