home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / cppbeta / ibmcli / ievent.hp_ / IEVENT.HPP
Encoding:
C/C++ Source or Header  |  1992-10-26  |  6.6 KB  |  154 lines

  1. #ifndef _IEVENT_
  2. #define _IEVENT_
  3. /*******************************************************************************
  4. * FILE NAME: ievent.hpp                                                        *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IEvent - The base event information class, used to send & post messages  *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   Licensed Materials - Property of IBM                                       *
  12. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  13. *   All Rights Reserved                                                        *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *$Log:   R:/ibmclass/ibaseapp/vcs/ievent.hpv  $                                                                         *
  18. // 
  19. //    Rev 1.23   25 Oct 1992 23:32:34   BOBLOVE
  20. // Fixed definition errors param2() and erCl
  21. // 
  22. //    Rev 1.22   25 Oct 1992 17:59:50   nunn
  23. // Brad Broyles changes for external beta
  24.  
  25.       Rev 1.1   01 Jan 1989 12:00:00   LM & KKL
  26.    Initiate code
  27.       Rev 1.2   01 May 1991 12:00:00   KKL
  28.    Combine all dolts into 1 file - modified for better performance
  29.       Rev 1.3   01 Oct 1991 12:00:00   KKL
  30.    Update per R2.0 spec.
  31.       Rev 1.4   17 Jul 1991 12:00:00   KKL
  32.    New event dispatching
  33.       Rev 1.5   21 Oct 1992 16:00:00   WBB
  34.    Amended to match skeleton.hpp
  35. *******************************************************************************/
  36. #ifndef _IBASE_
  37.   #include <ibase.hpp>
  38. #endif
  39.  
  40. // Forward declarations for other classes:
  41. class IEvent;
  42. class IEventResult;
  43. #if !defined( _IHANDLE_ ) && !defined( I_NO_RELATED_HPP )
  44.   #include <ihandle.hpp>
  45. #endif
  46. #if !defined( _IWINDOW_ ) && !defined( I_NO_RELATED_HPP )
  47.   #include <iwindow.hpp>
  48. #endif
  49. #if !defined( _IEVTPARM_ ) && !defined( I_NO_RELATED_HPP )
  50.   #include <ievtparm.hpp>
  51. #endif
  52. #if !defined( _IEVTRES_ ) && !defined( I_NO_RELATED_HPP )
  53.   #include <ievtres.hpp>
  54. #endif
  55.  
  56. class IEvent : public IBase {
  57. /*******************************************************************************
  58. * IEvent is the base event information class.  Instances of this class can     *
  59. * also be used to send and post messages to message queues.                    *
  60. *******************************************************************************/
  61. public:
  62. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  63. | There are 3 ways to construct instances of this class:                       |
  64. |   1. from an IHandle instance, an event ID, and two instances of IEventParam |
  65. |   2. from an IWindow instance, an event ID, and two instances of IEventParam |
  66. |   3. from another instance of IEvent                                         |
  67. ------------------------------------------------------------------------------*/
  68.   IEvent(IHandle h, unsigned long ulEvtId,
  69.          IEventParam ep1, IEventParam ep2);
  70.   IEvent(IWindow* wnd, unsigned long ulEvtId,
  71.          IEventParam ep1, IEventParam ep2);
  72.   IEvent(const IEvent& evtCopy);
  73.  
  74. virtual
  75.   ~IEvent() {;}
  76.  
  77. /*-------------------------------- ACCESSORS -----------------------------------
  78. | These function provide means of getting and setting the accessible           |
  79. | attributes of instances of this class:                                       |
  80. |   window - return the IWindow object pointer                                 |
  81. |   handle - return the IHandle object pointer                                 |
  82. |   eventId - return the event ID                                              |
  83. |   param1 - return the first event parameter                                  |
  84. |   param2 - return the second event parameter                                 |
  85. |   result - return the event result                                           |
  86. |   setResult - set the event result                                           |
  87. ------------------------------------------------------------------------------*/
  88. IWindow
  89.  *const window() const;
  90. const IHandle
  91.  &handle() const;
  92. unsigned long
  93.   eventId() const;
  94. const IEventParam
  95.  ¶m1() const,
  96.  ¶m2() const;
  97. IEventResult
  98.   result() const;
  99. void
  100.   setResult(IEventResult evt);
  101.  
  102. /*-------------------------------- FUNCTIONS -----------------------------------
  103. | sendWindow - send the event to the window handle                             |
  104. | postQueue - post the event to the message queue handle                       |
  105. | postWindow - post the event to the window handle                             |
  106. | broadcastPostQueue - broadcast the event by posting it to all threads that   |
  107. |                      have a message queue handle                             |
  108. | broadcastPostWindow - broadcast the event by posting it to all descendants   |
  109. |                       of the window handle and/or to frame window only       |
  110. | broadcastSendWindow - broadcast the event by posting it to all descendants   |
  111. |                       of the window handle and/or to frame window only       |
  112. ------------------------------------------------------------------------------*/
  113. IEventResult
  114.   sendWindow();
  115. void
  116.   postQueue(),
  117.   postWindow(),
  118.   broadcastPostQueue();
  119.  
  120.   enum BroadcastAttr {toDescendants, toFrameOnly, toFrameDescendants};
  121.  
  122. void
  123.   broadcastPostWindow(BroadcastAttr b = toDescendants),
  124.   broadcastSendWindow(BroadcastAttr b = toDescendants);
  125.  
  126. /*-------------------------------- OVERRIDES -----------------------------------
  127. | This class overrides the following inherited functions:                      |
  128. |   = - assignment operator                                                    |
  129. ------------------------------------------------------------------------------*/
  130. IEvent
  131.  &operator=(const IEvent& evtCopy);
  132.  
  133. private:
  134. /*--------------------------------- PRIVATE ----------------------------------*/
  135. unsigned long
  136.   makeCommand(BroadcastAttr b);
  137. IHandle
  138.   hCl;
  139. unsigned long
  140.   ulClEvtId;
  141. IEventParam
  142.   epCl1,
  143.   epCl2;
  144. IEventResult
  145.   erCl;
  146. }; // IEvent
  147.  
  148. /*--------------------------------- INLINES ----------------------------------*/
  149. #ifndef I_NO_INLINES
  150.   #include <ievent.inl>
  151. #endif
  152.  
  153. #endif /* _IEVENT_ */
  154.