home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / dbkit / DBTableView.h < prev    next >
Text File  |  1992-07-09  |  6KB  |  235 lines

  1. /*
  2. **      DBTableView.h
  3. **      Database Kit, Release 3.0
  4. **      Copyright (c) 1992, NeXT Computer, Inc.  All rights reserved. 
  5. */
  6. #import <appkit/graphics.h>
  7. #import <appkit/ScrollView.h>
  8. #import <dbkit/tableProtocols.h>
  9.  
  10. typedef enum {
  11.     DB_RADIOMODE = 0,
  12.     DB_LISTMODE = 2,    /* these defs are same as NX_xxxx */
  13.     DB_NOSELECT = 5
  14. } DBSelectionMode;
  15.  
  16.  
  17. @interface DBTableView : ScrollView
  18. {
  19. @private
  20.     struct {
  21.     unsigned int    hideRows:1,
  22.             hideColumns:1,
  23.             editingAllowed:1,
  24.             dynamicRows:1,
  25.             dynamicColumns:1,
  26.             radioMode:1,
  27.             listMode:1,
  28.             allowEmpty:1,
  29.             gridVisible:1,
  30.             useArrowKeys:1,
  31.             allowsReordering:1,
  32.             allowsResizing:1,
  33.             unused:1,
  34.             clicks:3,
  35.             :16;
  36.     } _tvFlags;
  37.     
  38.     unsigned int    _tvReserved[3];
  39.     unsigned int    _startVec,
  40.             _lastDragVec;
  41.     int        _lastSelVector;
  42.     id        _dragImage;
  43.  
  44.     id        _textFmt;        /* default formatters */
  45.     id        _editFmt;
  46.  
  47. @protected
  48.     id        dataSource;
  49.     id        delegate;        /* gets doubleClick message */
  50.     
  51.     id        rowLayout;        /* row/col layout info */
  52.     id        columnLayout;
  53.     id        rowHeading;        /* shows row/col headings */
  54.     id        columnHeading;
  55.     id        rowsClip;        /* clip views for headings */
  56.     id        columnsClip;
  57.     id        gridView;        /* the actual data view */
  58.     id        rowSel;
  59.     id        columnSel;
  60.     id        cornerView;        /* view in upper left corner */
  61.  
  62.     id        target;
  63.     SEL        doubleAction;
  64.     SEL        action;
  65. }
  66.  
  67. - initFrame:(const NXRect *) newFrame;
  68. - free;
  69.  
  70. - setDataSource:aSource;
  71. - dataSource;
  72.  
  73. - setDelegate:newDelegate;
  74. - delegate;
  75.  
  76. - (BOOL) dynamicRows;
  77. - (BOOL) dynamicColumns;
  78.  
  79. - setRowHeadingVisible: (BOOL) flag;
  80. - (BOOL) isRowHeadingVisible;
  81.  
  82. - setColumnHeadingVisible: (BOOL) flag;
  83. - (BOOL) isColumnHeadingVisible;
  84.  
  85. - setIntercell:(const NXSize *) aSize;
  86. - getIntercell:(NXSize *) theSize;
  87.  
  88. - setGridVisible:(BOOL) flag;
  89. - (BOOL) isGridVisible;
  90.  
  91. - acceptArrowKeys:(BOOL) flag;
  92. - (BOOL) doesAcceptArrowKeys;
  93.  
  94. - allowVectorReordering:(BOOL) flag;
  95. - (BOOL) doesAllowVectorReordering;
  96.  
  97. - allowVectorResizing:(BOOL) flag;
  98. - (BOOL) d$    YllowVectorResizing;
  99.  
  100. - (BOOL) isHorizScrollerVisible;
  101. - setHorizScrollerRequired:(BOOL) flag;
  102. - (BOOL) isVertScrollerVisible;
  103. - setVertScrollerRequired:(BOOL) flag;
  104.  
  105. /*
  106.  *  Displaying the view
  107.  */
  108. - drawSelf:(const NXRect *) rects :(int) count;
  109.  
  110. /*
  111.  *  Handling rows/columns
  112.  */
  113. - columnList;
  114. - rowList;
  115.  
  116. - (unsigned int) columnCount;
  117. - (unsigned int) rowCount;
  118.  
  119. - (id <DBTableVectors>) rowAt:(unsigned int) aPosition;
  120. - (id <DBTableVectors>) columnAt:(unsigned int) aPosition;
  121.  
  122. - addColumn:identifier withTitle:(const char *) title;
  123. - addColumn:identifier withFormatter:formatter andTitle:(const char *) title at:(unsigned int) aPosition;
  124.  
  125. - addRow:identifier withTitle:(const char *) title;
  126. - addRow:identifier withFormatter:formatter andTitle:(const char *) title at:(unsigned int) aPosition;
  127.  
  128. - addColumn:aColumn at:(unsigned int) aPosition;
  129. - removeColumnAt:(unsigned int) aPosition;
  130.  
  131. - addRow:aRow at:(unsigned int) aPosition;
  132. - removeRowAt:(unsigned int) aPosition;
  133.  
  134. - (BOOL) moveColumnFrom:(unsigned int) oldPos to:(unsigned int) newPos;
  135. - (BOOL) moveRowFrom:(unsigned int) oldPos to:(unsigned int) newPos;
  136.  
  137. - formatterAt:(unsigned int) row :(unsigned int) column;
  138.  
  139. /*
  140.  *  Editing support.
  141.  */
  142. - editFieldAt:(unsigned int) row :(unsigned int) column;
  143. - setEditable:(BOOL) flag;
  144. - (BOOL) isEditable;
  145. - endEditing;
  146.  
  147. /*
  148.  *  Dealing with the selection
  149.  */
  150. - setMode:(int) newMode;
  151. - (int) mode;
  152.  
  153. - allowEmptySel:(BOOL) flag;
  154. - (BOOL) doesAllowEmptySel;
  155.  
  156. - (unsigned int) selectedRowCount;
  157. - (unsigned int) selectedColumnCount;
  158.  
  159. - (int) selectedRow;
  160. - (int) selectedColumn;
  161.  
  162. - (BOOL) isRowSelected:(unsigned int) row;    /* for either mode */
  163. - (BOOL) isColumnSelected:(unsigned int) column;
  164.  
  165. - deselectAll:sender;            /* for List mode selection */
  166. - selectAll:sender;
  167.  
  168. - setRowSelectionOn:(unsigned int) start :(unsigned int) end to:(BOOL) flag;
  169. - setColumnSelectionOn:(unsigned int) start :(unsigned int) end to:(BOOL) flag;
  170.  
  171. - selectRow:(unsigned int) row byExtension:(BOOL) flag;
  172. - selectColumn:(unsigned int) column byExtension:(BOOL) flag;
  173.  
  174. - deselectRow:(unsigned int) row;
  175. - deselectColumn:(unsigned int) column;
  176.  
  177. - (unsigned int) selectedRowAfter:(unsigned int) aRow;
  178. - (unsigned int) selectedColumnAfter:(unsigned int) aColumn;
  179.  
  180. - sendAction:(SEL) anAction to:anObject forSelectedRows:(BOOL) flag;
  181. - sendAction:(SEL) anAction to:anObject fo$    `ectedColumns:(BOOL) flag;
  182.  
  183. /*
  184.  *  Setting and finding out about pieces of the table.
  185.  */
  186. - rowHeading;
  187. - setRowHeading:newRowHeading;
  188. - columnHeading;
  189. - setColumnHeading:newColumnHeading;
  190.  
  191. /*
  192.  *  Notifications of change
  193.  */
  194. - rowsChangedFrom:(unsigned int) startRow to:(unsigned int) endRow;
  195. - columnsChangedFrom:(unsigned int) startColumn to:(unsigned int) endColumn;
  196. - reloadData:sender;        /* update layout & redisplay all data */
  197. - layoutChanged:sender;        /* # rows, # cols or size changed */
  198.  
  199. /*
  200.  *  Scrolling and other view methods
  201.  */
  202. - scrollRowToVisible:(unsigned int) row;
  203. - scrollColumnToVisible:(unsigned int) column;
  204. - scrollClip:aClip to:(const NXPoint *)newOrigin;
  205. - sizeTo:(NXCoord) width:(NXCoord) height;
  206. - (BOOL) acceptsFirstResponder;
  207. - tile;
  208.  
  209. /*
  210.  *  Target and Action
  211.  */
  212. - setAction:(SEL)aSelector;
  213. - (SEL)action;
  214. - setDoubleAction:(SEL)aSelector;
  215. - (SEL)doubleAction;
  216. - setTarget:anObject;
  217. - target;
  218.  
  219. /*
  220.  *  Archiving
  221.  */
  222. - read:(NXTypedStream *) stream;
  223. - write:(NXTypedStream *) stream;
  224. - finishUnarchiving;
  225.  
  226. @end
  227.  
  228. @interface Object(DBTableViewDelegate)
  229. - tableViewDidChangeSelection:aTableView;
  230. - (BOOL) tableViewWillChangeSelection:aTableView;
  231. - tableView:sender movedColumnFrom:(unsigned int) old to:(unsigned int) new;
  232. - tableView:sender movedRowFrom:(unsigned int) old to:(unsigned int) new;
  233. @end
  234.  
  235.