home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / Borland / Cplus45 / BC45 / OWLINC.PAK / METAFILE.H < prev    next >
C/C++ Source or Header  |  1995-08-29  |  3KB  |  82 lines

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