home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sybase / powerj / hpp.z / WOLEPICT.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  8KB  |  227 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. #ifndef _WOLEPICT_HPP_INCLUDED
  12. #define _WOLEPICT_HPP_INCLUDED
  13.  
  14. #ifndef _WNO_PRAGMA_PUSH
  15. #pragma pack(push,8);
  16. #pragma enum int;
  17. #endif
  18.  
  19. #ifndef _WOLEAUTO_HPP_INCLUDED
  20. #   include "woleauto.hpp"
  21. #endif
  22. #ifndef _WDSPHLPR_HPP_INCLUDED
  23. #   include "wdsphlpr.hpp"
  24. #endif
  25. #ifndef _WRECT_HPP_INCLUDED
  26. #   include "wrect.hpp"
  27. #endif
  28. #ifndef _WBITMAP_HPP_INCLUDED
  29. #   include "wbitmap.hpp"
  30. #endif
  31. #ifndef _WPALETTE_HPP_INCLUDED
  32. #   include "wpalette.hpp"
  33. #endif
  34. #ifndef _WMETAFIL_HPP_INCLUDED
  35. #   include "wmetafil.hpp"
  36. #endif
  37.  
  38. #define WPICTURE_SCALABLE       0x1l
  39. #define WPICTURE_TRANSPARENT    0x2l
  40.  
  41. #define WPICTYPE_UNINITIALIZED  ((WUInt)-1)
  42. #define WPICTYPE_NONE           0
  43. #define WPICTYPE_BITMAP         1
  44. #define WPICTYPE_METAFILE       2
  45. #define WPICTYPE_ICON           3
  46.  
  47. typedef struct WPictDesc {
  48.     WUInt picType;
  49.     union {
  50.         struct {
  51.             WBitmapHandle       hbitmap;        // Bitmap
  52.             WPaletteHandle      hpal;           // Accompanying palette
  53.         } bmp;
  54.  
  55.         struct {
  56.             WMetafileHandle     hmeta;          // Metafile
  57.             WInt                xExt;
  58.             WInt                yExt;           // Extent
  59.         } wmf;
  60.  
  61.         struct {
  62.             WIconHandle hicon;                  // Icon
  63.         } icon;
  64.     };
  65. } WPictDesc;
  66.  
  67. /*************************************************************************
  68.  *
  69.  * WPictureDisp -- Standard OLE Picture type dispatch helper
  70.  *
  71.  *
  72.  *   Events:
  73.  *
  74.  *
  75.  *************************************************************************/
  76.  
  77. class WCMCLASS WPictureDisp : public WOleDispatchHelper {
  78.  
  79.     public:
  80.  
  81.         /**********************************************************
  82.          * Constructors and Destructors
  83.          *********************************************************/
  84.  
  85.         WPictureDisp( WPIDispatch pIDispatch=NULL, WBool release=TRUE, WBool initMembers=TRUE );
  86.         WPictureDisp( const WPictureDisp & pictureDisp );
  87.         ~WPictureDisp();
  88.  
  89.  
  90.         /**********************************************************
  91.          * Properties
  92.          *********************************************************/
  93.  
  94.         // Handle
  95.         WShort GetHandle( void );
  96.         WBool SetHandle( WShort handle );
  97.  
  98.         // HPal
  99.         WShort GetHPal( void );
  100.         WBool SetHPal( WShort hpal );
  101.  
  102.         // Type
  103.         WShort GetType( void );
  104.         WBool SetType( WShort type );
  105.  
  106.         // Width
  107.         WLong GetWidth( void );
  108.         WBool SetWidth( WLong width );
  109.  
  110.         // Height
  111.         WLong GetHeight( void );
  112.         WBool SetHeight( WLong height );
  113.     
  114.         /**********************************************************
  115.          * Methods
  116.          *********************************************************/
  117.  
  118.         WBool Render( WDeviceHandle hdc, WLong x, WLong y, WLong cx, WLong cy,
  119.                       WOLE_XPOS_HIMETRIC xSrc, WOLE_YPOS_HIMETRIC ySrc,
  120.                       WOLE_XSIZE_HIMETRIC cxSrc, WOLE_YSIZE_HIMETRIC cySrc,
  121.                       WRect & prcWBounds );
  122.  
  123.         /**************************************************************
  124.          * Operators
  125.          **************************************************************/
  126.  
  127.         WPictureDisp & operator=( const WPictureDisp & pictureDisp );
  128.  
  129.         /**********************************************************
  130.          * Data
  131.          *********************************************************/
  132. };
  133.  
  134. /*************************************************************************
  135.  *
  136.  * WIPicture -- Standard OLE Picture type
  137.  *
  138.  *
  139.  *   Events:
  140.  *
  141.  *
  142.  *************************************************************************/
  143.  
  144. class WCMCLASS WIPicture : public WObject {
  145.     WDeclareSubclass( WIPicture, WObject );
  146.  
  147.     public:
  148.  
  149.         /**********************************************************
  150.          * Constructors and Destructors
  151.          *********************************************************/
  152.  
  153.         WIPicture();
  154.         WIPicture( WPIPicture ipicture );
  155.         WIPicture( const WIPicture & ipicture );
  156.         WIPicture( const WPictDesc & pd, WBool pictureOwnsHandle=TRUE );
  157.         WIPicture( const WBitmap & bitmap );
  158.         WIPicture( const WIcon & icon );
  159.         WIPicture( const WMetafile & metafile, WInt xExt=0, WInt yExt=0 );
  160.         virtual ~WIPicture();
  161.  
  162.     public:
  163.  
  164.         /**************************************************************
  165.          * Properties
  166.          **************************************************************/
  167.  
  168.         WOLE_HANDLE GetHandle( void ) const;
  169.         WOLE_HANDLE GetHPal( void ) const;
  170.         WShort GetType( void ) const;
  171.         WOLE_XSIZE_HIMETRIC GetWidth( void ) const;
  172.         WOLE_YSIZE_HIMETRIC GetHeight( void ) const;
  173.         WBool SetHPal( WOLE_HANDLE hpal );
  174.         WDeviceHandle GetCurDC( void ) const;
  175.         WBool GetKeepOriginalFormat( void ) const;
  176.         WBool SetKeepOriginalFormat( WBool fkeep );
  177.         WULong GetAttributes( void ) const;
  178.  
  179.         WPIPicture GetIPicture( void ) const;
  180.         WPIDispatch GetIDispatch( void ) const;
  181.         WPictureDisp GetPictureDisp( void ) const;
  182.  
  183.         /**********************************************************
  184.          * Methods
  185.          *********************************************************/
  186.  
  187.         // Creation Methods
  188.         static WIPicture *CreatePicture( void );
  189.         static WIPicture *CreatePictureIndirect( const WPictDesc & pd,
  190.                                                  WBool pictureOwnsHandle=TRUE
  191.                                                  );
  192.         static WIPicture *LoadPicture( const WPIStream stream, WLong size=0,
  193.                                        WBool keepOriginalFormat=TRUE );
  194.  
  195.         // IPicture Methods
  196.         WBool Render( WDeviceHandle hdc, WLong x, WLong y, WLong cx, WLong cy,
  197.                       WOLE_XPOS_HIMETRIC xSrc, WOLE_YPOS_HIMETRIC ySrc,
  198.                       WOLE_XSIZE_HIMETRIC cxSrc, WOLE_YSIZE_HIMETRIC cySrc,
  199.                       WRect & prcWBounds );
  200.         WBool SelectPicture( WDeviceHandle hdcIn, WDeviceHandle & phdcOut,
  201.                              WOLE_HANDLE & phbmpOut );
  202.         WBool PictureChanged( void );
  203.         WBool SaveAsFile( WPIStream lpstream, WBool fSaveMemCopy,
  204.                           WLong & pcbSize );
  205.  
  206.         /**************************************************************
  207.          * Operators
  208.          **************************************************************/
  209.  
  210.         WIPicture & operator=( const WIPicture & picture );
  211.  
  212.     /**********************************************************
  213.      * Data Members
  214.      *********************************************************/
  215.     
  216.     private:
  217.         WPIPicture      _ipicture;
  218. };
  219.  
  220. #ifndef _WNO_PRAGMA_PUSH
  221. #pragma enum pop;
  222. #pragma pack(pop);
  223. #endif
  224.  
  225. #endif // _WOLEFONT_HPP_INCLUDED
  226.  
  227.