home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / igrabhdl.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  5.0 KB  |  130 lines

  1. /*******************************************************************************
  2. * FILE NAME: igrabhdl.hpp                                                      *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *   Declaration of the classes:                                                *
  6. *     IMGrabbable                                                              *
  7. *     IGrabHandler                                                             *
  8. *                                                                              *
  9. * COPYRIGHT:                                                                   *
  10. *   IBM Open Class Library                                                     *
  11. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  12. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  13. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  14. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  15. *                                                                              *
  16. *******************************************************************************/
  17. #ifndef _IGRABHDL_
  18. #define _IGRABHDL_
  19.  
  20. #include <ivbase.hpp>
  21. #include <irect.hpp>
  22.  
  23.  
  24. // classes defined in this module
  25. class IMGrabbable;
  26. class IGrabHandles;
  27.  
  28.  
  29. // forward references
  30. class IWindow;
  31. class IPresSpaceHandle;
  32. class IGrabHandler;
  33.  
  34.  
  35. #pragma pack(4)
  36.  
  37.  
  38. /*******************************************************************************
  39. *                                                                              *
  40. *   Class IMGrabbable                                                          *
  41. *                                                                              *
  42. *   Mixin class for objects that wants to display grab handles.                *
  43. *                                                                              *
  44. *******************************************************************************/
  45.  
  46. class IMGrabbable 
  47. {
  48. public:
  49.     
  50. /*---------------------- Grabbable object protocol ---------------------------*/
  51.   
  52.     // return the grabbable objects area
  53.     virtual IRectangle      rect() const = 0;
  54.  
  55.     // resize message to the grabbable object
  56.     virtual void            setRect( const IRectangle& newRect ) = 0;
  57.  
  58.     // return the window in which the grab handles display
  59.     virtual IWindow&        inWindow() const = 0;
  60.  
  61.     // initiate drag operation and take over handling of mouse events
  62.     // (only called if grab handles are constructed with "dragMove" true)
  63.     virtual Boolean         doDragDrop( const IPoint& startPoint );
  64.  
  65. };
  66.  
  67.  
  68. /*******************************************************************************
  69. *                                                                              *
  70. *   Class IGrabHandles                                                         *
  71. *                                                                              *
  72. *   Handles used for moving and sizing an object in a window.                  *
  73. *                                                                              *
  74. *******************************************************************************/
  75.  
  76. class IGrabHandles : public IVBase
  77. {
  78. public:
  79.  
  80. /*---------------------- Construction/Destruction ----------------------------*/
  81.  
  82.                             IGrabHandles( IMGrabbable&,
  83.                                           Boolean dragMove = false );
  84.     virtual                 ~IGrabHandles();
  85.     
  86.  
  87. /*------------------------ Location/Positioning ------------------------------*/
  88.  
  89.     enum ELocation          { kInside, kOutside,
  90.                               kTopLeft, kTopMiddle, kTopRight,
  91.                               kMiddleLeft, kMiddleRight,
  92.                               kBottomLeft, kBottomMiddle, kBottomRight };
  93.     
  94.     virtual IRectangle&     getOutline() const;
  95.     virtual ELocation       getLocation( const IPoint& position );
  96.  
  97.     virtual void            changeTo( const IRectangle& newRect );
  98.     virtual void            moveTo( const IPoint& newPoint );
  99.  
  100.     
  101. /*--------------------------- Rendering/Control ------------------------------*/
  102.     
  103.     virtual void            draw( IPresSpaceHandle& ps, 
  104.                                   Boolean bWithHandles = true ) const;
  105.  
  106.     virtual void            mouseDown( const IPoint& position );
  107.  
  108. private:
  109.     void                    moveHandles();
  110.  
  111.     IGrabHandler*           fpHandler;
  112.     IRectangle              fOutline;
  113.     IRectangle              fTL;
  114.     IRectangle              fTM;
  115.     IRectangle              fTR;
  116.     IRectangle              fML;
  117.     IRectangle              fMR;
  118.     IRectangle              fBL;
  119.     IRectangle              fBM;
  120.     IRectangle              fBR;
  121.  
  122. friend class IGrabHandler;
  123. };
  124.  
  125.  
  126. #pragma pack()
  127.  
  128.  
  129. #endif // _IGRABHDL_
  130.