home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Code Resources / Jims CDEFs 1.50 / CDEF Source / source / grayCDEF.c < prev    next >
Encoding:
Text File  |  1995-11-08  |  1.5 KB  |  55 lines  |  [TEXT/KAHL]

  1. //------------------------- © 1994-1995 by James G. Stout --------------------------
  2. // File        : grayCDEF.c
  3. // Date        : September 26, 1994
  4. // Author    : Jim Stout
  5. // Purpose    : support routines for CDEF's that can be disabled
  6. //----------------------------------------------------------------------------------
  7. #include <GestaltEqu.h>
  8. #include <ToolUtils.h>
  9. #include <Palettes.h>
  10. #include <Traps.h>
  11.  
  12. #include "grayCDEF.h"
  13. #include "miscCDEF.h"
  14.  
  15. //==================================================================================
  16. //    Returns true if a System 7 style gray color was available and returns the 
  17. //    grayish color in theGray - DOES NOT CHECK FOR COLOR SUPPORT
  18. //==================================================================================
  19.  
  20. extern Boolean getGray(RGBColor *rgbGray)
  21. {
  22.     RGBColor    rgbBack;
  23.     GDHandle    hThisDevice;
  24.     
  25.     GetForeColor(rgbGray);
  26.     if(getOSVers() >= 0x0700) {
  27.         GetBackColor(&rgbBack);
  28.         hThisDevice = GetGDevice();
  29.         if(GetGray(hThisDevice,&rgbBack,rgbGray))
  30.             return true;
  31.     }
  32.     return false;
  33. }
  34.  
  35. //==================================================================================
  36. //    Return true if Gestalt says GrayishTextOr mode is present 
  37. //==================================================================================
  38.  
  39. Boolean haveGrayText    (void)
  40. {
  41.     OSErr        err;
  42.     short        bit = gestaltHasGrayishTextOr;
  43.     long        gResult;
  44.     Boolean        result = false;
  45.     
  46.     if(trapAvailable(_Gestalt)) {
  47.         err = Gestalt(gestaltQuickdrawFeatures,&gResult);
  48.         if(err == noErr) {
  49.             if(BitTst(&gResult, 31-bit))
  50.                 result = true;
  51.         }
  52.     }
  53.     return(result);
  54. }
  55.