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

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WMetafile
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WMETAFIL_HPP_INCLUDED
  18. #define _WMETAFIL_HPP_INCLUDED
  19.  
  20. #ifndef _WNO_PRAGMA_PUSH
  21. #pragma pack(push,8);
  22. #pragma enum int;
  23. #endif
  24.  
  25. #ifndef _WCANVAS_HPP_INCLUDED
  26. #  include "wcanvas.hpp"
  27. #endif
  28.  
  29. enum WMetafileHandle { NULLHMF       = 0,  LASTHMF = LAST_16TO32BIT };
  30. class WMetafileReference;
  31.  
  32. class WCMCLASS WMetafile : public WObject {
  33.     WDeclareSubclass( WMetafile, WObject );
  34.     
  35.     public:
  36.  
  37.         /**********************************************************
  38.          * Constructors and Destructors
  39.          *********************************************************/
  40.  
  41.         WMetafile();
  42.         WMetafile( const WChar *fileName,
  43.                    const WChar *pictureTitle=NULL,
  44.                    const WChar *applicationName=NULL,
  45.                    const WInfoCanvas *referenceCanvas=NULL,
  46.                    const WRect *dimensions=NULL );
  47.         WMetafile( WMetafileHandle handle, WBool deleteHandle=FALSE );
  48.         WMetafile( const WMetafile & metafile );
  49.     
  50.         ~WMetafile();
  51.     
  52.         /**********************************************************
  53.          * Properties
  54.          *********************************************************/
  55.  
  56.         // Handle
  57.  
  58.         WMetafileHandle GetHandle() const;
  59.  
  60.         // Valid
  61.  
  62.         WBool GetValid() const;
  63.  
  64.         /**********************************************************
  65.          * Methods
  66.          *********************************************************/
  67.  
  68.         // Clear
  69.         //
  70.         //    Calls Close, then deletes the metafile from memory.
  71.  
  72.         void Clear();
  73.  
  74.         // Close
  75.         //
  76.         //    Closes a metafile opened with Create so that no
  77.         //    further drawing is possible.
  78.  
  79.         WBool Close();
  80.  
  81.         // Copy
  82.         //
  83.         //    Copies a metafile and returns a new WMetafile that
  84.         //    represents the copy.  If no filename is given, an
  85.         //    in-memory copy is made.  Free the returned metafile
  86.         //    using delete.
  87.  
  88.         WMetafile * Copy( const WChar * fileName=NULL );
  89.  
  90.         // Create
  91.         //
  92.         //    Create a new metafile.  If no filename is given,
  93.         //    the metafile is in-memory.  Returns a canvas which
  94.         //    is used to draw on the metafile. Do not delete the
  95.         //    canvas.  NULL is returned if an error occurred.
  96.  
  97.         WCanvas *Create( const WMetafile & metafile );
  98.         WCanvas *Create( WMetafileHandle handle, WBool deleteHandle=FALSE );
  99.         WCanvas *Create( const WChar * fileName=NULL,
  100.                           const WChar * pictureTitle=NULL,
  101.                           const WChar * applicationName=NULL,
  102.                           const WInfoCanvas * referenceCanvas=NULL,
  103.                           const WRect * dimensions=NULL );
  104.  
  105.         // Load
  106.         //
  107.         //    Load an already-existing metafile.
  108.  
  109.         WBool Load( const WChar * fileName );
  110.  
  111.         // Play
  112.         //
  113.         //    Plays a metafile into the given canvas, within the
  114.         //    bounding rectangle.
  115.  
  116.         WBool Play( const WCanvas & canvas, const WRect & bounds );
  117.  
  118.         /**********************************************************
  119.          * Operators
  120.          *********************************************************/
  121.  
  122.         WMetafile & operator=( const WMetafile & metafile );
  123.  
  124.         /**********************************************************
  125.          * Data members
  126.          *********************************************************/
  127.  
  128.     private:
  129.  
  130.         WMetafileReference *            _ref;
  131. };
  132.  
  133. #ifndef _WNO_PRAGMA_PUSH
  134. #pragma enum pop;
  135. #pragma pack(pop);
  136. #endif
  137.  
  138. #endif // _WMETAFIL_HPP_INCLUDED
  139.