home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IDRGIMG_
- #define _IDRGIMG_
- /*--------------------------------------------------------------*/
- /* CLASS NAME: IDragImage */
- /* */
- /* DESCRIPTION : Drag image encapsulation */
- /* */
- /* CHANGE ACTIVITY: */
- /* --------------- */
- /* DATE: INITIAL: DESCRIPTION: */
- /* 08/22/92 PHG Created from IDRGITM.HPP */
- /*--------------------------------------------------------------*/
- /* Copyright (c) IBM Corporation 1991 */
- /*--------------------------------------------------------------*/
-
- #ifndef _IBASETYP_
- #include <ibasetyp.hpp>
- #endif
- #ifndef _IPOINT_
- #include <ipoint.hpp>
- #endif
- #ifndef _IRESLIB_
- #include <ireslib.hpp>
- #endif
-
- class IDragImage : public IBase {
- /**************************************************************************
- * This class encapsulates the PM DRAGIMAGE structure *
- * Hungarian is 'drgimg' *
- **************************************************************************/
- public:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------+
- | There are 3 ways to construct instances of this class: |
- | 1. default, from resource icon or bitmap |
- | 2. from pointer handle |
- | 2. from bitmap handle |
- +------------------------------------------------------------------------*/
- IDragImage(const IResourceId& resid,
- const ISize& sizOffset,
- const ISize& sizStretch=ISize(0,0),
- Boolean bIconResource=true);
-
- IDragImage(const IPointerHandle& ptrhIcon,
- const ISize& sizOffset,
- const ISize& sizStretch=ISize(0,0));
-
- IDragImage(const IBitmapHandle& bmphBitmap,
- const ISize& sizOffset,
- const ISize& sizStretch=ISize(0,0));
-
- ~IDragImage();
-
- /*-------------------------------- ACCESSORS -----------------------------+
- | These function provide means of getting and setting the accessible |
- | attributes of instances of this class: |
- | dragimageStruct - Fills-in a DRAGIMAGE structure |
- | pointerOffset - return the image's offset from mouse pointer |
- | stretchSize - return the stretch size |
- | dragPointer - return the pointer to the internal pointer handle if any |
- | dragBitmap - return the pointer to the internal bitmap handle if any |
- | isIcon - test whether the image is an icon (otherwise, it's a bitmap) |
- | isTransparent - test wether the 'transparent' bit is set |
- | setPointerOffset - set the pointer's offset from mouse hotspot |
- | setStretchSize - set the strech size, ISize(0,0) for no stretch |
- | setTransparent - set the transparent flag |
- +------------------------------------------------------------------------*/
- void
- dragimageStruct(void* pdragimage,
- unsigned long uldimgSize) const;
- ISize
- pointerOffset() const,
- stretchSize() const;
-
- IPointerHandle*
- dragPointer() const;
- IBitmapHandle*
- dragBitmap() const;
- Boolean
- isIcon() const,
- isTransparent() const;
-
- IDragImage
- &setPointerOffset(const ISize& sizPointerOffset),
- &setStretchSize(const ISize& sizStretch=ISize()),
- &setTransparent(Boolean bTransparent=true);
-
- // helper functions
- /*-------------------------------- HELPER --------------------------------+
- | These are helper functions |
- | iconSize - returns the size of the icons for this system |
- +------------------------------------------------------------------------*/
- static ISize
- iconSize();
-
- private:
- /*------------------------------ DATA MEMBERS ----------------------------+
- | Private data members |
- | sizClOffset - Offset |
- | sizClStretch - stretch size, (0,0) for no stretch |
- | pptrhClDragIcon - pointer to icon handle if this is an icon |
- | pbmphClDragBitmap - pointer to bitmap handle if this is a bitmap |
- | bClTransparent - Transparent bit flag |
- +------------------------------------------------------------------------*/
- /* instance vars */
- ISize sizClOffset;
- ISize sizClStretch;
- IPointerHandle* pptrhClDragIcon;
- IBitmapHandle* pbmphClDragBitmap;
- Boolean bClTransparent;
-
- }; // IDragImage
-
- /*=========================================================================
- | Inlines for IDragImage PHG 24/10 |
- =========================================================================*/
- inline ISize IDragImage :: pointerOffset() const
- { return(sizClOffset); }
-
- inline ISize IDragImage :: stretchSize() const
- { return(sizClStretch); }
-
- inline IPointerHandle* IDragImage :: dragPointer() const
- { return(pptrhClDragIcon); }
-
- inline IBitmapHandle* IDragImage :: dragBitmap() const
- { return(pbmphClDragBitmap); }
-
- inline Boolean IDragImage :: isIcon() const
- { return(pptrhClDragIcon!=0); }
-
- inline Boolean IDragImage :: isTransparent() const
- { return(bClTransparent); }
-
- inline IDragImage& IDragImage :: setPointerOffset(const ISize& sizOffset)
- { sizClOffset=sizOffset; return(*this); }
-
- inline IDragImage& IDragImage :: setStretchSize(const ISize& sizStretch)
- { sizClStretch=sizStretch; return(*this); }
-
- inline IDragImage& IDragImage :: setTransparent(Boolean bTransparent)
- { bClTransparent=bTransparent; return(*this); }
-
- #endif /* ndef _IDRGIMG_ */