home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ctlcpp.zip / IMMOVEVT.HPP < prev    next >
C/C++ Source or Header  |  1994-06-06  |  4KB  |  116 lines

  1. #ifndef _IMMOVEVT_
  2.    #define _IMMOVEVT_
  3. /***************************************************************/
  4. /* Filename: immovevt.hpp                                      */
  5. /*                                                             */
  6. /* Purpose: Declaration of IMouseMoveEvent,                    */
  7. /*          IControlPointerEvent, and IMouseDragSelectEvent.   */
  8. /*          These classes encapsulate several different types  */
  9. /*          of mouse movement events, including WM_MOUSEMOVE,  */
  10. /*          WM_CONTROLPOINTER, WM_BEGIN/ENDDRAG, and           */
  11. /*          WM_BEGIN/ENDSELECT. An associated class is         */
  12. /*          IMouseMoveHandler.                                 */
  13. /*                                                             */
  14. /* Program name: cppctl.exe     Title: C++ PM Control Test App */
  15. /* OS/2 Developer Magazine, Issue: Sept. '94, page             */
  16. /* Article title: Writing OS/2 PM Controls in C++              */
  17. /* Authors: Eric Snell and Lori Ruffing                        */
  18. /*                                                             */
  19. /* Description: This example shows how to implement an OS/2 PM */
  20. /*              control window in C++.                         */
  21. /*                                                             */
  22. /* Program Requirements: This example requires the IBM C Set++ */
  23. /*                       compiler and libraries.               */
  24. /***************************************************************/
  25.  
  26. #ifndef _IEVENT_
  27.    #include <ievent.hpp>
  28. #endif
  29.  
  30. #ifndef _IHANDLE_
  31.    #include <ihandle.hpp>
  32. #endif
  33.  
  34. #ifndef _IPOINT_
  35.    #include <ipoint.hpp>
  36. #endif
  37.  
  38. // Align classes on 4 byte boundary
  39. #pragma pack(4)
  40.  
  41.  
  42. //----------------------------------------------------------------------------
  43. // IMouseMoveEvent
  44. //
  45. // This class encapsulates the WM_MOUSEMOVE message. A static method which
  46. // returns the current pointer position is also included.
  47. //----------------------------------------------------------------------------
  48. class IMouseMoveEvent : public IEvent
  49.    {
  50.    public:
  51.       IMouseMoveEvent(IEvent &evt);
  52.       virtual ~IMouseMoveEvent();
  53.  
  54.  
  55.       IPoint pointerPosition() const;
  56.  
  57.       enum HitTest
  58.          {
  59.          normal      =  0,
  60.          transparent = -1,
  61.          discard     = -2,
  62.          error       = -3
  63.          };
  64.  
  65.       HitTest hitTest() const;
  66.  
  67.       unsigned short keyCodes() const;
  68.  
  69.       static IPoint currentPointerPosition();
  70.    };
  71.  
  72. //----------------------------------------------------------------------------
  73. // IControlPointerEvent
  74. //
  75. // This class encapsulates the WM_CONTROLPOINTER message. There are methods
  76. // to query/set the pointer and to query the window id of the control under
  77. // the pointer.
  78. //----------------------------------------------------------------------------
  79. class IControlPointerEvent : public IEvent
  80.    {
  81.    typedef IEvent Inherited;
  82.  
  83.    public:
  84.       IControlPointerEvent(IEvent &evt);
  85.       virtual ~IControlPointerEvent();
  86.  
  87.       unsigned long pointerOverId() const;
  88.       IPointerHandle currentPointer() const;
  89.       Boolean setNewPointer(const IPointerHandle &ptrHandle);
  90.    };
  91.  
  92. //----------------------------------------------------------------------------
  93. // IMouseDragSelectEvent
  94. //
  95. // This class encapsulates the WM_BEGINDRAG and WM_ENDDRAG messages. There
  96. // are methods to get the pointer position and see if the pointer is being
  97. // dragged into the window.
  98. //----------------------------------------------------------------------------
  99. class IMouseDragSelectEvent : public IEvent
  100.    {
  101.    typedef IEvent Inherited;
  102.  
  103.    public:
  104.       IMouseDragSelectEvent(IEvent& evt);
  105.       virtual ~IMouseDragSelectEvent();
  106.  
  107.       Boolean pointerInitiated() const;
  108.       IPoint pointerPosition() const;
  109.  
  110.    };
  111.  
  112. // Resume compiler default packing
  113. #pragma pack()
  114.  
  115. #endif //#ifndef _IMMOVEVT_
  116.