IDMImage

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: If you do not specify one of the other drag image styles, such as IDM::allStacked, the image that you construct and attach to the drag item is ignored.

AIX Considerations

When you are using the Motif dynamic drag protocol (i.e. XmDRAG_DYNAMIC or XmDRAG_PREFER_DYNAMIC), you will not be able to construct IDMImage objects with color bitmaps or icons. Motif allows only monochrome X cursors in this case. You will always get the system default drag icons when you are running with the dynamic drag protocol.

Windows Considerations

Polygons are not supported.


IDMImage - Member Functions and Data by Group

Constructors & Destructor

You can construct, copy, assign, and destruct objects of this class.


[view class]
~IDMImage
public:
virtual ~IDMImage()

Deletes the array of points if it exists.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IDMImage


Overload 1
public:
IDMImage(const IDMImage& image)

image
A reference to a drag image object.

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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
IDMImage( unsigned long arrayOfPoints [ ], const unsigned long numberOfPoints, const ISize& pointerOffset = ISize ( 0 , 0 ), const Style& style = defaultStyle ( ) )

arrayOfPoints
A pointer to the array of points for the polygon image.
numberOfPoints
A value that identifies the number of points in the array of points.
pointerOffset
A reference to the pointer offset. Use the pointer offset to set the offset from the pointing device's hot spot to the origin of the drag image. The default sets the origin equal to the pointing device's hot spot.
style
A reference to the style object for the drag image. The default style is returned by the static member function IDMImage::defaultStyle.

Construct objects of this class with this version of the constructor if you want to draw a polygon as the drag image.

Supported Platforms

Windows OS/2 AIX
Ignored Yes Ignored


Overload 3
public:
IDMImage( const IPointerHandle& icon, const ISize& pointerOffset = ISize ( 0 , 0 ), const ISize& stretchSize = ISize ( 0 , 0 ), const Style& style = defaultStyle ( ) )

icon
A reference to the pointer handle that identifies the icon to use as the drag image.
pointerOffset
A reference to the pointer offset. Use the pointer offset to set the offset from the pointing device's hot spot to the origin of the drag image. The default sets the origin equal to the pointing device's hot spot.
stretchSize
A reference to the stretch size. Use the stretch size to set the stretching dimensions of the drag image. If this parameter is specified, IDMImage::stretch is added to the image's style. If the dimensions are negative, the image is reduced, and if the dimensions are positive, the image is enlarged. The default sets no stretching dimensions.
style
A reference to the style object for the drag image. The default style is returned by the static member function IDMImage::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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 4
public:
IDMImage( const IResourceId& resourceId, bool iconResource = true, const ISize& pointerOffset = ISize ( 0 , 0 ), const ISize& stretchSize = ISize ( 0 , 0 ), const Style& style = defaultStyle ( ) )

resourceId
A reference to a resource identifier object that wraps the resource ID for the bitmap or icon to load from a resource.
iconResource
A boolean value that identifies the resource as an icon or a bitmap. If this value identifies the resource as an icon, IDMImage::ptr is added to the image's style. Otherwise, the resource is a bitmap and IDMImage::bmp is added to the image's style. The default identifies the resource as an icon.
pointerOffset
A reference to the pointer offset. Use the pointer offset to set the offset from the pointing device's hot spot to the origin of the drag image. The default sets the origin equal to the pointing device's hot spot.
stretchSize
A reference to the stretch size. Use the stretch size to set the stretching dimensions of the drag image. If this parameter is specified, IDMImage::stretch is added to the image's style. If the dimensions are negative, the image is reduced, and if the dimensions are positive, the image is enlarged. The default sets no stretching dimensions.
style
A reference to the style object for the drag image. The default style is returned by the static member function IDMImage::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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 5
public:
IDMImage( const IBitmapHandle& bitmap, const ISize& pointerOffset = ISize ( 0 , 0 ), const ISize& stretchSize = ISize ( 0 , 0 ), const Style& style = defaultStyle ( ) )

bitmap
A reference to the bitmap handle that identifies the bitmap to use as the drag image.
pointerOffset
A reference to the pointer offset. Use the pointer offset to set the offset from the pointing device's hot spot to the origin of the drag image. The default sets the origin equal to the pointing device's hot spot.
stretchSize
A reference to the stretch size. Use the stretch size to set the stretching dimensions of the drag image. If this parameter is specified, IDMImage::stretch is added to the image's style. If the dimensions are negative, the image is reduced, and if the dimensions are positive, the image is enlarged. The default sets no stretching dimensions.
style
A reference to the style object for the drag image. The default style is returned by the static member function IDMImage::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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 6
public:
IDMImage()

Construct generic objects of this class with this, the default constructor.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator =
public:
IDMImage& operator =(const IDMImage& image)

Assigns a drag image object to another drag image object.

image
A reference to a drag image object.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Image Processing

Use these members to set and query attributes of this class. These attributes include the following:


[view class]
bitmap
public:
IBitmapHandle bitmap() const

Returns the handle of the bitmap image. If the image is not a bitmap, 0 is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
numberOfPoints
public:
unsigned long numberOfPoints()

Returns the number of points in the polygon's array of points.

Supported Platforms

Windows OS/2 AIX
Ignored Yes Ignored


[view class]
pointArray
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.

Supported Platforms

Windows OS/2 AIX
Ignored Yes Ignored


[view class]
pointer
public:
IPointerHandle pointer() const

Returns the handle of the icon image. If the image is not an icon, 0 is returned.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
pointerOffset
public:
ISize pointerOffset() const

Returns the offset from the pointing device's hot spot to the origin of the drag image.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setBitmap
public:
IDMImage& setBitmap(const IBitmapHandle& bitmapImage)

Sets a bitmap as the drag image and adds IDMImage::bmp to the image's style.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setNumberOfPoints
public:
IDMImage& setNumberOfPoints(unsigned long points)

Sets the number of points in the polygon's array of points.

Supported Platforms

Windows OS/2 AIX
Ignored Yes Ignored


[view class]
setPointArray
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.

Supported Platforms

Windows OS/2 AIX
Ignored Yes Ignored


[view class]
setPointer
public:
IDMImage& setPointer(const IPointerHandle& pointerImage)

Sets an icon as the drag image and adds IDMImage::ptr to the image's style.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setPointerOffset
public:
IDMImage& setPointerOffset(const ISize& pointerOffset)

Sets the offset from the pointing device's hot spot to the origin of the drag image.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setStretchSize
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: This member function is often required because many bitmaps are too large to use as a drag image. You can use this member function to reduce the size of the bitmap.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setStyle
public:
IDMImage& setStyle(const Style& style)

Sets the styles that describe the drag image. The styles are specified in the group IDMImage::Styles.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
stretchSize
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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
style
public:
Style style()

Returns the styles that describe the drag image. The styles are specified in the group IDMImage::Styles.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Styles

Use these members to set and query the styles for this class.


[view class]
defaultStyle
public:
static Style defaultStyle()

Returns the current default style. This is the same as IDMImage::classDefaultStyle unless IDMImage::setDefaultStyle has been called.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setDefaultStyle
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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
bmp
public:
static const Style bmp

The drag image is a bitmap.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
classDefaultStyle
public:
static const Style classDefaultStyle

Identifies the original default style for this class, which is IDMImage::noStyle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
closed
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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
noStyle
public:
static const Style noStyle

No styles describe this class. This is the default style setting.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
polygon
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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
ptr
public:
static const Style ptr

The drag image is an icon.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
stretch
public:
static const Style stretch

If the drag image is a bitmap or an icon, the image is stretched to the specified dimensions.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
transparent
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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IDMImage - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data