home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / BlobMgr / Library Folder / Hilite.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-21  |  1.8 KB  |  101 lines  |  [TEXT/KAHL]

  1. # include    "BlobMgr.h"
  2.  
  3.  
  4. /* -------------------------------------------------------------------- */
  5. /*                    Blob State Change Display Routines                    */
  6. /* -------------------------------------------------------------------- */
  7.  
  8.  
  9.  
  10. /*
  11.  * Set the drawing mode for the given part of the blob.
  12.  * Redraw if it changes.
  13.  */
  14.  
  15. pascal void
  16. HiliteBlob (BlobHandle b, short partCode, short mode)
  17. {
  18.  
  19.     if ((partCode == inDragBlob) || (partCode == inFullBlob))
  20.     {
  21.         if (GetBDrawMode (b, inDragBlob) != mode)
  22.         {
  23.             SetBDrawMode (b, inDragBlob, mode);
  24.             DrawBlob (b, inDragBlob);
  25.         }
  26.     }
  27.     if ((partCode == inStatBlob) || (partCode == inFullBlob))
  28.     {
  29.         if (GetBDrawMode (b, inStatBlob) != mode)
  30.         {
  31.             SetBDrawMode (b, inStatBlob, mode);
  32.             DrawBlob (b, inStatBlob);
  33.         }
  34.     }
  35. }
  36.  
  37.  
  38. pascal void
  39. HiliteBlobSet (BlobSetHandle bSet, short partCode, short mode)
  40. {
  41. BlobHandle    b;
  42.  
  43.     for (b = FirstBlob (bSet); b != nil; b = NextBlob (b))
  44.         HiliteBlob (b, partCode, mode);
  45. }
  46.  
  47.  
  48. /*
  49.  * Increment use count of blob and dim drag area if at or above maximum
  50.  * glue count.
  51.  */
  52.  
  53. pascal void
  54. IncBlobGlue (BlobHandle b)
  55. {
  56.     if ((**b).glueMax != infiniteGlue)
  57.     {
  58.         ++((**b).glueCount);
  59.         if ((**b).glueCount >= (**b).glueMax)
  60.             HiliteBlob (b, inDragBlob, dimDraw);
  61.     }
  62. }
  63.  
  64.  
  65. /*
  66.  * Decrement use count of blob and undim drag area if less than maximum
  67.  * glue count.
  68.  */
  69.  
  70. pascal void
  71. DecBlobGlue (BlobHandle b)
  72. {
  73.     if ((**b).glueMax != infiniteGlue)
  74.     {
  75.         --((**b).glueCount);
  76.         if ((**b).glueCount < (**b).glueMax)
  77.             HiliteBlob (b, inDragBlob, normalDraw);
  78.     }
  79. }
  80.  
  81.  
  82. pascal void
  83. SetBGlueMax (BlobHandle b, short max)
  84. {
  85.     (**b).glueMax = max;
  86.  
  87.     /* dim or undim appropriately */
  88.  
  89.     if ((**b).glueCount < max || max == infiniteGlue)
  90.         HiliteBlob (b, inDragBlob, normalDraw);
  91.     else
  92.         HiliteBlob (b, inDragBlob, dimDraw);
  93. }
  94.  
  95.  
  96. pascal short
  97. GetBGlueMax (BlobHandle b)
  98. {
  99.     return ((**b).glueMax);
  100. }
  101.