The IDMImage class provides the image that represents a drag item during a direct manipulation. The image can be an icon, bitmap, or polygon. The image is displayed while the direct manipulation is in progress.
Create an object of this class and attach it to the drag item that the image represents. Use the member function IDMItem::setImage to attach the drag image object to the drag item. If you do not attach a drag image object to the drag item, an image is created using a default system icon and is attached to the drag item.
Objects of this class have the following attributes in addition to those inherited from its base class:
The drag image styles are defined in
IDM::DragImageStyle.
The Open Class Library default is IDM::systemImages. Call the member function
IDMSourceOperation::setImageStyle
to specify one of the other drag image styles from your implementation of the
static member function
IDMItem::generateSourceItems.
Note:
Polygons are not supported.
You can construct, copy, assign, and destruct objects of this class.
![]() |
public:
virtual ~IDMImage()
Deletes the array of points if it exists.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IDMImage(const IDMImage& image)
Construct objects of this class with this version of the constructor, a copy constructor, if you want to make a copy of a drag image object.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IDMImage( unsigned long arrayOfPoints [ ], const unsigned long numberOfPoints, const ISize& pointerOffset = ISize ( 0 , 0 ), const Style& style = defaultStyle ( ) )
Construct objects of this class with this version of the constructor if you want to draw a polygon as the drag image.
Windows | OS/2 | AIX |
Ignored | Yes | Ignored |
public:
IDMImage( const IPointerHandle& icon, const ISize& pointerOffset = ISize ( 0 , 0 ), const ISize& stretchSize = ISize ( 0 , 0 ), const Style& style = defaultStyle ( ) )
Construct objects of this class with this version of the constructor if you want to use an icon as the drag image and if the icon is already loaded from a resource.
Adds IDMImage::ptr to the image's style.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IDMImage( const IResourceId& resourceId, bool iconResource = true, const ISize& pointerOffset = ISize ( 0 , 0 ), const ISize& stretchSize = ISize ( 0 , 0 ), const Style& style = defaultStyle ( ) )
Construct objects of this class with this version of the constructor if you want to use a bitmap or an icon as the drag image and if the bitmap or icon is not already loaded from a resource.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IDMImage( const IBitmapHandle& bitmap, const ISize& pointerOffset = ISize ( 0 , 0 ), const ISize& stretchSize = ISize ( 0 , 0 ), const Style& style = defaultStyle ( ) )
Construct objects of this class with this version of the constructor if you want to use a bitmap as the drag image and if the bitmap is already loaded from a resource.
Adds IDMImage::bmp to the image's style.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IDMImage()
Construct generic objects of this class with this, the default constructor.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IDMImage& operator =(const IDMImage& image)
Assigns a drag image object to another drag image object.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to set and query attributes of this class. These attributes include the following:
![]() |
public:
IBitmapHandle bitmap() const
Returns the handle of the bitmap image. If the image is not a bitmap, 0 is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
unsigned long numberOfPoints()
Returns the number of points in the polygon's array of points.
Windows | OS/2 | AIX |
Ignored | Yes | Ignored |
![]() |
public:
unsigned long* pointArray()
Returns a pointer to the array of points if the image style is set to IDMImage::polygon. Otherwise, 0 is returned.
Windows | OS/2 | AIX |
Ignored | Yes | Ignored |
![]() |
public:
IPointerHandle pointer() const
Returns the handle of the icon image. If the image is not an icon, 0 is returned.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
ISize pointerOffset() const
Returns the offset from the pointing device's hot spot to the origin of the drag image.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IDMImage& setBitmap(const IBitmapHandle& bitmapImage)
Sets a bitmap as the drag image and adds IDMImage::bmp to the image's style.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IDMImage& setNumberOfPoints(unsigned long points)
Sets the number of points in the polygon's array of points.
Windows | OS/2 | AIX |
Ignored | Yes | Ignored |
![]() |
public:
IDMImage& setPointArray( unsigned long arrayOfPoints [ ], unsigned long numberOfPoints )
Sets the array of points for drawing the polygon image and adds IDMImage::polygon to the image's style. If numberOfPoints is a value greater than 0, the current array of points is deleted and the new array of points is set. If numberOfPoints is 0, the current array of points is deleted and no other processing occurs.
Windows | OS/2 | AIX |
Ignored | Yes | Ignored |
![]() |
public:
IDMImage& setPointer(const IPointerHandle& pointerImage)
Sets an icon as the drag image and adds IDMImage::ptr to the image's style.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IDMImage& setPointerOffset(const ISize& pointerOffset)
Sets the offset from the pointing device's hot spot to the origin of the drag image.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IDMImage& setStretchSize(const ISize& stretchSize)
Sets the stretching dimensions of the drag image if the image
is a bitmap or icon, and adds
IDMImage::stretch
to the image's style. If the dimensions are negative, the
image is reduced, and if the dimensions are positive, the image is
enlarged.
Note:
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IDMImage& setStyle(const Style& style)
Sets the styles that describe the drag image. The styles are specified in the group IDMImage::Styles.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
ISize stretchSize() const
Returns the stretching dimensions of the drag image. The bitmap or icon is drawn with this size during a direct manipulation.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
Style style()
Returns the styles that describe the drag image. The styles are specified in the group IDMImage::Styles.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to set and query the styles for this class.
![]() |
public:
static Style defaultStyle()
Returns the current default style. This is the same as IDMImage::classDefaultStyle unless IDMImage::setDefaultStyle has been called.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static void setDefaultStyle(const Style& style)
Sets the default style for all subsequent drag images.
This member function is not thread safe. In a multithreaded application, it should only be called when a conflict is not possible. A conflict can arise if you set the default style on one thread at the same time that it is being queried on another. In this situation, the query would take place while the style is in an unknown state.
When you create a window class and do not specifically specify window styles in the constructor, the Open Class Library queries the default style. Therefore, the only safe place to call this member function is when no other application threads that create windows are active.
Another way to avoid a conflict in a multithreaded application is to specifically specify window styles on window construction, rather than calling this member function.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style bmp
The drag image is a bitmap.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style classDefaultStyle
Identifies the original default style for this class, which is IDMImage::noStyle.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style closed
If the drag image is a polygon, a closed polygon is formed by moving the current position to the last point in the array of points before drawing the image.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style noStyle
No styles describe this class. This is the default style setting.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style polygon
The drag image is a pointer to an array of points that is connected to form a polygon. Make the first point of the array (0,0), and place the other points relative to this position.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style ptr
The drag image is an icon.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style stretch
If the drag image is a bitmap or an icon, the image is stretched to the specified dimensions.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
static const Style transparent
If the drag image is an icon, an outline of the image is generated and displayed instead of the original image.
Windows | OS/2 | AIX |
Yes | Yes | Yes |