home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / lang / listmana.sha / list.h < prev    next >
C/C++ Source or Header  |  1986-07-10  |  5KB  |  118 lines

  1. #include                <quickdraw.h>
  2. #include                <control.h>
  3. #include                <window.h>
  4.  
  5. typedef         Point           Cell;
  6.  
  7. typedef         char            DataArray[32000];
  8. typedef         DataArray       *DataPtr;
  9. typedef         DataPtr         *DataHandle;
  10.  
  11. typedef struct
  12. {
  13.         Rect                            rView;
  14.         GrafPtr                         port;
  15.         Point                           indent,
  16.                                         cellSize;
  17.         Rect                            visible;
  18.         ControlHandle                   vScroll,
  19.                                         hScroll;
  20.         Byte                            selFlags;
  21.         Boolean                         LActive;
  22.         Byte                            LReserved,
  23.                                         listFlags;
  24.         long                            clikTime;
  25.         Point                           clikLoc,
  26.                                         mouseLoc;
  27.         Ptr                             LClikLoop;
  28.         Cell                            lastClick;
  29.         long                            refCon;
  30.         Handle                          listDefProc,
  31.                                         userHandle;
  32.         Rect                            dataBounds;
  33.         DataHandle                      cells;
  34.         short                           maxIndex;
  35.         int                             cellArray[1];
  36. } ListRec;
  37.  
  38. typedef ListRec                 *ListPtr;
  39. typedef ListPtr                 *ListHandle;
  40.  
  41. #define                 LDoVAutoScroll  2
  42. #define                 LDoHAutoScroll  1
  43.  
  44. #define                 LOnlyOne                128
  45. #define                 LExtendDrag             64
  46. #define                 LNoDisjoint             32
  47. #define                 LNoExtend               16
  48. #define                 LNoRect                 8
  49. #define                 LUseSense               4
  50. #define                 LNoNilHilite    2
  51.  
  52. pascal void             Pack0_v() = 0xa9e7;
  53. pascal short            Pack0_w() = 0xa9e7;
  54. pascal long             Pack0_l() = 0xa9e7;
  55.  
  56. /* Note -- Aztec C is supposed to know Booleans are 0x0100, but that
  57.  *        seems to be enforced only through .h files.  So here it is
  58.  *        enforced by "(256 == Pack0_w(...))".
  59.  * A similar technique is used in LActivate to make the Boolean
  60.  * argument there be either 0x100 or 0, "a ? 256 : 0".
  61.  */
  62.  
  63. /* Creating and Disposing Lists */
  64. #define LNew(a,b,c,d,e,f,g,h,i) ((ListHandle) Pack0_l(a,b,c,d,e,f,g,h,i,68))
  65. #define LDispose(a)                     (Pack0_v(a, 40))
  66.  
  67. /* Operations on Rows and Columns */
  68. #define LAddColumn(a,b,c)               (Pack0_w(a,b,c,4))
  69. #define LAddRow(a,b,c)                  (Pack0_w(a,b,c,8))
  70. #define LDelColumn(a,b,c)               (Pack0_v(a,b,c,32))
  71. #define LDelRow(a,b,c)                  (Pack0_v(a,b,c,36))
  72.  
  73. /* Operations on Cells */
  74. #define LAddToCell(a,b,c,d)             (Pack0_v(a,b,c,d,12))
  75. #define LClrCell(a,b)                   (Pack0_v(a,b,28))
  76. #define LGetCell(a,b,c,d)               (Pack0_v(a,b,c,d,56))
  77. #define LSetCell(a,b,c,d)               (Pack0_v(a,b,c,d,88))
  78. #define LCellSize(a,b)                  (Pack0_v(a,b,20))
  79. #define LGetSelect(a,b,c)       (256 == Pack0_w(a,b,c,60))
  80. #define LSetSelect(a,b,c)               (Pack0_v(a,b,c,92))
  81.  
  82. /* Mouse Location */
  83. #define LClick(a,b,c)           (256 == Pack0_w(a,b,c,24))
  84. #define LLastClick(a)                   ((long) Pack0_l(a,64))
  85.         /* Aztec C can't return structure, (long) means (Cell) */
  86.  
  87. /* Accessing Cells */
  88. #define LFind(a,b,c,d)                  (Pack0_v(a,b,c,d,52))
  89. #define LNextCell(a,b,c,d)      (256 == Pack0_w(a,b,c,d,72))
  90. #define LRect(a,b,c)                    (Pack0_v(a,b,c,76))
  91. #define LSearch(a,b,c,d,e)      (256 == Pack0_w(a,b,c,d,e,84))
  92. #define LSize(a,b,c)                    (Pack0_v(a,b,c,96))
  93.  
  94. /* List Display */
  95. #define LDraw(a,b)                      (Pack0_v(a,b,48))
  96. #define LDoDraw(a,b)                    (Pack0_v(a,b,44))
  97. #define LScroll(a,b,c)                  (Pack0_v(a,b,c,80))
  98. #define LAutoScroll(a)                  (Pack0_v(a,16))
  99. #defi
  100. ne LUpdate(a,b)                    (Pack0_v(a,b,100))
  101. /* picky LActivate wants Boolean argument to be 0 for deactivate
  102.  * or 0x0100 for activate!!
  103.  *   If we just send 0 or 1, there is interaction with the drawIt
  104.  * that is used in the preceding LDoDraw call.  The 1 for activate,
  105.  * accompanied by TRUE for drawIt, will *clear* the LActive byte
  106.  * in the ListRec structure, and LClick will not call the LDEF
  107.  * LHilite routine to invert a cell when it is clicked to select it.
  108.  * If drawIt is FALSE, then LActivate handles a 1 for activate OK!!
  109.  */
  110. #define LActivate(a,b)                  (Pack0_v(a ? 256 : 0,b,0))
  111.  
  112. #undef  Pascal
  113.  
  114. #define LInitMsg    0
  115. #define LDrawMsg    1
  116. #define LHiliteMsg    2
  117. #define LCloseMsg    3
  118.