home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / dflt20.zip / WATCH.C < prev    next >
Text File  |  1994-05-19  |  2KB  |  67 lines

  1. /* ----------- watch.c ----------- */
  2.  
  3. #include "dflat.h"
  4.  
  5. int WatchIconProc(WINDOW wnd, MESSAGE msg, PARAM p1, PARAM p2)
  6. {
  7.     int rtn, i;
  8.     static int tick = 0;
  9.     static char *hands[] = {
  10.         " └ ", " ┌ ", " ┐ ", " ┘ "
  11.     };
  12.     switch (msg)    {
  13.         case CREATE_WINDOW:
  14.             tick = 0;
  15.             rtn = DefaultWndProc(wnd, msg, p1, p2);
  16.             SendMessage(wnd, CAPTURE_MOUSE, 0, 0);
  17.             SendMessage(wnd, HIDE_MOUSE, 0, 0);
  18.             SendMessage(wnd, CAPTURE_KEYBOARD, 0, 0);
  19.             SendMessage(wnd, CAPTURE_CLOCK, 0, 0);
  20.             return rtn;
  21.         case CLOCKTICK:
  22.             ++tick;
  23.             tick &= 3;
  24.             SendMessage(wnd->PrevClock, msg, p1, p2);
  25.             /* (fall through and paint) */
  26.         case PAINT:
  27.             SetStandardColor(wnd);
  28.             writeline(wnd, hands[tick], 1, 1, FALSE);
  29.             return TRUE;
  30.         case BORDER:
  31.             rtn = DefaultWndProc(wnd, msg, p1, p2);
  32.             writeline(wnd, "═", 2, 0, FALSE);
  33.             return rtn;
  34.         case MOUSE_MOVED:
  35.             SendMessage(wnd, HIDE_WINDOW, 0, 0);
  36.             SendMessage(wnd, MOVE, p1, p2);
  37.             SendMessage(wnd, SHOW_WINDOW, 0, 0);
  38.             return TRUE;
  39.         case CLOSE_WINDOW:
  40.             SendMessage(wnd, RELEASE_CLOCK, 0, 0);
  41.             SendMessage(wnd, RELEASE_MOUSE, 0, 0);
  42.             SendMessage(wnd, RELEASE_KEYBOARD, 0, 0);
  43.             SendMessage(wnd, SHOW_MOUSE, 0, 0);
  44.             break;
  45.         default:
  46.             break;
  47.     }
  48.     return DefaultWndProc(wnd, msg, p1, p2);
  49. }
  50.  
  51. WINDOW WatchIcon(void)
  52. {
  53.     int mx, my;
  54.     WINDOW wnd;
  55.     SendMessage(NULL, CURRENT_MOUSE_CURSOR,
  56.                         (PARAM) &mx, (PARAM) &my);
  57.     wnd = CreateWindow(
  58.                     BOX,
  59.                     NULL,
  60.                     mx, my, 3, 5,
  61.                     NULL,NULL,
  62.                     WatchIconProc,
  63.                     VISIBLE | HASBORDER | SHADOW | SAVESELF);
  64.     return wnd;
  65. }
  66. 
  67.