home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Milan_1991 / Devcon91.4 / Style / setwaitpointer.c
Encoding:
C/C++ Source or Header  |  1992-09-01  |  1.9 KB  |  102 lines

  1. /* setwaitpointer.c
  2.  * Copyright (C) 1990, 1991 Commodore-Amiga, Inc.
  3.  * Written by David N. Junod
  4.  *
  5.  */
  6.  
  7. static UWORD chip WaitPointer[] =
  8. {
  9.     0x0000, 0x0000,
  10.  
  11.     0x0400, 0x07C0,
  12.     0x0000, 0x07C0,
  13.     0x0100, 0x0380,
  14.     0x0000, 0x07E0,
  15.     0x07C0, 0x1FF8,
  16.     0x1FF0, 0x3FEC,
  17.     0x3FF8, 0x7FDE,
  18.     0x3FF8, 0x7FBE,
  19.     0x7FFC, 0xFF7F,
  20.     0x7EFC, 0xFFFF,
  21.     0x7FFC, 0xFFFF,
  22.     0x3FF8, 0x7FFE,
  23.     0x3FF8, 0x7FFE,
  24.     0x1FF0, 0x3FFC,
  25.     0x07C0, 0x1FF8,
  26.     0x0000, 0x07E0,
  27.  
  28.     0x0000, 0x0000,        /* reserved, must be NULL */
  29. };
  30.  
  31. /* This function sets the busy pointer in the specified window */
  32. VOID SetWaitPointer (struct Window * w)
  33. {
  34.  
  35.     /* Make sure we have a window pointer */
  36.     if (w)
  37.     {
  38.     /* Set the pointer to the clock image */
  39.     SetPointer (w, WaitPointer, 16, 16, -6, 0);
  40.     }
  41. }
  42.  
  43. /* This function sets the busy pointer, and locks the gadgets for the
  44.  * specified window.
  45.  *
  46.  * Example:
  47.  *
  48.  *    VOID DoSomethingLong (struct Window *w)
  49.  *    {
  50.  *        struct Requester r;
  51.  *
  52.  *        LockWindow (w, &r);
  53.  *
  54.  *        ... do the work ...
  55.  *
  56.  *        UnlockWindow (w, &r);
  57.  *    }
  58.  *
  59.  */
  60.  
  61. VOID LockWindow (struct Window *w, struct Requester *r)
  62. {
  63.     /* Make sure we have a window */
  64.     if (w)
  65.     {
  66.     /* Set the wait pointer */
  67.     SetWaitPointer (w);
  68.  
  69.     /* See if we have a requester */
  70.     if (r)
  71.     {
  72.             /* Clear the requester fields */
  73.             InitRequester (r);
  74.  
  75.             /* Set the required fields */
  76.             r->LeftEdge = r->TopEdge = (-1);
  77.             r->Width = r->Height = 1;
  78.             r->Flags = SIMPLEREQ | NOREQBACKFILL;
  79.  
  80.             /* Bring up the locking requester */
  81.             Request (r, w);
  82.     }
  83.     }
  84. }
  85.  
  86. VOID UnlockWindow (struct Window *w, struct Requester *r)
  87. {
  88.     /* Make sure we have a window */
  89.     if (w)
  90.     {
  91.     /* See if we have a requester to clear */
  92.     if (r)
  93.     {
  94.         /* Turn off the requester */
  95.         EndRequest (r, w);
  96.     }
  97.  
  98.     /* Turn off the busy pointer */
  99.     ClearPointer (w);
  100.     }
  101. }
  102.