home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / AppKit.framework / Versions / B / Headers / NSTableView.h < prev    next >
Text File  |  1996-10-17  |  8KB  |  236 lines

  1. /*
  2.         NSTableView.h
  3.         Application Kit
  4.         Copyright (c) 1995-1996, NeXT Software, Inc.
  5.         All rights reserved.
  6. */
  7.  
  8. #ifndef STRICT_OPENSTEP
  9.  
  10. #import <AppKit/NSControl.h>
  11. #import <AppKit/AppKitDefines.h>
  12.  
  13. @class NSTableHeaderView;
  14. @class NSTableColumn;
  15. @class _NSSparseArray;
  16.  
  17. typedef struct __TvFlags {
  18. #ifdef __BIG_ENDIAN__
  19.     unsigned int    allowsColumnReordering:1;
  20.     unsigned int    allowsColumnResizing:1;
  21.     unsigned int    drawsGrid:1;
  22.     unsigned int    allowsEmptySelection:1;
  23.     unsigned int    allowsMultipleSelection:1;
  24.     unsigned int    allowsColumnSelection:1;
  25.     unsigned int    selectionType:2;
  26.     unsigned int    changingLayout:1;
  27.     unsigned int    compareWidthWithSuperview:2;
  28.     unsigned int    delegateWillDisplayCell:1;
  29.     unsigned int    delegateShouldEditTableColumn:1;
  30.     unsigned int    delegateShouldSelectRow:1;
  31.     unsigned int    delegateShouldSelectTableColumn:1;
  32.     unsigned int    delegateSelectionShouldChangeInTableView:1;
  33.     unsigned int    autoresizesAllColumnsToFit:1;
  34.     unsigned int    dataSourceSetObjectValue:1;
  35.     unsigned int    selectionPostingDisableCount:7;
  36.     unsigned int    movedPostingDisableCount:6;
  37.     unsigned int    refusesFirstResponder:1;
  38. #else
  39.     unsigned int    refusesFirstResponder:1;
  40.     unsigned int    movedPostingDisableCount:6;
  41.     unsigned int    selectionPostingDisableCount:7;
  42.     unsigned int    dataSourceSetObjectValue:1;
  43.     unsigned int    autoresizesAllColumnsToFit:1;
  44.     unsigned int    delegateSelectionShouldChangeInTableView:1;
  45.     unsigned int    delegateShouldSelectTableColumn:1;
  46.     unsigned int    delegateShouldSelectRow:1;
  47.     unsigned int    delegateShouldEditTableColumn:1;
  48.     unsigned int    delegateWillDisplayCell:1;
  49.     unsigned int    compareWidthWithSuperview:2;
  50.     unsigned int    changingLayout:1;
  51.     unsigned int    selectionType:2;
  52.     unsigned int    allowsColumnSelection:1;
  53.     unsigned int    allowsMultipleSelection:1;
  54.     unsigned int    allowsEmptySelection:1;
  55.     unsigned int    drawsGrid:1;
  56.     unsigned int    allowsColumnResizing:1;
  57.     unsigned int    allowsColumnReordering:1;
  58. #endif
  59. } _TvFlags;
  60.  
  61. @interface NSTableView : NSControl
  62. {
  63.     NSTableHeaderView    *_headerView;
  64.     NSView        *_cornerView;
  65.     NSMutableArray         *_tableColumns;
  66.     NSCell        *_editingCell;
  67.     id            _delegate;
  68.     id            _dataSource;
  69.     NSSize        _intercellSpacing;
  70.     float        _rowHeight;
  71.     int            _lastSelectedColumn;
  72.     int            _lastSelectedRow;
  73.     int            _editingRow;
  74.     int            _editingColumn;
  75.     _NSSparseArray    *_selectedColumns;
  76.     _NSSparseArray    *_selectedRows;
  77.     NSImage        *_bodyDragImage;
  78.     NSColor        *_backgroundColor;
  79.     NSColor        *_gridColor;
  80.     float        _dragYPos;
  81.     id            _target;
  82.     SEL                 _action;
  83.     SEL                 _doubleAction;
  84.     NSRect        _rectOfLastColumn;
  85.     int            _lastCachedRectColumn;
  86.     NSRect        _rectOfLastRow;
  87.     int            _lastCachedRectRow;
  88.     _TvFlags            _tvFlags;
  89.     void        *_reserved;
  90. }
  91.  
  92. - (void)setDataSource:(id)aSource;
  93. - (id)dataSource;
  94. - (void)setDelegate:(id)delegate;
  95. - (id)delegate;
  96. - (void)setHeaderView:(NSTableHeaderView *)headerView;
  97. - (NSTableHeaderView *)headerView;
  98. - (void)setCornerView:(NSView *)cornerView;
  99. - (NSView *)cornerView;
  100. - (void)setAllowsColumnReordering:(BOOL)flag;
  101. - (BOOL)allowsColumnReordering;
  102. - (void)setAllowsColumnResizing:(BOOL)flag;
  103. - (BOOL)allowsColumnResizing;
  104. - (void)setAutoresizesAllColumnsToFit:(BOOL)flag;
  105. - (BOOL)autoresizesAllColumnsToFit;
  106. - (void)setDrawsGrid:(BOOL)flag;
  107. - (BOOL)drawsGrid;
  108. - (void)setIntercellSpacing:(NSSize)aSize;
  109. - (NSSize)intercellSpacing;
  110. - (void)setBackgroundColor:(NSColor *)color;
  111. - (NSColor *)backgroundColor;
  112. - (void)setGridColor:(NSColor *)color;
  113. - (NSColor *)gridColor;
  114. - (void)setRowHeight:(float)rowHeight;
  115. - (float)rowHeight;
  116.  
  117. - (NSArray *)tableColumns;
  118. - (int)numberOfColumns;
  119. - (int)numberOfRows;
  120.  
  121. - (void)addTableColumn:(NSTableColumn *)column;
  122. - (void)removeTableColumn:(NSTableColumn *)column;
  123. - (int)columnWithIdentifier:(id)identifier;
  124. - (NSTableColumn *)tableColumnWithIdentifier:(id)identifier;
  125.  
  126. - (void)tile;
  127. - (void)sizeLastColumnToFit;
  128. - (void)scrollRowToVisible:(int)row;
  129. - (void)scrollColumnToVisible:(int)column;
  130. - (void)moveColumn:(int)column toColumn:(int)newIndex;
  131.  
  132. - (void)reloadData;
  133. - (void)noteNumberOfRowsChanged;
  134.  
  135. - (int)editedColumn;
  136. - (int)editedRow;
  137. - (int)clickedColumn;
  138. - (int)clickedRow;
  139.  
  140. - (void)setDoubleAction:(SEL)aSelector;
  141. - (SEL)doubleAction;
  142.  
  143. /*
  144.  * Selection
  145.  */
  146. - (void)setAllowsMultipleSelection:(BOOL)flag;
  147. - (BOOL)allowsMultipleSelection;
  148. - (void)setAllowsEmptySelection:(BOOL)flag;
  149. - (BOOL)allowsEmptySelection;
  150. - (void)setAllowsColumnSelection:(BOOL)flag;
  151. - (BOOL)allowsColumnSelection;
  152. - (void)selectAll:(id)sender;
  153. - (void)deselectAll:(id)sender;
  154. - (void)selectColumn:(int)column byExtendingSelection:(BOOL)extend;
  155. - (void)selectRow:(int)row byExtendingSelection:(BOOL)extend;
  156. - (void)deselectColumn:(int)column;
  157. - (void)deselectRow:(int)row;
  158. - (int)selectedColumn;
  159. - (int)selectedRow;
  160. - (BOOL)isColumnSelected:(int)row;
  161. - (BOOL)isRowSelected:(int)row;
  162. - (int)numberOfSelectedColumns;
  163. - (int)numberOfSelectedRows;
  164. - (NSEnumerator *)selectedColumnEnumerator;
  165. - (NSEnumerator *)selectedRowEnumerator;
  166.  
  167.  
  168. /*
  169.  * Layout support
  170.  */
  171. - (NSRect)rectOfColumn:(int)column;
  172. - (NSRect)rectOfRow:(int)row;
  173. - (NSRange)columnsInRect:(NSRect)rect;
  174. - (NSRange)rowsInRect:(NSRect)rect;
  175. - (int)columnAtPoint:(NSPoint)point;
  176. - (int)rowAtPoint:(NSPoint)point;
  177. - (NSRect)frameOfCellAtColumn:(int)column row:(int)row;
  178.  
  179.  
  180. /*
  181.  * Text delegate methods
  182.  */
  183. - (BOOL)textShouldBeginEditing:(NSText *)textObject;
  184. - (BOOL)textShouldEndEditing:(NSText *)textObject;
  185. - (void)textDidBeginEditing:(NSNotification *)notification;
  186. - (void)textDidEndEditing:(NSNotification *)notification;
  187. - (void)textDidChange:(NSNotification *)notification;
  188.  
  189. /*
  190.  * For subclassers
  191.  */
  192. - (void)editColumn:(int)column row:(int)row withEvent:(NSEvent *)theEvent select:(BOOL)select;
  193. - (void)drawRow:(int)row clipRect:(NSRect)rect;
  194. - (void)highlightSelectionInClipRect:(NSRect)rect;
  195. - (void)drawGridInClipRect:(NSRect)rect;
  196.  
  197. @end
  198.  
  199. @interface NSObject(NSTableViewDelegate)
  200.  
  201. - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  202. - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  203. - (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView;
  204. - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(int)row;
  205. - (BOOL)tableView:(NSTableView *)tableView shouldSelectTableColumn:(NSTableColumn *)tableColumn;
  206.    
  207. @end
  208.  
  209. /*
  210.  * Notifications
  211.  */
  212. APPKIT_EXTERN NSString *NSTableViewSelectionDidChangeNotification;
  213. APPKIT_EXTERN NSString *NSTableViewColumnDidMoveNotification;        // @"NSOldColumn", @"NSNewColumn"
  214. APPKIT_EXTERN NSString *NSTableViewColumnDidResizeNotification;    // @"NSTableColumn", @"NSOldWidth"
  215. #ifndef STRICT_40
  216. APPKIT_EXTERN NSString *NSTableViewSelectionIsChangingNotification;
  217. #endif
  218.  
  219.  
  220. @interface NSObject(NSTableViewNotifications)
  221. - (void)tableViewSelectionDidChange:(NSNotification *)notification;
  222. - (void)tableViewColumnDidMove:(NSNotification *)notification;
  223. - (void)tableViewColumnDidResize:(NSNotification *)notification;
  224. #ifndef STRICT_40
  225. - (void)tableViewSelectionIsChanging:(NSNotification *)notification;
  226. #endif
  227. @end
  228.  
  229. @interface NSObject(NSTableDataSource)
  230. - (int)numberOfRowsInTableView:(NSTableView *)tableView;
  231. - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  232. - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(int)row;
  233. @end
  234.  
  235. #endif STRICT_OPENSTEP
  236.