home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v1.zip / IBMCPP / IBMCLASS / IEVTDATA.HPP < prev    next >
C/C++ Source or Header  |  1993-10-22  |  9KB  |  163 lines

  1. #ifndef _IEVTDATA_
  2.   #define _IEVTDATA_
  3. /*******************************************************************************
  4. * FILE NAME: ievtdata.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the class(es):                                              *
  8. *     IEventData - The objects used as parameters and results of 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. *******************************************************************************/
  18. #ifndef _IBASE_
  19.   #include <ibase.hpp>
  20. #endif
  21.  
  22. /*----------------------------------------------------------------------------*/
  23. /* Align classes on four byte boundary.                                       */
  24. /*----------------------------------------------------------------------------*/
  25. #pragma pack(4)
  26.  
  27. // Forward declarations for other classes:
  28.  
  29.  
  30. class IEventData : public IBase {
  31. typedef IBase
  32.   Inherited;
  33. /*******************************************************************************
  34. * The IEventData class is used to encapsulate the message parameter (MPARAM)   *
  35. * and message result (MRESULT) data of an event.                               *
  36. *                                                                              *
  37. * The following classes are aliases for the IEventData class:                  *
  38. *   - IEventParameter1                                                         *
  39. *   - IEventParameter2                                                         *
  40. *   - IEventResult                                                             *
  41. *   - IHighEventParameter                                                      *
  42. *   - ILowEventParameter                                                       *
  43. *******************************************************************************/
  44. public:
  45. /*------------------------------- Constructors ---------------------------------
  46. | You can construct instances of this class in the following ways:             |
  47. |    - Using the default constructor.  The event data is set to 0.             |
  48. |    - From a pointer to void.  The event data is set to the specified void    |
  49. |      pointer.                                                                |
  50. |    - From an unsigned long value.  The event data is set to the specified    |
  51. |      unsigned long number.                                                   |
  52. |    - From an integer.  The event data is set to the specified integer.       |
  53. |      This constructor accepts an uncasted value of 0.                        |
  54. |    - From two unsigned short integer values.  The event data is set to an    |
  55. |      unsigned long value whose two words are the the two specified           |
  56. |      unsigned short numbers.                                                 |
  57. |    - From one unsigned short integer and two characters.  The event data     |
  58. |      is set to an unsigned long value whose two words are the unsigned       |
  59. |      short integer number in the low word, and the two characters in the     |
  60. |      high word.                                                              |
  61. ------------------------------------------------------------------------------*/
  62.   IEventData ( );
  63.   IEventData ( void*          value );
  64.   IEventData ( unsigned long  value );
  65.   IEventData ( int            value );
  66.  
  67.   IEventData ( unsigned short lowValue,
  68.                unsigned short hiValue  );
  69.  
  70.   IEventData ( unsigned short lowValue,
  71.                char           lowByte,
  72.                char           hiByte   );
  73.  
  74. /*-------------------------------- Accessors -----------------------------------
  75. | These functions provide a means of getting and setting the accessible        |
  76. | attributes of instances of this class:                                       |
  77. |   lowNumber      - Returns the lower value of the event data that contain    |
  78. |                    two unsigned short values.  This is equivalent to the     |
  79. |                    low word of the event data, and is the same as the        |
  80. |                    number1 function.                                         |
  81. |   highNumber     - Returns the high value of the event data that contain     |
  82. |                    two unsigned short values.  This is equivalent to the     |
  83. |                    high word of the event data, and is the same as the       |
  84. |                    number2 function.                                         |
  85. |   number1        - Returns the lower value of the event data that contain    |
  86. |                    two unsigned short values.  This is equivalent to the     |
  87. |                    low word of the event data, and is the same as the        |
  88. |                    lowNumber function.                                       |
  89. |   number2        - Returns the high value of the event data that contain     |
  90. |                    two unsigned short values.  This is equivalent to the     |
  91. |                    high word of the event data, and is the same as the       |
  92. |                    highNumber function.                                      |
  93. |   lowLowByte     - Returns the character in the low byte of the low word     |
  94. |                    of the event data, the same as the char1 function.        |
  95. |   lowHighByte    - Returns the character in the high byte of the low word    |
  96. |                    of the event data, the same as the char2 function.        |
  97. |   highLowByte    - Returns the character in the low byte of the high word    |
  98. |                    of the event data, the same as the char3 function.        |
  99. |   highHighByte   - Returns the character in the high byte of the high word   |
  100. |                    of the event data, the same as the char3 function.        |
  101. |   char1          - Returns the character in the low byte of the low word     |
  102. |                    of the event data, the same as the lowLowByte function.   |
  103. |   char2          - Returns the character in the high byte of the low word    |
  104. |                    of the event data, the same as the lowHighByte function.  |
  105. |   char3          - Returns the character in the low byte of the high word    |
  106. |                    of the event data, the same as the highLowByte function.  |
  107. |   char4          - Returns the character in the high byte of the high word   |
  108. |                    of the event data, the same as the highHighByte function. |
  109. |   asUnsignedLong - Returns the unsigned long event data value.               |
  110. ------------------------------------------------------------------------------*/
  111. unsigned short
  112.   lowNumber      ( ) const,
  113.   highNumber     ( ) const,
  114.   number1        ( ) const,
  115.   number2        ( ) const;
  116.  
  117. char
  118.   lowLowByte     ( ) const,
  119.   lowHighByte    ( ) const,
  120.   highLowByte    ( ) const,
  121.   highHighByte   ( ) const,
  122.   char1          ( ) const,
  123.   char2          ( ) const,
  124.   char3          ( ) const,
  125.   char4          ( ) const;
  126.  
  127. unsigned long
  128.   asUnsignedLong ( ) const;
  129.  
  130. /*-------------------------------- Conversion ----------------------------------
  131. | This class provides the following data conversion operators:                 |
  132. |   operator char*         - Returns the event data as a pointer to a          |
  133. |                            character.                                        |
  134. |   operator unsigned long - Returns the event data as an unsigned long        |
  135. |                            number.                                           |
  136. ------------------------------------------------------------------------------*/
  137.   operator char*         ( ) const;
  138.   operator unsigned long ( ) const;
  139.  
  140. private:
  141. /*--------------------------------- Private ----------------------------------*/
  142. void*
  143.   pvClMsg;
  144. }; // IEventData
  145.  
  146. typedef IEventData IEventParameter1;
  147. typedef IEventData IEventParameter2;
  148. typedef IEventData ILowEventParameter;
  149. typedef IEventData IHighEventParameter;
  150. typedef IEventData IEventResult;
  151.  
  152. /*----------------------------------------------------------------------------*/
  153. /* Resume compiler default packing.                                           */
  154. /*----------------------------------------------------------------------------*/
  155. #pragma pack()
  156.  
  157. /*----------------------------- Inline Functions -----------------------------*/
  158. #ifndef I_NO_INLINES
  159.   #include <ievtdata.inl>
  160. #endif
  161.  
  162. #endif /* _IEVTDATA_ */
  163.