home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / runnable / ibmc / ibmclass / ievtres.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-26  |  9.9 KB  |  184 lines

  1. #ifndef _IEVTRES_
  2. #define _IEVTRES_
  3. /*******************************************************************************
  4. * FILE NAME:   ievtres.hpp                                                     *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IEventResult - encapsulates the OS/2 MRESULT parameter                   *
  9. *     IUnsignedLongResult - event result from ULONG                            *
  10. *     IPairResult - event result from IPair                                    *
  11. *     IPointResult - event result from IPoint                                  *
  12. *     ISizeResult - event result from ISize                                    *
  13. *     IBooleanResult - event result from IBoolean                              *
  14. *                                                                              *
  15. * COPYRIGHT:                                                                   *
  16. *   Licensed Materials - Property of IBM                                       *
  17. *   (C) Copyright IBM Corporation 1992, 1993                                   *
  18. *   All Rights Reserved                                                        *
  19. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  20. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  21. *                                                                              *
  22. *$Log:   R:/IBMCLASS/IBASEAPP/VCS/IEVTRES.HPV  $
  23. // 
  24. //    Rev 1.2   25 Oct 1992 18:00:08   nunn
  25. // Brad Broyles changes for external beta
  26.  
  27.       Rev 1.1   17 Jul 1992 12:00:00   KKL
  28.    New design
  29.       Rev 1.2   21 Oct 1992 17:00:00   WBB
  30.    Amending to match SKELETON.HPP
  31. *******************************************************************************/
  32.  
  33. //Forward declarations for other classes:
  34. class IEventResult;
  35. class IUnsignedLongResult;
  36. class ISizeResult;
  37. class IPointResult;
  38. class ISizeResult;
  39. class IPair;
  40. class IPoint;
  41. class ISize;
  42. #if !defined( _IHANDLE_ ) && !defined( I_NO_RELATED_HPP )
  43.   #include <ihandle.hpp>
  44. #endif
  45.  
  46. class IEventResult {
  47. /*******************************************************************************
  48. * The class IEventResult encapsulates the OS/2 MRESULT parameter               *
  49. *******************************************************************************/
  50. public:
  51. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  52. | There are 7 ways to construct instances of this class:                       |
  53. |   1. default                                                                 |
  54. |     pvClRes is set to null (zero)                                            |
  55. |   2. using a pointer to void                                                 |
  56. |     pvClRes is set to the void pointer                                       |
  57. |   3. using an unsigned long value                                            |
  58. |     pvClRes is set to the unsigned long value                                |
  59. |   4. using a window handle                                                   |
  60. |     pvClRes is set to the window handle                                      |
  61. |   5. using a message queue handle                                            |
  62. |     pvClRes is set to the message queue handle                               |
  63. |   6. using two unsigned long values                                          |
  64. |     the two long values are changed to ushorts and stored in pvClRes         |
  65. |   7. using another instance of IEventResult                                  |
  66. |     the value of pvClRes is copied from the provided instance                |
  67. ------------------------------------------------------------------------------*/
  68.   IEventResult ( );
  69.   IEventResult ( void* pv );
  70.   IEventResult ( unsigned long ul );
  71.   IEventResult ( IWindowHandle hw );
  72.   IEventResult ( IMsgQueueHandle mqh );
  73.   IEventResult ( unsigned long us1,
  74.                  unsigned long us2 );
  75.   IEventResult ( const IEventResult& erCopy );
  76.  
  77. /*-------------------------------- ACCESSORS -----------------------------------
  78. | These function provide means of getting and setting the accessible           |
  79. | attributes of instances of this class:                                       |
  80. |   number1() - returns the first ULONG in the IEventResult                    |
  81. |   number2() - returns the second ULONG in the IEventResult                   |
  82. ------------------------------------------------------------------------------*/
  83. unsigned long
  84.   number1() const,
  85.   number2() const;
  86.  
  87. /*-------------------------------- OVERRIDES -----------------------------------
  88. | This class overrides the following inherited functions:                      |
  89. |   = - overridden to allow setting one IEventResult equal to another          |
  90. |   void* - overridding cast operator                                          |
  91. |   unsigned long - extract unsigned long from IEventResult                    |
  92. |   IWindowHandle - extract IWindowHandle from IEventResult                    |
  93. |   IMsgQueueHandle - extract IMsqQueueHandle from IEventResult                |
  94. ------------------------------------------------------------------------------*/
  95. IEventResult&
  96.   operator=(const IEventResult& er);
  97.   operator void*() const;
  98.   operator unsigned long() const;
  99.   operator IWindowHandle() const;
  100.   operator IMsgQueueHandle() const;
  101.  
  102.   private:
  103. /*--------------------------------- PRIVATE ----------------------------------*/
  104. void*
  105.   pvClRes;
  106. };
  107.  
  108. /*--------------------------------- INLINES ----------------------------------*/
  109. #ifndef I_NO_INLINES
  110.   #include <ievtres.inl>
  111. #endif
  112.  
  113. class IUnsignedLongResult : public IEventResult {
  114. /*******************************************************************************
  115. * The class IUnsignedLongResult provides a class for using an unsigned long    *
  116. * as an event result.                                                          *
  117. *******************************************************************************/
  118. public:
  119. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  120. | There is one way to construct instances of this class:                       |
  121. |   1. from an unsigned long value                                             |
  122. |     an IEventResult is created from the unsigned long value                  |
  123. ------------------------------------------------------------------------------*/
  124.   IUnsignedLongResult(unsigned long ul) : IEventResult(ul) {;}
  125. };
  126.  
  127. class IPairResult : public IEventResult {
  128. /*******************************************************************************
  129. * The class IPairResult provides a class for using an instance of IPair as an  *
  130. * event result.                                                                *
  131. *******************************************************************************/
  132. public:
  133. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  134. | There is one way to construct instances of this class:                       |
  135. |   1. from an instance of IPair                                               |
  136. |     the two parts of the IPair are used to create an IEventResult            |
  137. ------------------------------------------------------------------------------*/
  138.   IPairResult(const IPair& pair);
  139. };
  140.  
  141. class IPointResult : public IEventResult {
  142. /*******************************************************************************
  143. * The class IPointResult provides a class for using an instance of IPoint as   *
  144. * an event result.                                                             *
  145. *******************************************************************************/
  146. public:
  147. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  148. | There is one way to construct instances of this class:                       |
  149. |   1. from an instance of IPoint                                              |
  150. |     the two parts of the IPoint are used to create an IEventResult           |
  151. ------------------------------------------------------------------------------*/
  152.   IPointResult(const IPoint& pt);
  153. };
  154.  
  155. class ISizeResult : public IEventResult {
  156. /*******************************************************************************
  157. * The class ISizeResult provides a class for using an instance of ISize as     *
  158. * an event result.                                                             *
  159. *******************************************************************************/
  160. public:
  161. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  162. | There is one way to construct instances of this class:                       |
  163. |   1. from an instance of ISize                                               |
  164. |     the x and y components of ISize are used to create an IEventResult       |
  165. ------------------------------------------------------------------------------*/
  166.   ISizeResult(const ISize& pt);
  167. };
  168.  
  169. class IBooleanResult : public IEventResult {
  170. /*******************************************************************************
  171. * The class IBooleanResult provides a class for using an instance of Boolean   *
  172. * as an event restult.                                                         *
  173. *******************************************************************************/
  174. public:
  175. /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
  176. | There is one way to construct instances of this class:                       |
  177. |   1. from an instance of Boolean                                             |
  178. |     the Boolean's value is used to create an instance of IEventResult        |
  179. ------------------------------------------------------------------------------*/
  180.   IBooleanResult(Boolean b) : IEventResult((unsigned long) b) {;}
  181. };
  182.  
  183. #endif /*_IEVTRES_ */
  184.