home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / xaes_new / active.c next >
C/C++ Source or Header  |  1994-12-26  |  2KB  |  77 lines

  1. /********************************************************************
  2.  *                                                                1.00*
  3.  *    XAES: Active redrawing of windows and elements                    *
  4.  *    By Ken Hollis                                                    *
  5.  *                                                                    *
  6.  *    Copyright (C) 1994, Bitgate Software                            *
  7.  *                                                                    *
  8.  *    These routines are 100% WinX compatible.  AES has a really hard    *
  9.  *    time keeping up with the correct redraw tables.  Unfortunately,    *
  10.  *    I have not yet put these routines in to counter its problem.    *
  11.  *    Wait for a later release for this problem to be cleared.        *
  12.  *                                                                    *
  13.  ********************************************************************/
  14.  
  15. #include "xaes.h"
  16.  
  17. #ifdef __TURBOC__
  18. #pragma warn -pia
  19. #pragma warn -sus
  20. #endif
  21.  
  22. /*
  23.  *    Handle the active redrawing of a window.  These are for custom
  24.  *    windows only.  Yes, these too could be optimized, but I don't
  25.  *    have the time to sit down and optimize them right now.  ^_^
  26.  */
  27. void WHandleActiveDrag(WINDOW *win)
  28. {
  29.     int initialx, initialy, lx, ly, button, d;
  30.     EVENT event;
  31.  
  32.     graf_mkstate(&initialx, &initialy, &button, &d);
  33.  
  34.     initialx -= win->size.g_x;
  35.     initialy -= win->size.g_y;
  36.     lx = ly = 0;
  37.  
  38.     event.ev_mbclicks = 0x0001;
  39.     event.ev_bmask = event.ev_mbstate = 1;
  40.  
  41.     do {
  42.         int message;
  43.  
  44.         event.ev_mflags = MU_MESAG | MU_BUTTON | MU_TIMER;
  45.         event.ev_mtlocount = event.ev_mthicount = 0;
  46.  
  47.         message = EvntMulti(&event);
  48.         graf_mkstate(&d, &d, &button, &d);
  49.  
  50.         if (message & MU_MESAG) {
  51.             WINDOW *tempwin;
  52.  
  53.             switch(*event.ev_mmgpbuf) {
  54.                 case WM_REDRAW:            /* Handle window messages */
  55.                     if (tempwin = WFindHandle(event.ev_mmgpbuf[3]))
  56.                         WMsgWindow(tempwin, event.ev_mmgpbuf);
  57.  
  58.                     WMoveWindow(win, -1, -1, -1, -1);
  59.                     break;
  60.             }
  61.         }
  62.  
  63.         if ((event.ev_mmox != lx) || (event.ev_mmoy != ly)) {
  64.             lx = event.ev_mmox;
  65.             ly = event.ev_mmoy;
  66.  
  67.             if ((event.ev_mmoy - initialy) < desk.g_y)
  68.                 WMoveWindow(win, (event.ev_mmox - initialx),
  69.                         desk.g_y, win->size.g_w,
  70.                         win->size.g_h);
  71.             else
  72.                 WMoveWindow(win, (event.ev_mmox - initialx),
  73.                         (event.ev_mmoy - initialy), win->size.g_w,
  74.                         win->size.g_h);
  75.         }
  76.     } while(button);
  77. }