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

  1. #ifndef _IGRAFCTX_
  2. #define _IGRAFCTX_
  3. /*******************************************************************************
  4. * FILE NAME: igrafctx.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IGraphicContext                                                          *
  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 <icolor.hpp>
  21. #include <igbundle.hpp>
  22. #include <ihandle.hpp>
  23. #include <irect.hpp>
  24. #include <igraphic.hpp>
  25. #include <itrnsfrm.hpp>
  26.  
  27.  
  28. class IGLine;
  29. class IGPolyline;
  30. class IGPolygon;
  31. class IGRectangle;
  32. class IGEllipse;
  33. class IGArc;
  34. class IG3PointArc;
  35. class IGPie;
  36. class IGChord;
  37. class IGString;
  38. class IGList;
  39. class IFont;
  40. class IGraphic;
  41. class IGPicture;
  42. class IGRegion;
  43. class IGCData;
  44.  
  45. #pragma pack(4)
  46.  
  47. class IGraphicContext : public IVBase {
  48. typedef IVBase
  49.   Inherited;
  50. public:
  51. /*------------------------------- Constructors -------------------------------*/
  52.   IGraphicContext( );
  53.  
  54.   IGraphicContext( const IPresSpaceHandle& presSpaceHandle );
  55.  
  56.   IGraphicContext( const IWindowHandle&    windowHandle    );
  57.  
  58.   IGraphicContext( const ISize&            contextSize     );
  59.  
  60. virtual
  61.   ~IGraphicContext();
  62.  
  63. /*----------------------------- Mapping Modes --------------------------------*/
  64. enum MappingMode {
  65.   pels,
  66.   lowMetric,
  67.   highMetric,
  68.   lowEnglish,
  69.   highEnglish,
  70.   twips,
  71.   isotropic
  72.   };
  73.  
  74. virtual IGraphicContext
  75.   &setMappingMode        ( MappingMode mappingMode = pels );
  76.  
  77. virtual MappingMode
  78.   mappingMode            ( ) const;
  79.  
  80. /*------------------------- Device Space Transformation ----------------------*/
  81. virtual IGraphicContext
  82.   &setPageSize           ( const ISize& pageSize               );
  83.  
  84. virtual ISize
  85.   pageSize               ( ) const;
  86.  
  87. virtual IGraphicContext
  88.   &setViewPortRect       ( const IRectangle& viewportRectangle );
  89.  
  90. virtual IRectangle
  91.   viewPortRect           ( ) const;
  92.  
  93.  
  94. /*-------------------------------- Drawing -----------------------------------*/
  95. virtual IGraphicContext
  96.   &draw         ( const IGLine&      line             ),
  97.   &draw         ( const IGPolyline&  polyline         ),
  98.   &draw         ( const IGPolygon&   polygon          ),
  99.   &draw         ( const IGEllipse&   geometry         ),
  100.   &draw         ( const IGRectangle& graphicRectangle ),
  101.   &draw         ( const IGArc&       arc              ),
  102.   &draw         ( const IG3PointArc& arc              ),
  103.   &draw         ( const IGPie&       pie              ),
  104.   &draw         ( const IGChord&     chord            ),
  105.   &draw         ( const IGString&    graphicString    ),
  106.   &draw         ( const IGList&      list             ),
  107.   &draw         ( const IGRegion&    region           );
  108.  
  109. /*------------------------------ Recoordination ------------------------------*/
  110. IGraphicContext
  111.   &setRecoordinationHeight    ( unsigned long height );
  112.  
  113. unsigned long
  114.   recoordinationHeight        ( ) const;
  115.  
  116. /*----------------------------- Default Attributes ---------------------------*/
  117. static void
  118.   setDefaultPenColor          ( const IColor&                     penColor       ),
  119.   setDefaultFillColor         ( const IColor&                     fillColor      ),
  120.   setDefaultBackgroundColor   ( const IColor&                     backgroundColor),
  121.   setDefaultDrawOperation     ( IGraphicBundle::DrawOperation     drawOperation  ),
  122.   setDefaultMixMode           ( IGraphicBundle::MixMode           mixMode        ),
  123.   setDefaultBackgroundMixMode ( IGraphicBundle::BackgroundMixMode backMixMode    ),
  124.   setDefaultPenType           ( IGraphicBundle::PenType           penType        ),
  125.   setDefaultPenEndingStyle    ( IGraphicBundle::PenEndingStyle    penEndingStyle ),
  126.   setDefaultPenJoiningStyle   ( IGraphicBundle::PenJoiningStyle   penJoiningStyle),
  127.   setDefaultPenWidth          ( unsigned long                     penWidth       ),
  128.   setDefaultPenPattern        ( unsigned long                     penPattern     ),
  129.   setDefaultFillPattern       ( unsigned long                     fillPattern    ),
  130.   setDefaultPatternOrigin     ( const IPoint&                     point          );
  131.  
  132. static IColor
  133.   defaultPenColor                        ( ),
  134.   defaultFillColor                       ( ),
  135.   defaultBackgroundColor                 ( );
  136. static IGraphicBundle::DrawOperation
  137.   defaultDrawOperation                   ( );
  138. static IGraphicBundle::MixMode
  139.   defaultMixMode                         ( );
  140. static IGraphicBundle::BackgroundMixMode
  141.   defaultBackgroundMixMode               ( );
  142. static IGraphicBundle::PenType
  143.   defaultPenType                         ( );
  144. static IGraphicBundle::PenEndingStyle
  145.   defaultPenEndingStyle                  ( );
  146. static IGraphicBundle::PenJoiningStyle
  147.   defaultPenJoiningStyle                 ( );
  148. static unsigned long
  149.   defaultPenWidth                        ( );
  150. static unsigned long
  151.   defaultPenPattern                      ( ),
  152.   defaultFillPattern                     ( );
  153. static IPoint
  154.   defaultPatternOrigin                   ( );
  155.  
  156.  
  157. /*-------------------------------- Attributes --------------------------------*/
  158. virtual IGraphicContext
  159.   &setGraphicBundle     ( const IGraphicBundle&             graphicBundle     ),
  160.   &setPenColor          ( const IColor&                     penColor          ),
  161.   &setBackgroundColor   ( const IColor&                     backgroundColor   ),
  162.   &setFillColor         ( const IColor&                     fillColor         ),
  163.   &setDrawOperation     ( IGraphicBundle::DrawOperation     drawOperation     ),
  164.   &setMixMode           ( IGraphicBundle::MixMode           mixMode           ),
  165.   &setBackgroundMixMode ( IGraphicBundle::BackgroundMixMode backgroundMixMode ),
  166.   &setPenType           ( IGraphicBundle::PenType           penType           ),
  167.   &setPenEndingStyle    ( IGraphicBundle::PenEndingStyle    penEndingStyle    ),
  168.   &setPenJoiningStyle   ( IGraphicBundle::PenJoiningStyle   penJoiningStyle   ),
  169.   &setPenWidth          ( unsigned long                     width             ),
  170.   &setPenPattern        ( unsigned long                     penPattern        ),
  171.   &setFillPattern       ( unsigned long                     fillPattern       ),
  172.   &setPatternOrigin     ( const IPoint&                     point             );
  173.  
  174. virtual IGraphicBundle
  175.   graphicBundle                            ( ) const;
  176. virtual IColor
  177.   penColor                                 ( ) const,
  178.   backgroundColor                          ( ) const,
  179.   fillColor                                ( ) const;
  180. virtual IGraphicBundle::DrawOperation
  181.   drawOperation                            ( ) const;
  182. virtual IGraphicBundle::MixMode
  183.   mixMode                                  ( ) const;
  184. virtual IGraphicBundle::BackgroundMixMode
  185.   backgroundMixMode                        ( ) const;
  186. virtual IGraphicBundle::PenType
  187.   penType                                  ( ) const;
  188. virtual IGraphicBundle::PenEndingStyle
  189.   penEndingStyle                           ( ) const;
  190. virtual IGraphicBundle::PenJoiningStyle
  191.   penJoiningStyle                          ( ) const;
  192. virtual unsigned long
  193.   penWidth                                 ( ) const;
  194. virtual unsigned long
  195.   penPattern                               ( ) const,
  196.   fillPattern                              ( ) const;
  197. virtual IPoint
  198.   patternOrigin                            ( ) const;
  199.  
  200. /*------------------------------ Font Operations -----------------------------*/
  201. virtual IGraphicContext
  202.   &setFont                    ( const IFont& font ),
  203.   &resetFont                  ( );
  204.  
  205. virtual IFont
  206.   currentFont                 ( ) const;
  207. virtual IBase::Boolean
  208.   hasFont                     ( ) const;
  209.  
  210. /*--------------------------- Region operations ------------------------------*/
  211. virtual IGraphicContext
  212.   &clearClipRegion ( ),
  213.   &setClipRegion   ( const IRegionHandle& region ),
  214.   &setClipRegion   ( const IGRegion&      region );
  215.  
  216. virtual IRegionHandle
  217.   clipRegion       ( ) const;
  218.  
  219. /*------------------------- World Space Transformation -----------------------*/
  220. virtual IGraphicContext
  221.   &setWorldTransformMatrix ( const ITransformMatrix&   transformMatrix,
  222.                              IGraphic::TransformMethod method = IGraphic::replace );
  223. virtual ITransformMatrix
  224.   worldTransformMatrix     ( ) const;
  225.  
  226. /*--------------------------- Boundary Accumulation --------------------------*/
  227. virtual IGraphicContext
  228.   &startBoundaryAccumulation ( );
  229.  
  230. virtual IRectangle
  231.   stopBoundaryAccumulation   ( );
  232.  
  233. virtual IGraphicContext
  234.   &addToBoundingRect         ( const IRectangle& rectangle );
  235.  
  236. virtual IBase::Boolean
  237.   isAccumulatingBoundingRect ( ) const;
  238.  
  239. /*------------------------------ Hit Testing ---------------------------------*/
  240. virtual IGraphicContext
  241.   &startHitTesting           ( ),
  242.   &stopHitTesting            ( ),
  243.   &setHitPoint               ( const IPoint& hitPoint  ),
  244.   &setHitApertureSize        ( const ISize&  hitSize   );
  245. IBase::Boolean
  246.   isHitTesting               ( ) const;
  247.  
  248. virtual IPoint
  249.   hitPoint                   ( ) const;
  250.  
  251. virtual ISize
  252.   hitApertureSize            ( ) const;
  253.  
  254. /*------------------------------- Conversions --------------------------------*/
  255. IPresSpaceHandle
  256.   handle                     ( ) const;
  257.  
  258. /*----------------------- Current Drawing Position ---------------------------*/
  259. virtual IGraphicContext
  260.   &setCurrentDrawingPosition  ( const IPoint& point );
  261.  
  262. virtual IPoint
  263.   currentDrawingPosition      ( ) const;
  264.  
  265. private:
  266. /*------------------------------- Private ------------------------------------*/
  267.  
  268. IGraphicContext( const IGraphicContext& gc );
  269. IGraphicContext& operator=( const IGraphicContext& );
  270. IGraphicContext
  271.   &apply( const IGraphic&   graphic,
  272.           ITransformMatrix& transformMatrix,
  273.           IGraphicBundle&   graphicBundle ),
  274.   &remove( const IGraphic&   graphic,
  275.            ITransformMatrix& transformMatrix,
  276.            IGraphicBundle&   graphicBundle );
  277. IGraphicContext
  278.   &initialize();
  279. static IColor
  280.   fgCDPenColor,
  281.   fgCDFillColor,
  282.   fgCDBackgroundColor;
  283. static IGraphicBundle::DrawOperation
  284.   fgCDDrawOperation;
  285. static IGraphicBundle::MixMode
  286.   fgCDMixMode;
  287. static IGraphicBundle::BackgroundMixMode
  288.   fgCDBackgroundMixMode;
  289. static unsigned long
  290.   fgCDPenPattern,
  291.   fgCDFillPattern;
  292. static IGraphicBundle::PenType
  293.   fgCDPenType;
  294. static IGraphicBundle::PenEndingStyle
  295.   fgCDPenEndingStyle;
  296. static IGraphicBundle::PenJoiningStyle
  297.   fgCDPenJoiningStyle;
  298. static unsigned long
  299.   fgCDPenWidth;
  300. static IPoint
  301.   fgCDPatternOrigin;
  302. IGCData
  303.  *fGCData;
  304. IPresSpaceHandle
  305.   fPs;
  306. IColor
  307.   fFillColor;
  308. unsigned long
  309.   fFillPattern;
  310. IGraphicBundle::DrawOperation
  311.   fDrawOp;
  312. IFont
  313.  *fFont;
  314. enum CreateMethod
  315.   { WindowHandle, Graphics, None };
  316. CreateMethod
  317.   fCm;
  318. unsigned long
  319.   fDc;
  320. IBitmapHandle
  321.   fBitmap;
  322. }; // IGraphicContext
  323.  
  324. #pragma pack()
  325.  
  326. #endif // _IGRAFCTX_
  327.