home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 2 / MacMania 2.toast / Demo's / Tools&Utilities / Programming / FadeToBlack Folder / clut_fade / source / Shell.c < prev   
Encoding:
C/C++ Source or Header  |  1993-12-20  |  1.8 KB  |  86 lines  |  [TEXT/KAHL]

  1. /********************************************************************************
  2.          Copyright  ©  N. Jonas Englund, 1993.    All Rights Reserved.
  3.  ********************************************************************************
  4.  
  5.      PROJECT:    clut_fade.π
  6.      
  7.      FILE:        shell.c
  8.      
  9.      PURPOSE:    'clut' fading functions
  10.  
  11.  ********************************************************************************/
  12.  
  13. //=================================    INCLUDES ====================================
  14.  
  15. #include "shell.h"
  16. #include "fade.h"
  17.  
  18. //=================================    FUNCTIONS ===================================
  19.  
  20. void init_toolbox(void);
  21. void test_window(void);
  22.  
  23. /*********************************** main ***************************************/
  24. extern
  25. void main(void)
  26. {
  27.     init_toolbox();
  28.     test_window();    
  29. }
  30. /*** main ***/
  31.  
  32. /********************************** init_toolbox ********************************/
  33. static
  34. void init_toolbox(void)
  35. {
  36.     MaxApplZone();
  37.     MoreMasters();
  38.     InitGraf(&thePort);
  39.     InitFonts();
  40.     InitWindows();
  41.     InitMenus();
  42.     TEInit();
  43.     InitDialogs(nil);
  44.     InitCursor();
  45.     FlushEvents(everyEvent, 0);
  46. }
  47. /*** init_toolbox ***/
  48.  
  49. /********************************** test_window *********************************/
  50. static
  51. void test_window(void)
  52. {
  53.     DialogPtr    d;
  54.     GrafPtr        g;
  55.     short        hit;
  56.     GDHandle    hGD;
  57.     CTabHandle    hCTab;
  58.     long ticks;
  59.     
  60.     if (d = GetNewDialog(128, nil, (WindowPtr) -1L))
  61.     {
  62.         GetPort(&g);
  63.         SetPort(d);
  64.         ShowWindow(d);
  65.         
  66.         do
  67.         {
  68.             ModalDialog(nil, &hit);
  69.             switch (hit)
  70.             {
  71.                 case    2:
  72.                     fade_screen(128, true);     //• Try fade speeds from 
  73.                     Delay (120L, &ticks);
  74.                     fade_screen(200, false);    //• 1 upward.
  75.                     break;
  76.             }
  77.         }
  78.         while (hit != OK);
  79.         
  80.         SetPort(g);
  81.         DisposDialog(d);
  82.     }
  83. }
  84. /*** test_window ***/
  85.  
  86. //===================================== EOF =====================================