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

  1. #ifndef _IGRAPHIC_
  2. #define _IGRAPHIC_
  3. /*******************************************************************************
  4. * FILE NAME: igraphic.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IGraphic                                                                 *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - 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.  
  19. #include <ivbase.hpp>
  20. #include <irect.hpp>
  21. #include <igbundle.hpp>
  22. #include <itrnsfrm.hpp>
  23.  
  24.  
  25. class IGraphicContext;
  26.  
  27. #pragma pack(4)
  28.  
  29. class IGraphic : public IVBase {
  30. typedef IVBase
  31.   Inherited;
  32. protected:
  33. /*------------------------------- Constructors -------------------------------*/
  34.   IGraphic   ( );
  35.   IGraphic   ( const IGraphicBundle& graphicBundle );
  36.   IGraphic   ( const IGraphic&       graphic       );
  37.  
  38. IGraphic
  39.   &operator= ( const IGraphic&       graphic       );
  40.  
  41. public:
  42.  
  43. virtual
  44.   ~IGraphic  ( );
  45.  
  46. /*---------------------------------- Drawing ---------------------------------*/
  47. virtual IGraphic
  48.   &drawOn                ( IGraphicContext& graphicContext ) = 0;
  49.  
  50. /*----------------------------- Bounding Rectangle ---------------------------*/
  51. virtual IRectangle
  52.   boundingRect           ( IGraphicContext& graphicContext );
  53.  
  54. /*---------------------------- Graphic Bundles -------------------------------*/
  55. virtual IGraphic
  56.   &setGraphicBundle      ( const IGraphicBundle& graphicBundle );
  57.  
  58. virtual IGraphicBundle
  59.   graphicBundle          ( ) const;
  60.  
  61. virtual IGraphic
  62.   &removeGraphicBundle   ( );
  63.  
  64. virtual IBase::Boolean
  65.   hasGraphicBundle       ( ) const;
  66.  
  67. /*------------------------ World Space Transformation ------------------------*/
  68. enum TransformMethod {
  69.   replace,
  70.   rightMultiply,
  71.   leftMultiply
  72.   };
  73.  
  74. virtual IGraphic
  75.   &rotateBy              ( double                  angle,
  76.                            const IPoint&           point = IPoint(0,0)  ),
  77.   &scaleBy               ( double                  xScale,
  78.                            double                  yScale,
  79.                            const IPoint&           point = IPoint(0,0)   ),
  80.   &translateBy           ( const IPoint&           point                 ),
  81.   &setTransformMatrix    ( const ITransformMatrix& transformMatrix       ),
  82.   &setTransformMethod    ( TransformMethod         transformMethod = rightMultiply );
  83.  
  84. virtual IBase::Boolean
  85.   hasTransformMatrix     ( ) const;
  86.  
  87. const ITransformMatrix
  88.   transformMatrix        ( ) const;
  89.  
  90. IGraphic::TransformMethod
  91.   transformMethod        ( ) const;
  92.  
  93. virtual IGraphic
  94.   &resetTransformMatrix  ( );
  95.  
  96. /*--------------------------------- Hit Testing ------------------------------*/
  97. virtual IBase::Boolean
  98.   contains               ( IGraphicContext& graphicContext,
  99.                            const IPoint&    point                );
  100.  
  101. virtual IGraphic
  102.   &setHitSelected        ( IBase::Boolean   hitSelected = false  );
  103.  
  104. virtual IBase::Boolean
  105.   isHitSelected          ( ) const;
  106.  
  107. virtual IGraphic
  108.   &setHitSelectable      ( IBase::Boolean   hitSelectable = true );
  109.  
  110. virtual IBase::Boolean
  111.   isHitSelectable        ( ) const;
  112.  
  113. /*------------------------------ Object Identifier ---------------------------*/
  114. virtual IGraphic
  115.   &setId                 ( unsigned long identifier );
  116.  
  117. virtual unsigned long
  118.   id                     ( ) const;
  119.  
  120. protected:
  121.  
  122. /*------------------------------- Comparison ---------------------------------*/
  123. IBase::Boolean
  124.   operator == ( const IGraphic& graphic ) const,
  125.   operator != ( const IGraphic& graphic ) const;
  126.  
  127. /*-------------------------------- Private -----------------------------------*/
  128. private:
  129. unsigned long
  130.   fId;
  131. TransformMethod
  132.   fTm;
  133. IGraphicBundle
  134.  *fBundle;
  135. ITransformMatrix
  136.  *fTransMat;
  137. IBase::Boolean
  138.   fSelected,
  139.   fSelectable,
  140.   fIsList;
  141. friend class IGList;
  142. }; // IGraphic
  143.  
  144. #pragma pack()
  145.  
  146. #endif // _IGRAPHIC_
  147.