home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / OTL-MC7.DMS / in.adf / classsource.lha / ClassSource / Intuition / IDCMP / IDCMP.c
Encoding:
C/C++ Source or Header  |  1995-02-12  |  1.9 KB  |  90 lines

  1.  
  2. #include <classes/Intuition/IDCMP.h>
  3.  
  4. #pragma -
  5. #include <pragma/exec_lib.h>
  6. #pragma +
  7.  
  8. IDCMPEventHandlerC::IDCMPEventHandlerC(ULONG IDCMPclass)
  9. {
  10.     evClass = IDCMPclass;
  11. }
  12.  
  13. BOOL IDCMPEventHandlerC::handle(MessageC &msg)
  14. {
  15.     return _handle((IntuiMessageC &) msg);
  16. }
  17.  
  18. BOOL IDCMPEventHandlerC::forMe(MessageC &msg)
  19. {
  20.     return _forMe((IntuiMessageC &) msg);
  21. }
  22.  
  23. BOOL IDCMPEventHandlerC::_handle(IntuiMessageC &msg)
  24. {
  25.     return FALSE;
  26. }
  27.  
  28. BOOL IDCMPEventHandlerC::_forMe(IntuiMessageC &msg)
  29. {
  30.     return evClass == msg.Class;
  31. }
  32.  
  33. // ******************************************************
  34.  
  35. IDCMPEventHandlerChainC::IDCMPEventHandlerChainC(ULONG IDCMPclass)
  36.     : IDCMPEventHandlerC(IDCMPclass), HandlerChainC()
  37. {
  38. }
  39.  
  40. // ******************************************************
  41.  
  42. BOOL IDCMPortC::handleMsg(MessageC &msg)
  43. {
  44.     ListCursorC lc(*this);
  45.     BOOL r = FALSE;
  46.     imsg = (IntuiMessageC &) msg;
  47.     if ((imsg.Class & (IDCMP_SIZEVERIFY|IDCMP_MENUVERIFY|IDCMP_REQVERIFY)) == 0)
  48.         msg.reply();
  49.     while (!lc.isDone()) {
  50.         MessageHandlerC *h = (MessageHandlerC *) lc.item();
  51.         if (h->forMe(imsg))
  52.         {
  53.             if (h->handle(imsg))
  54.             {
  55.                 BOOL b = h->exit();
  56.                 r = r | b;
  57.             };
  58.         };
  59.         lc.next();
  60.     };
  61.     if ((imsg.Class & (IDCMP_SIZEVERIFY|IDCMP_MENUVERIFY|IDCMP_REQVERIFY)) != 0)
  62.         msg.reply();
  63.     return r;
  64. }
  65.  
  66. // ******************************************************
  67.  
  68. IDCMPQEventHandlerC::IDCMPQEventHandlerC(ULONG IDCMPclass, UWORD IDCMPqualifier)
  69.     : IDCMPEventHandlerC(IDCMPclass)
  70. {
  71.     qualifier = IDCMPqualifier;
  72. }
  73.  
  74. // ******************************************************
  75.  
  76. IDCMPCEventHandlerC::IDCMPCEventHandlerC(ULONG IDCMPclass, UWORD IDCMPcode)
  77.     : IDCMPEventHandlerC(IDCMPclass)
  78. {
  79.     code = IDCMPcode;
  80. }
  81.  
  82. // ******************************************************
  83.  
  84. IDCMPQCEventHandlerC::IDCMPQCEventHandlerC(ULONG IDCMPclass,
  85.         UWORD IDCMPqualifier, UWORD IDCMPcode)
  86.     : IDCMPQEventHandlerC(IDCMPclass,IDCMPqualifier),
  87.       IDCMPCEventHandlerC(IDCMPclass,IDCMPcode)
  88. {
  89. }
  90.