home *** CD-ROM | disk | FTP | other *** search
/ Carousel / CAROUSEL.cdr / mactosh / lang / skel_azt.sha / click.c < prev    next >
C/C++ Source or Header  |  1986-07-08  |  1KB  |  74 lines

  1.  
  2. /*
  3.  *    click.c -- handle mouse click anywhere outside desk accessory
  4.  *        windows
  5.  */
  6.  
  7. #include <quickdraw.h>
  8. #include <control.h>
  9. #include <desk.h>
  10. #include <event.h>
  11. #include <memory.h>
  12. #include <menu.h>
  13. #include <osutil.h>
  14. #include <textedit.h>
  15. #include <window.h>
  16.  
  17. #include "def.h"
  18.  
  19. click(ev)
  20. EventRecord    *ev;    /* return value from GetNextEvent */
  21. {
  22.     extern    ControlHandle    hscroll[NWINDOWS];
  23.     extern    TEHandle        hTE;
  24.     int                        i;
  25.     extern    MenuHandle        mh[NMENUS + 1];
  26.     WindowPtr                mwp;
  27.     extern    ControlHandle    vscroll[NWINDOWS];
  28.     extern    Rect            wdragr;
  29.     int                        windowcode;
  30.     extern    WindowPtr        wp[NWINDOWS];
  31.     
  32.     windowcode = FindWindow (pass(ev->where), &mwp);
  33.     switch (windowcode) {
  34.         case inDesk:
  35.             SysBeep(1);
  36.             break;
  37.         case inMenuBar:
  38.             return(command(MenuSelect(&ev->where)));
  39.             break;
  40.         case inSysWindow:
  41.             SystemClick(ev, mwp);
  42.             break;
  43.         case inContent:    /* if inactive window, includes grow box */
  44.             if (mwp != FrontWindow())
  45.                 SelectWindow(mwp);
  46.             else {
  47.                 for (i = 0;  i < NWINDOWS;  i++)
  48.                     if (mwp == wp[i]) {
  49.                         appclick(ev, i);
  50.                         break;
  51.                     };
  52.             };
  53.             break;
  54.         case inDrag:
  55.             DragWindow(mwp, pass(ev->where), &wdragr);
  56.             break;
  57.         case inGrow:    /* see inContent above */
  58.             for (i = 0;  i < NWINDOWS;  i++)
  59.                 if (mwp == wp[i]) {
  60.                     extern void    resize();
  61.  
  62.                     resize(i, pass(ev->where));
  63.                     break;
  64.                 };
  65.             break;
  66.         case inGoAway:
  67.             if (TrackGoAway(mwp, pass(ev->where)) &&
  68.                 mwp == wp[1])
  69.                     txfin();
  70.             break;
  71.     };
  72.     return(FALSE);
  73. } /* end of click */
  74.