home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / projmot_453.lzh / ProjMot / src / handleidcmpgraph.c < prev    next >
C/C++ Source or Header  |  1991-02-18  |  982b  |  57 lines

  1. /* HandleIDCMP 
  2.  * ~~~~~~~~~~~
  3.  * Handle intuimessage and return an int to be processed
  4.  * © Copyright 1991 Christian E. Hopps
  5. */
  6.  
  7. #include <intuition/intuition.h>
  8.  
  9. HandleIDCMP(int window, struct Window *win)
  10. {
  11.     int flag;
  12.     struct IntuiMessage *msg = NULL;
  13.     ULONG class;
  14.     struct Gadget *g;
  15.     USHORT id;
  16.     flag = 9;
  17.     if(window)
  18.     {
  19.         while((msg = (struct IntuiMessage *)GetMsg(win->UserPort)))
  20.         {
  21.             class = msg->Class;
  22.             if(class == GADGETUP)
  23.             {
  24.                 g = (struct Gadget *)msg->IAddress;
  25.                 id = g->GadgetID;
  26.             }
  27.             ReplyMsg(msg);
  28.             flag = (int)id + 1;
  29.             printf("id = %d",id);
  30.         }
  31.     }
  32.     else
  33.     {
  34.         while((msg = (struct IntuiMessage *)GetMsg(win->UserPort)))
  35.         {
  36.             class = msg->Class;
  37.             ReplyMsg(msg);
  38.             switch(class)
  39.             {
  40.                 case NEWSIZE:        /* Clear */
  41.                     flag =(int)5;
  42.                     break;
  43.                 case CLOSEWINDOW:        /* Angle */
  44.                     flag =(int)0;
  45.                     break;
  46.                 case MOUSEBUTTONS:
  47.                     flag =(int)2;
  48.                     break;
  49.                 default:
  50.                     flag = (int)1;
  51.                     break;
  52.             }
  53.         }
  54.         
  55.     }    
  56. return(flag);
  57. }