home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 19.ddi / OWLINC.PAK / METAFILE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  2.6 KB  |  81 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows - (C) Copyright 1991, 1993 by Borland International
  3. //   include\owl\metafile.h
  4. //   Definition of a MetaFile wrapper class
  5. //----------------------------------------------------------------------------
  6. #if !defined(__OWL_METAFILE_H)
  7. #define __OWL_METAFILE_H
  8.  
  9. #if !defined(__OWL_GDIBASE_H)
  10.   #include <owl\gdibase.h>
  11. #endif
  12. class _OWLCLASS TClipboard;
  13. class _OWLCLASS TDC;
  14.  
  15. //
  16. // class TMetafilePict
  17. // ----- -------------
  18. //
  19. // A class that wraps a windows metafile that can be played into a DC, or
  20. // put on the clipboard, etc.
  21. //
  22. class _OWLCLASS TMetaFilePict : private TGdiBase {
  23.   public:
  24.     TMetaFilePict(HMETAFILE handle, TAutoDelete autoDelete);
  25.     TMetaFilePict(const TClipboard& clipboard);
  26.     TMetaFilePict(const char* filename);
  27.   #if defined(__WIN32__)
  28.     TMetaFilePict(UINT size, void far* data);
  29.   #else
  30.     TMetaFilePict(HGLOBAL data);
  31.   #endif
  32.     TMetaFilePict(const TMetaFilePict&, const char far* fileName = 0);
  33.    ~TMetaFilePict();
  34.  
  35.     operator    HMETAFILE() const {return HMETAFILE(Handle);}
  36.  
  37.   #if defined(__WIN32__)
  38.     DWORD       GetMetaFileBitsEx(UINT size, void* data);
  39.   #else
  40.     HANDLE      GetMetaFileBits() {return ::GetMetaFileBits(HMETAFILE(Handle));}
  41.   #endif
  42.  
  43.     // Play this metafile onto a dc
  44.     TSize     CalcPlaySize(TDC& dc, const TSize& defSize) const;
  45.     BOOL      PlayOnto(TDC& dc, const TSize& defSize) const;
  46.  
  47.     // Put this MetaFilePict onto the clipboard
  48.     void      ToClipboard(TClipboard& clipboard, 
  49.                           unsigned mapMode = MM_ANISOTROPIC,
  50.                           const TSize& extent=TSize(0,0));
  51.  
  52.     // Retrieve attributes of this metafile
  53.     unsigned  MappingMode() const {return Mm;}
  54.     int       Width() const {return Extent.cx;}
  55.     int       Height() const {return Extent.cy;}
  56.     TSize     Size() const {return Extent;}
  57.     
  58.     // Set attributes of this metafile
  59.     void      SetMappingMode(unsigned mm) {Mm = mm;}
  60.     void      SetSize(const TSize& size) {Extent = size;}
  61.     
  62.   protected:
  63.     int    Mm;        // Mapping mode
  64.     TSize  Extent;
  65.  
  66.   private:
  67.     //
  68.     // hidden to prevent accidental copying or assignment
  69.     //
  70.     TMetaFilePict& operator=(const TMetaFilePict&);
  71. };
  72.  
  73. //----------------------------------------------------------------------------
  74. // Inlines
  75. //----------------------------------------------------------------------------
  76.  
  77. inline TClipboard& operator <<(TClipboard& clipboard, TMetaFilePict& mfp)
  78.       {mfp.ToClipboard(clipboard); return clipboard;}
  79.  
  80. #endif  // __OWL_METAFILE_H
  81.