home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WMESSAGE.HPP < prev    next >
C/C++ Source or Header  |  1996-11-29  |  3KB  |  100 lines

  1. /*************************************************************************
  2.  *
  3.  * WMessage --
  4.  *
  5.  *************************************************************************/
  6.  
  7. #ifndef _WMESSAGE_HPP_INCLUDED
  8. #define _WMESSAGE_HPP_INCLUDED
  9.  
  10. #ifndef _WNO_PRAGMA_PUSH
  11. #pragma pack(push,8);
  12. #pragma enum int;
  13. #endif
  14.  
  15. #ifndef _WDEF_HPP_INCLUDED
  16. #  include "wdef.hpp"
  17. #endif
  18. #ifndef _WEVENTD_HPP_INCLUDED
  19. #  include "weventd.hpp"
  20. #endif
  21.  
  22. //
  23. // WMessage -- A convenience class for encapsulating window messages.
  24. //
  25.  
  26. class WCMCLASS WMessage {
  27.  
  28.     public:
  29.  
  30.         /**********************************************************
  31.          * Constructors and destructors
  32.          *********************************************************/
  33.     
  34.         // Construct & destruct
  35.     
  36.         WMessage()
  37.               : hWnd( 0 ), msg( 0 ),
  38.                 wParam( 0 ), lParam( 0 ), time( 0 ), pt( 0, 0 ) {}
  39.         WMessage( WUInt m, WUInt w, WLong l )
  40.               : hWnd( 0 ), msg( m ),
  41.                 wParam( w ), lParam( l ), time( 0 ), pt( 0, 0 ) {}
  42.         WMessage( WWindowHandle h, WUInt m, WUInt w, WLong l )
  43.               : hWnd( h ), msg( m ),
  44.                 wParam( w ), lParam( l ), time( 0 ), pt( 0, 0 ) {}
  45.         WMessage( WWindowHandle h, WUInt m, WUInt w, WLong l,
  46.                   WDWord t, const WPoint & p )
  47.               : hWnd( h ), msg( m ),
  48.                 wParam( w ), lParam( l ), time( t ), pt( p ) {}
  49.     
  50.         ~WMessage() {}
  51.     
  52.         /**********************************************************
  53.          * Properties
  54.          *********************************************************/
  55.     
  56.         WUShort         GetControlID() const;
  57.         WWindowHandle   GetControlHandle() const;
  58.         WInt            GetCommandCode() const;
  59.         WUShort         GetMenuFlags() const;
  60.         WMenuHandle     GetMenuHandle() const;
  61.         WUShort         GetMenuID() const;
  62.         WBool           GetMenuClosed() const;
  63.  
  64.         /**********************************************************
  65.          * Methods
  66.          *********************************************************/
  67.     
  68.         /**********************************************************
  69.          * Data members
  70.          *********************************************************/
  71.     
  72.         // Data that describes the message... exposed for quick access.
  73.         // This is very system-specific!
  74.         // NOTE: Only msg, wParam, and lParam are always set;
  75.         //       periodically, hWnd, time and pt will remain unset
  76.     
  77.         WWindowHandle           hWnd;
  78.         WUInt                   msg;
  79.         WUInt                   wParam;
  80.         WLong                   lParam;
  81.         WDWord                  time;
  82.         WPoint                  pt;
  83. };
  84.  
  85. //
  86. // WMessageHookEventData
  87. //
  88.  
  89. struct WMessageHookEventData : public WEventData {
  90.     WMessage            message;
  91.     WLong               returns;
  92. };
  93.  
  94. #ifndef _WNO_PRAGMA_PUSH
  95. #pragma enum pop;
  96. #pragma pack(pop);
  97. #endif
  98.  
  99. #endif // _WMESSAGE_HPP_INCLUDED
  100.