home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / FWNotifn / FWRecevr.h < prev   
Encoding:
Text File  |  1996-09-17  |  3.2 KB  |  108 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWRecevr.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWRECEVR_H
  11. #define FWRECEVR_H
  12.  
  13. #ifndef FWINTERE_H
  14. #include "FWIntere.h"
  15. #endif
  16.  
  17. #ifndef FWRUNTYP_H
  18. #include "FWRunTyp.h"
  19. #endif
  20.  
  21. #ifndef FWEXCLIB_H
  22. #include "FWExcLib.h"
  23. #endif
  24.  
  25. //========================================================================================
  26. // Foward declarations
  27. //========================================================================================
  28.  
  29. class FW_CNotification;
  30.  
  31. //========================================================================================
  32. // CLASS FW_MReceiver
  33. //========================================================================================
  34.  
  35. class FW_MReceiver
  36. {
  37. public:
  38.     FW_DECLARE_CLASS
  39.     FW_DECLARE_AUTO(FW_MReceiver)
  40.     
  41. public:
  42.     FW_MReceiver();
  43.     virtual ~FW_MReceiver();
  44.  
  45.     virtual void    HandleNotification(Environment* ev, const FW_CNotification& notification) = 0;
  46.     
  47.     void            AddInterest(const FW_CInterest& interest);
  48.     void            AddInterest(FW_MNotifier* notifier, FW_Message message);
  49.     
  50.     void            RemoveAllInterests();
  51.     void            RemoveInterest(const FW_CInterest& interest);
  52.     void            RemoveInterest(FW_MNotifier* notifier, FW_Message message);
  53.     
  54.     void            Connect();
  55.     void            Disconnect();
  56.     
  57.     FW_Boolean        IsConnected() const;
  58.     
  59.     FW_ObjectID        PrivGetReceiverID() const;
  60.     void            PrivSetReceiverID(FW_ObjectID newID);
  61.  
  62. private:
  63.     FW_Boolean        fIsConnected;
  64.     FW_ObjectID        fReceiverID;
  65. };
  66.  
  67. //----------------------------------------------------------------------------------------
  68. // FW_MReceiver::IsConnected
  69. //----------------------------------------------------------------------------------------
  70. inline FW_Boolean FW_MReceiver::IsConnected() const
  71. {
  72.     return fIsConnected;
  73. }
  74.  
  75. //----------------------------------------------------------------------------------------
  76. // FW_MReceiver::AddInterest
  77. //----------------------------------------------------------------------------------------
  78. inline void FW_MReceiver::AddInterest(FW_MNotifier* notifier, FW_Message message)
  79. {
  80.     AddInterest(FW_CInterest(notifier, message));
  81. }
  82.  
  83. //----------------------------------------------------------------------------------------
  84. // FW_MReceiver::RemoveInterest
  85. //----------------------------------------------------------------------------------------
  86. inline void FW_MReceiver::RemoveInterest(FW_MNotifier* notifier, FW_Message message)
  87. {
  88.     RemoveInterest(FW_CInterest(notifier, message));
  89. }
  90.  
  91. //----------------------------------------------------------------------------------------
  92. // FW_MReceiver::PrivGetReceiverID
  93. //----------------------------------------------------------------------------------------
  94. inline FW_ObjectID FW_MReceiver::PrivGetReceiverID() const
  95. {
  96.     return fReceiverID;
  97. }
  98.  
  99. //----------------------------------------------------------------------------------------
  100. // FW_MReceiver::PrivSetReceiverID
  101. //----------------------------------------------------------------------------------------
  102. inline void FW_MReceiver::PrivSetReceiverID(FW_ObjectID newID)
  103. {
  104.     fReceiverID = newID;
  105. }
  106.  
  107. #endif
  108.