home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Sample Code / Networking / JSaver / AfterDarkSDK / GraphicsModule.c < prev   
Encoding:
C/C++ Source or Header  |  1997-06-05  |  2.5 KB  |  84 lines  |  [TEXT/MPCC]

  1. /*
  2.     JustOvals.c
  3.     
  4.     CodeWarior version.
  5.     
  6.     This file provides a generic interface for writing a After Dark™ graphics module.
  7.     The function "main" is called by After Dark and passed four parameters:
  8.     
  9.         storage:    A Handle to memory you have allocated.
  10.         blankRgn:    A region covering all screens.
  11.         message:    A value indicating which function to call.
  12.         params:        A pointer to a structure containing useful information.
  13.         
  14.     To use it, write the five routines:
  15.     
  16.     OSErr DoInitialize(Handle *storage, RgnHandle blankRgn, GMParamBlockPtr params);
  17.     OSErr DoClose(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  18.     OSErr DoBlank(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  19.     OSErr DoDrawFrame(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  20.     OSErr DoSetUp(RgnHandle blankRgn, short message, GMParamBlockPtr params);
  21.     
  22.     For more information, consult the programmer's section of the manual.
  23.     
  24.     The following people are all conspirators in this code:
  25.         Patrick Beard
  26.         Bruce Burkhalter
  27.         Colin Glassey
  28.         Andrew Armstrong
  29.     
  30.     ©1989-1995 Berkeley Systems, Inc.
  31.  */
  32.  
  33. #include <QuickDraw.h>
  34. #include "GraphicsModule_Types.h"
  35.  
  36. extern OSErr DoInitialize(Handle *storage, RgnHandle blankRgn, GMParamBlockPtr params);
  37. extern OSErr DoClose(Handle storage,RgnHandle blankRgn,GMParamBlockPtr params);
  38. extern OSErr DoBlank(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  39. extern OSErr DoDrawFrame(Handle storage,RgnHandle blankRgn,GMParamBlockPtr params);
  40. extern OSErr DoSetUp(RgnHandle blankRgn,short message,GMParamBlockPtr params);
  41.  
  42. pascal OSErr main(Handle *storage, RgnHandle blankRgn, short message, GMParamBlockPtr params)
  43. {
  44.     OSErr err=noErr;
  45.  
  46.     /* dispatch message to appropriate routine. */
  47.     switch(message) {
  48.         case Initialize:
  49.             err = DoInitialize(storage, blankRgn, params);
  50.             break;
  51.         
  52.         case Close:
  53.             err = DoClose(*storage, blankRgn, params);
  54.             break;
  55.         
  56.         case Blank:
  57.             err = DoBlank(*storage, blankRgn, params);
  58.             break;
  59.             
  60.         case DrawFrame:
  61.             err = DoDrawFrame(*storage, blankRgn, params);
  62.             break;
  63.         
  64.         /*    There are other messages that can be passed to you. We aren't going to handle them
  65.             but I've included them to make your life simpler.
  66.         
  67.         case ModuleSelected:
  68.             err=DoSelected(*storage, blankRgn, params);
  69.             break;
  70.             
  71.         case DoAbout:
  72.             err=DoAbout(*storage, blankRgn, params);
  73.             break;
  74.         */
  75.         
  76.         default:                            // Check to see if the user pressed a button
  77.             if(message>=ButtonMessage) {
  78.                 err=DoSetUp(blankRgn, message, params);
  79.             }
  80.             break;
  81.     } /* end switch */
  82.     return err;
  83. }
  84.