home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
cset21v1.zip
/
IBMCPP
/
IBMCLASS
/
IDMIMAGE.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-22
|
11KB
|
223 lines
#ifndef _IDMIMAGE_
#define _IDMIMAGE_
/*******************************************************************************
* FILE NAME: idmimage.hpp *
* *
* DESCRIPTION: *
* This file contains the declaration(s) of the class(es): *
* IDMImage - Base direct manipulation "image" class. *
* *
* COPYRIGHT: *
* Licensed Materials - Property of IBM *
* (C) Copyright IBM Corporation 1992, 1993 *
* All Rights Reserved *
* US Government Users Restricted Rights - Use, duplication, or *
* disclosure *
* restricted by GSA ADP Schedule Contract with IBM Corp. *
* *
*******************************************************************************/
#ifndef _IVBASE_
#include <ivbase.hpp>
#endif
#ifndef _IPOINT_
#include <ipoint.hpp>
#endif
#ifndef _IRESLIB_
#include <ireslib.hpp>
#endif
#ifndef _IBITFLAG_
#include <ibitflag.hpp>
#endif
/*----------------------------------------------------------------------------*/
/* Align classes on four byte boundary. */
/*----------------------------------------------------------------------------*/
#pragma pack(4)
/* Forward Declarations */
struct _DRAGIMAGE;
class IDMImage : public IVBase {
typedef IVBase
Inherited;
/*******************************************************************************
* This is the common base class for the direct manipulation drag image *
* classes. This base class provides the common support required to represent *
* the image of IDMItem objects that are dragged during a direct manipulation *
* operation. *
* *
* Objects of this class are created to provide an image to be displayed for *
* each IDMItem object being dragged. As each IDMItem object is created, this *
* class can be created and attatched to it such that proper image *
* representation can be made during the direct manipulation operation. If *
* this class is not attatched to IDMItem objects, default system icons will be *
* used for images. *
* *
* Objects of this class possess the following attributes (in addition to *
* those inherited from its base class): *
* o image handle. *
* o stretch size for image. *
* o styles to determine type and shape of image. *
* o offset of image from the pointing device. *
* o number of points in a point arrary if certain styles are set. *
* *
* Ojbects of this class are not necessary to create if using IDM::systemImages *
* for the images. (See idmcomm.hpp) Use of IDM::systemImages will cause *
* system images to be generated and used, thus ignoring any images attatched *
* to IDMItem objects. *
*******************************************************************************/
public:
/*--------------------------------- Image Styles -------------------------------
| The following static members provide the set of pre-defined image styles: |
| ptr - image is an IPointerHandle. |
| bmp - image is an IBitmapHandle. |
| polygon - image is a pointer to an array of points that will be |
| connected to form a polygon. The first point of the array |
| should be (0,0), and the other points should be placed |
| relative to this position. |
| stretch - if the image is an IPointerHandle or an IBitmapHandle, the |
| image is stretched to the dimensions specified by |
| stretchSize. |
| transparent - if the image is an IPointerHandle, an outline of the image |
| is generated and displayed instead of the original image. |
| closed - if the image is a polygon, a closed polygon is formed by |
| moving the current position to the last point in the array |
| before drawing. |
------------------------------------------------------------------------------*/
INESTEDBITFLAGCLASSDEF0(Style, IDMImage);
static const Style
ptr,
bmp,
polygon,
stretch,
transparent,
closed;
/*------------------------- Constructors/Destructor ----------------------------
| Objects of this class are constructed in the following manner: |
| o without parameters to create a generic object. |
| o by providing an icon or bitmap resource. |
| o by providing a pointer handle. |
| o by providing a bitmap handle. |
| o by providing an array of points to draw a polygon. |
------------------------------------------------------------------------------*/
IDMImage ( );
IDMImage (const IResourceId &resourceId,
const ISize &pointerOffset = ISize(0,0),
const ISize &stretchSize = ISize(0,0),
const IDMImage::Style style = 0,
Boolean iconResource = true);
IDMImage (const IPointerHandle &icon,
const ISize &pointerOffset = ISize(0,0),
const ISize &stretchSize = ISize(0,0),
const IDMImage::Style style = 0);
IDMImage (const IBitmapHandle &bitmap,
const ISize &pointerOffset = ISize(0,0),
const ISize &stretchSize = ISize(0,0),
const IDMImage::Style style = 0);
IDMImage (unsigned long arrayOfPoints[],
const ISize &pointerOffset = ISize(0,0),
const IDMImage::Style style = 0,
const unsigned long points = 0);
virtual
~IDMImage ( );
/*--------------------------------- Accessors ----------------------------------
| These functions provide means of getting and setting the accessible |
| attributes of instances of this class: |
| pointer - returns the pointer image handle. |
| bitmap - returns the bitmap image handle. |
| pointerOffset - returns the offset of the image from the pointing |
| device. |
| stretchSize - returns the size of the image when stretched. |
| style - returns the styles used to describe the image. |
| numberOfPoints - returns the number of array points used to make up the |
| image. |
| pointArray - returns the array of points used to draw a polygon if |
| the image style is set to IDM::polygon. If the image |
| isn't a drawn polygon, then it returns 0. |
| setPointer - sets the pointer image handle. |
| setBitmap - sets the bitmap image handle. |
| setPointerOffset - sets the offset of the image from the pointing device. |
| setStretchSize - sets the size of the image when stretched. |
| setStyle - sets the styles used to describe the image. |
| setNumberOfPoints - sets the number of array points field of the image. |
| setPointArray - sets the point array to be used to draw the image. |
------------------------------------------------------------------------------*/
IPointerHandle
pointer ( );
IBitmapHandle
bitmap ( );
ISize
pointerOffset ( ),
stretchSize ( );
IDMImage::Style
style ( );
unsigned long
numberOfPoints ( );
unsigned long
*pointArray ( );
IDMImage
&setPointer ( IPointerHandle &pointerImage ),
&setBitmap ( IBitmapHandle &bitmapImage ),
&setPointerOffset ( ISize &pointerOffset ),
&setStretchSize ( ISize &stretchSize ),
&setStyle ( IDMImage::Style style ),
&setNumberOfPoints ( unsigned long points ),
&setPointArray ( unsigned long arrayOfPoints[]);
protected:
private: /*------------------------ PRIVATE ----------------------------------*/
friend class IDMSourceOperation;
IPointerHandle
pointerImage;
IBitmapHandle
bitmapImage;
unsigned long
*pointArr;
ISize
ptrOffset;
ISize
imageStretchSize;
IDMImage::Style
imgStyle;
unsigned long
points;
void
asPMDragImage (_DRAGIMAGE *pDragImage, Boolean useSystemIcons = false,
Boolean fadeIcon = false);
};
/*----------------------------------------------------------------------------*/
/* Resume compiler default packing. */
/*----------------------------------------------------------------------------*/
#pragma pack()
#ifndef I_NO_INLINES
#include <idmimage.inl>
#endif
#endif //_IDMIMAGE_