phoenix_title wx.GenericDragImage

This class is used when you wish to drag an object on the screen, and a simple cursor is not enough.

On Windows, the Win32 API is used to achieve smooth dragging. On other platforms, GenericDragImage is used. Applications may also prefer to use GenericDragImage on Windows, too.

To use this class, when you wish to start dragging an image, create a wx.DragImage object and store it somewhere you can access it as the drag progresses. Call BeginDrag to start, and EndDrag to stop the drag. To move the image, initially call Show and then Move. If you wish to update the screen contents during the drag (for example, highlight an item as in the dragimag sample), first call Hide, update the screen, call Move, and then call Show.

You can drag within one window, or you can use full-screen dragging either across the whole screen, or just restricted to one area of the screen to save resources. If you want the user to drag between two windows, then you will need to use full-screen dragging.

If you wish to draw the image yourself, use GenericDragImage and override DoDrawImage and GetImageRect.

See also

Drag Image Sample


class_hierarchy Class Hierarchy

Inheritance diagram for class GenericDragImage:

method_summary Methods Summary

__init__

Default constructor.

BeginDrag

Start dragging the image, in a window or full screen.

DoDrawImage

Draws the image on the device context with top-left corner at the given position.

EndDrag

Call this when the drag has finished.

GetImageRect

Returns the rectangle enclosing the image, assuming that the image is drawn with its top-left corner at the given point.

Hide

Hides the image.

Move

Call this to move the image to a new position.

Show

Shows the image.

UpdateBackingFromWindow

Override this if you wish to draw the window contents to the backing bitmap yourself.


api Class API

class wx.GenericDragImage(Object)

Possible constructors:

GenericDragImage() -> None

GenericDragImage(image, cursor=NullCursor) -> None

GenericDragImage(image, cursor=NullCursor) -> None

GenericDragImage(text, cursor=NullCursor) -> None

GenericDragImage(treeCtrl, id) -> None

GenericDragImage(listCtrl, id) -> None

This class is used when you wish to drag an object on the screen, and a simple cursor is not enough.


Methods

__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.

Return type:

None



__init__ (self, image, cursor=NullCursor)

Constructs a drag image from a bitmap and optional cursor.

Parameters:
  • image (wx.Bitmap) – Bitmap to be used as the drag image. The bitmap can have a mask.

  • cursor (wx.Cursor) – Optional cursor to combine with the image.

Return type:

None



__init__ (self, image, cursor=NullCursor)

Constructs a drag image from an icon and optional cursor.

Parameters:
  • image (wx.Icon) – Icon to be used as the drag image.

  • cursor (wx.Cursor) – Optional cursor to combine with the image.

Return type:

None