home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Snippets / Life Simulator / HandleDialog.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-04  |  951 b   |  50 lines  |  [TEXT/MMCC]

  1. /* Cell Proj 1.0 */
  2.  
  3. #include "Cell_Proto.h"
  4. #include "Cell_Definitions.h"
  5. #include "Cell_Variables.h"
  6.  
  7. DoPreCheck()
  8. {
  9.     char    theChar;
  10.  
  11.     switch ( gTheEvent.what )
  12.     {
  13.         case autoKey:
  14.         case keyDown:
  15.             theChar = gTheEvent.message & charCodeMask;
  16.             if (( gTheEvent.modifiers & cmdKey ) != 0 )
  17.                 HandleMenuChoice( MenuKey( theChar ));
  18.             break;
  19.         case activateEvt:
  20.             if ( (WindowPtr)gTheEvent.message == gCellInfoDialog )
  21.             {
  22.                 if (( gTheEvent.modifiers & activeFlag ) != 0 )
  23.                 {
  24.                     SetPort( gCellInfoDialog );
  25.                     SelectWindow( gCellInfoDialog );
  26.                 }
  27.                 else
  28.                 {
  29.                     SetPort( gCellInfoDialog );
  30.                 }
  31.             }
  32.             break;
  33.         case updateEvt:
  34.             if ( (WindowPtr)gTheEvent.message == gCellInfoDialog )
  35.             {
  36.                 BeginUpdate( gCellInfoDialog );
  37.                 DrawDialog( gCellInfoDialog );
  38.                 EndUpdate( gCellInfoDialog );
  39.             }
  40.             break;
  41.     }
  42. }            
  43.  
  44. HandleDialog()
  45. {
  46.     short        itemHit;
  47.     DialogPtr    theDialog;
  48.     
  49.     DialogSelect( &gTheEvent, &theDialog, &itemHit );
  50. }