Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Environment and Utilities /
Chapter 1 - QuickDraw GX and the Macintosh Environment / Using QuickDraw GX in the Macintosh Environment


Testing for the Presence and Version of QuickDraw GX

You can use the Gestalt function in your application to determine which parts of QuickDraw GX are installed and their version numbers. The Gestalt function returns a 32-bit value that indicates the version of QuickDraw GX that is installed. The graphics and typography part of QuickDraw GX has one version number, the printing part of QuickDraw GX has another, and there is an overall version number that applies to all of QuickDraw GX. In addition, you can determine if the debugging version or the non-debugging version of QuickDraw GX is installed, and if the installed version is native to PowerPC system software.

To determine the current version of QuickDraw GX in general, you call the Gestalt function with the gestaltGXVersion selector. The function returns a value indicating the version of QuickDraw GX printing currently installed. For version 1.0, the value returned is 0x00010000.

To determine the current version of the graphics and typography parts of QuickDraw GX, you call the Gestalt function with the gestaltGraphicsVersion selector. The function returns a value indicating the version of QuickDraw GX graphics and typography currently installed. For version 1.0, the value returned is 0x00010000.

To determine the current version of the printing part of QuickDraw GX, you call the Gestalt function with the gestaltPrintingMgrVersion selector. The function returns a value indicating the version of QuickDraw GX printing currently installed. For version 1.0, the value returned is 0x00010000.

To determine if the debugging or non-debugging version of QuickDraw GX is currently installed, or if the installed version is native to PowerPC system software, you call the Gestalt function with the gestaltGraphicsAttr selector. The gestaltGraphicsisDebugging attribute value is returned if the debugging version of QuickDraw GX is installed. The gestaltGraphicsisLoaded attribute value is returned if the non-debugging version of QuickDraw GX is installed. The gestaltGraphicsIsPowerPC attribute value is returned if the installed version of QuickDraw GX is PowerPC-native. The return value can be any combination of those attributes.

Listing 1-1 uses the gestaltGraphicsVersion and gestaltPrintingMgrVersion selectors to determine whether QuickDraw GX graphics and typography as well as QuickDraw GX printing are installed. This listing also uses the gestaltGraphicsAttr selector to determine whether the installed version of QuickDraw GX is the debugging or non-debugging version.

Listing 1-1 Determining the presence and features of QuickDraw GX

Boolean QuickDrawGXAvailable(Boolean *pIsDebugging)
{
   Boolean returnValue = false;
   long theFeature, flags;
   if(Gestalt(gestaltGraphicsVersion, &theFeature) == noErr)
      {
         returnValue = true;
         if (Gestalt(gestaltPrintingMgrVersion, &theFeature) == 
                                                         noErr)
            gQDGXPrintingInstalled = true;
      }
   else
      returnValue = false;
   if (Gestalt(gestaltGraphicsAttr, &theFeature) == noErr)
      {
         if (flags & gestaltGraphicsisDebugging)
            pIsDebugging = true; 
         else
            pIsDebugging = false;
      }
   return returnValue;
}
For additional details concerning the use of the Gestalt function to determine features of the QuickDraw GX environment, see the chapter "Gestalt Manager" in Inside Macintosh: Operating System Utilities.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996