home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / YellowBox / Kits / MiscTableScroll-138.1 / Palettes / MiscTableScroll / Framework / MiscTableView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-31  |  5.3 KB  |  166 lines

  1. #ifndef __MiscTableView_h
  2. #define __MiscTableView_h
  3. //=============================================================================
  4. //
  5. //    Copyright (C) 1995-1998 by Paul S. McCarthy and Eric Sunshine.
  6. //        Written by Paul S. McCarthy and Eric Sunshine.
  7. //                All Rights Reserved.
  8. //
  9. //    This notice may not be removed from this source code.
  10. //
  11. //    This object is included in the MiscKit by permission from the authors
  12. //    and its use is governed by the MiscKit license, found in the file
  13. //    "License.rtf" in the MiscKit distribution.  Please refer to that file
  14. //    for a list of all applicable permissions and restrictions.
  15. //    
  16. //=============================================================================
  17. //-----------------------------------------------------------------------------
  18. // MiscTableView.h
  19. //
  20. //    General-purpose 2-D display object that works with the
  21. //    MiscTableScroll to provide row/column sizing and dragging.
  22. //
  23. //    This object is responsible for drawing, mouse and keyboard
  24. //    events in the content portion of the display.
  25. //
  26. //-----------------------------------------------------------------------------
  27. //-----------------------------------------------------------------------------
  28. // $Id: MiscTableView.h,v 1.17 98/03/22 13:13:03 sunshine Exp $
  29. // $Log:    MiscTableView.h,v $
  30. //  Revision 1.17  98/03/22  13:13:03  sunshine
  31. //  v133.1: Now prints corner view.
  32. //  
  33. //  Revision 1.16  97/11/23  07:41:24  sunshine
  34. //  v130.1: Broke off MiscTableViewDrag.M and MiscTableViewCursor.M
  35. //  
  36. //  Revision 1.15  97/06/18  10:02:36  sunshine
  37. //  v125.9: Worked around Objective-C++ compiler crash in OPENSTEP 4.2 for NT
  38. //  when sending message to 'super' from within a category.  Unified naming.
  39. //  numVisibleSlots: --> numberOfVisibleSlots:
  40. //  "highlight" --> "selected" in color-related method names.
  41. //-----------------------------------------------------------------------------
  42. extern "Objective-C" {
  43. #import <AppKit/NSView.h>
  44. }
  45. #import <MiscTableScroll/MiscTableTypes.h>
  46.  
  47. @class MiscBorderView, MiscCornerView, MiscMouseTracker, MiscTableScroll;
  48. @class NSCell, NSText;
  49. class MiscSparseSet;
  50. class MiscTableBorder;
  51.  
  52. struct MiscTSPageBreak
  53.     {
  54.     MiscPixels        offset;
  55.     MiscPixels        size;
  56.     MiscCoord_V        first;    // One's comp if started on earlier page.
  57.     MiscCoord_V        last;    // One's comp if ends on later page.
  58.     };
  59.  
  60. struct MiscTSPageImages
  61.     {
  62.     NSImage*        page_header;
  63.     NSImage*        page_footer;
  64.     NSImage*        col_titles;
  65.     NSImage*        row_titles;
  66.     NSImage*        corner_view;
  67.     };
  68.  
  69. struct MiscTablePages
  70.     {
  71.     MiscTablePrintInfo    info;
  72.     MiscTSPageBreak*    col_breaks;
  73.     MiscTSPageBreak*    row_breaks;
  74.     MiscTSPageImages*    images;
  75.     id            pageHeader;
  76.     id            pageFooter;
  77.     MiscBorderView*    colTitles;
  78.     MiscBorderView*    rowTitles;
  79.     MiscCornerView*    cornerView;
  80.     float        page_header_height;
  81.     float        page_footer_height;
  82.     float        col_titles_height;
  83.     float        row_titles_width;
  84.     };
  85.  
  86.  
  87. @interface MiscTableView : NSView
  88.     {
  89.     MiscTableBorder*    colBorder;
  90.     MiscTableBorder*    rowBorder;
  91.     MiscBorderType    trackerBorder;
  92.     MiscMouseTracker*    tracker;
  93.     MiscSparseSet*    oldColSel;
  94.     MiscSparseSet*    oldRowSel;
  95.     MiscTablePages*    pages;
  96.     unsigned int    inhibitCursor;
  97.     MiscCoord_V        cursorSlot;
  98.     }
  99.  
  100. - (id)initWithFrame:(NSRect)r
  101.     scroll:(MiscTableScroll*)s
  102.     colInfo:(MiscTableBorder*)colBorder
  103.     rowInfo:(MiscTableBorder*)rowBorder;
  104. - (void)adjustSize;
  105. - (id)scroll;
  106.  
  107. - (NSRect)cellInsideAtRow:(MiscCoord_P)row column:(MiscCoord_P)col;
  108. - (NSRect)cellFrameAtRow:(int)row column:(int)col;    // Physical coords
  109. - (BOOL)getRow:(int*)row column:(int*)col        // Physical coords
  110.     forPoint:(NSPoint)point;
  111.  
  112. - (void)drawCellAtRow:(int)row column:(int)col;        // Physical coords
  113. - (void)drawRow:(int)row;                // Physical coord
  114. - (void)drawColumn:(int)col;                // Physical coord
  115.  
  116. - (void)scrollCellToVisibleAtRow:(int)row column:(int)col; // Physical coords
  117. - (void)scrollRowToVisible:(int)row;            // Physical coord
  118. - (void)scrollColumnToVisible:(int)col;            // Physical coord
  119.  
  120. - (int)numberOfVisibleSlots:(MiscBorderType)b;        // All physical coords.
  121. - (int)firstVisibleSlot:(MiscBorderType)b;
  122. - (int)lastVisibleSlot:(MiscBorderType)b;
  123. - (BOOL)border:(MiscBorderType)b slotIsVisible:(int)n;
  124. - (void)border:(MiscBorderType)b setFirstVisibleSlot:(int)n;
  125. - (void)border:(MiscBorderType)b setLastVisibleSlot:(int)n;
  126.  
  127. - (void)setSelectionMode:(MiscSelectionMode)mode;
  128. - (void)selectionChanged;
  129. - (void)resetSelection;
  130. - (void)trackBy:(MiscBorderType)b;
  131. - (MiscBorderType)trackingBy;
  132.  
  133. - (BOOL)sendAction:(SEL)cmd to:(id)obj;
  134. - (void)mouseDown:(NSEvent*)event;
  135.  
  136. - (void)superPrint:(id)sender;    // See implementation for explanation.
  137.  
  138. @end
  139.  
  140. // KEYBOARD CURSOR ------------------------------------------------------------
  141. @interface MiscTableView(Cursor)
  142. - (void)reflectCursor;
  143.  
  144. - (void)disableCursor;        // Can nest.
  145. - (void)enableCursor;
  146. - (BOOL)isCursorEnabled;
  147. - (void)drawCursor;
  148. - (void)eraseCursor;
  149. - (BOOL)shouldDrawCursor;
  150.  
  151. - (void)keyboardSelect:(NSEvent*)p;
  152. - (void)moveCursorBy:(int)delta;
  153. @end
  154.  
  155. // PRINTING -------------------------------------------------------------------
  156. @interface MiscTableView(Print)
  157. - (void)print:(id)sender;
  158. - (BOOL)knowsPagesFirst:(int*)first last:(int*)last;
  159. - (NSRect)rectForPage:(int)n;
  160. - (NSPoint)locationOfPrintRect:(NSRect)rect;
  161. - (void)drawPageBorderWithSize:(NSSize)size;
  162. - (MiscTablePrintInfo const*)getPrintInfo;
  163. @end
  164.  
  165. #endif // __MiscTableView_h
  166.