home *** CD-ROM | disk | FTP | other *** search
- /* HandleIDCMP
- * ~~~~~~~~~~~
- * Handle intuimessage and return an int to be processed
- * © Copyright 1991 Christian E. Hopps
- */
-
- #include <intuition/intuition.h>
-
- HandleIDCMP(int window, struct Window *win)
- {
- int flag;
- struct IntuiMessage *msg = NULL;
- ULONG class;
- struct Gadget *g;
- USHORT id;
- flag = 9;
- if(window)
- {
- while((msg = (struct IntuiMessage *)GetMsg(win->UserPort)))
- {
- class = msg->Class;
- if(class == GADGETUP)
- {
- g = (struct Gadget *)msg->IAddress;
- id = g->GadgetID;
- }
- ReplyMsg(msg);
- flag = (int)id + 1;
- printf("id = %d",id);
- }
- }
- else
- {
- while((msg = (struct IntuiMessage *)GetMsg(win->UserPort)))
- {
- class = msg->Class;
- ReplyMsg(msg);
- switch(class)
- {
- case NEWSIZE: /* Clear */
- flag =(int)5;
- break;
- case CLOSEWINDOW: /* Angle */
- flag =(int)0;
- break;
- case MOUSEBUTTONS:
- flag =(int)2;
- break;
- default:
- flag = (int)1;
- break;
- }
- }
-
- }
- return(flag);
- }