wxGenericDragImage is used. Applications may also prefer to use
wxGenericDragImage on Windows, too.
+\pythonnote{wxPython uses wxGenericDragImage on all platforms, but
+uses the wxDragImage name.}
+
To use this class, when you wish to start dragging an image, create a wxDragImage
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,
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 wxGenericDragImage and
+override \helpref{wxDragImage::DoDrawImage}{wxdragimagedodrawimage} and
+\helpref{wxDragImage::GetImageRect}{wxdragimagegetimagerect}.
+
Please see {\tt samples/dragimag} for an example.
+%\wxheading{Notes}
+%
+%Using the native Windows implementation, you must supply an image with a mask, or
+%the image will not show when dragged. It is not clear if this is a bug
+%in Windows or in the wxDragImage implementation. You can add a mask
+%with a call to wxImage::SetMaskColour, passing RGB values not likely
+%to be in the image. [CURED by creating the ImageList with ILC_MASK]
+
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
Default constructor.
\func{}{wxDragImage}{\param{const wxBitmap\& }{image}, \param{const wxCursor\& }{cursor = wxNullCursor},
- \param{const wxPoint& }{hotspot = wxPoint(0, 0)}}
+ \param{const wxPoint\& }{cursorHotspot = wxPoint(0, 0)}}
Constructs a drag image from a bitmap and optional cursor.
\func{}{wxDragImage}{\param{const wxIcon\& }{image}, \param{const wxCursor\& }{cursor = wxNullCursor},
- \param{const wxPoint& }{hotspot = wxPoint(0, 0)}}
+ \param{const wxPoint\& }{cursorHotspot = wxPoint(0, 0)}}
Constructs a drag image from an icon and optional cursor.
+\pythonnote{This constructor is called wxDragIcon in wxPython.}
+
\func{}{wxDragImage}{\param{const wxString\& }{text}, \param{const wxCursor\& }{cursor = wxNullCursor},
- \param{const wxPoint& }{hotspot = wxPoint(0, 0)}}
+ \param{const wxPoint\& }{cursorHotspot = wxPoint(0, 0)}}
Constructs a drag image from a text string and optional cursor.
+\pythonnote{This constructor is called wxDragString in wxPython.}
+
\func{}{wxDragImage}{\param{const wxTreeCtrl\& }{treeCtrl}, \param{wxTreeItemId\& }{id}}
Constructs a drag image from the text in the given tree control item, and optional cursor.
+\pythonnote{This constructor is called wxDragTreeItem in wxPython.}
+
\func{}{wxDragImage}{\param{const wxListCtrl\& }{treeCtrl}, \param{long }{id}}
Constructs a drag image from the text in the given tree control item, and optional cursor.
+\pythonnote{This constructor is called wxDragListItem in wxPython.}
+
+\func{}{wxDragImage}{\param{const wxCursor\& }{cursor = wxNullCursor},
+ \param{const wxPoint\& }{cursorHotspot = wxPoint(0, 0)}}
+
+Constructs a drag image an optional cursor. This constructor is only available for
+wxGenericDragImage, and can be used when the application
+supplies \helpref{wxDragImage::DoDrawImage}{wxdragimagedodrawimage} and \helpref{wxDragImage::GetImageRect}{wxdragimagegetimagerect}.
+
\wxheading{Parameters}
\docparam{image}{Icon or bitmap to be used as the drag image. The bitmap can
\docparam{cursor}{Optional cursor to combine with the image.}
-\docparam{hotspot}{Position of the hotspot within the new image.}
+\docparam{hotspot}{This parameter is deprecated.}
\docparam{treeCtrl}{Tree control for constructing a tree drag image.}
\membersection{wxDragImage::BeginDrag}\label{wxdragimagebegindrag}
-\func{bool}{BeginDrag}{\param{const wxPoint\& }{hotspot}, \param{wxWindow* }{window}, \param{bool}{ fullScreen = FALSE}, \param{wxRect*}{ rect = NULL}}
+\func{bool}{BeginDrag}{\param{const wxPoint\& }{hotspot}, \param{wxWindow* }{window}, \param{bool}{ fullScreen = false}, \param{wxRect*}{ rect = NULL}}
Start dragging the image, in a window or full screen.
of the image.}
\docparam{window}{The window that captures the mouse, and within which the dragging
-is limited unless {\it fullScreen} is TRUE.}
+is limited unless {\it fullScreen} is true.}
\docparam{boundingWindow}{In the second form of the function, specifies the
area within which the drag occurs.}
-\docparam{fullScreen}{If TRUE, specifies that the drag will be visible over the full
+\docparam{fullScreen}{If true, specifies that the drag will be visible over the full
screen, or over as much of the screen as is specified by {\it rect}. Note that the mouse will
still be captured in {\it window}.}
by cutting down on the area under consideration, and it can also make a visual difference
since the drag is clipped to this area.}
-{\bf Please note:} full screen dragging only works on Windows at present,
-because on Motif and GTK, the wxScreenDC used to implement full screen dragging only looks at the X root window and not
-the windows on top, when copying from the screen to the backing bitmap.
-Suggestions for solving this one are welcome!
+\membersection{wxDragImage::DoDrawImage}\label{wxdragimagedodrawimage}
+
+\func{virtual bool}{DoDrawImage}{\param{wxDC\&}{ dc}, \param{const wxPoint\&}{ pos}}
+
+Draws the image on the device context with top-left corner at the given position.
+
+This function is only available with wxGenericDragImage, to allow applications to
+draw their own image instead of using an actual bitmap. If you override this function,
+you must also override \helpref{wxDragImage::GetImageRect}{wxdragimagegetimagerect}.
\membersection{wxDragImage::EndDrag}\label{wxdragimageenddrag}
Note that this call automatically calls ReleaseMouse.
+\membersection{wxDragImage::GetImageRect}\label{wxdragimagegetimagerect}
+
+\constfunc{virtual wxRect}{GetImageRect}{\param{const wxPoint\&}{ pos}}
+
+Returns the rectangle enclosing the image, assuming that the image is drawn with its
+top-left corner at the given point.
+
+This function is available in wxGenericDragImage only, and may be overridden (together with
+\helpref{wxDragImage::DoDrawImage}{wxdragimagedodrawimage}) to provide a virtual drawing capability.
+
\membersection{wxDragImage::Hide}\label{wxdragimagehide}
\func{bool}{Hide}{\void}
\helpref{wxDragImage::Show}{wxdragimageshow} has been called previously (for example
at the start of the drag).
-{\it pt} is the position in window coordinates (or screen coordinates if no
-window was specified to BeginDrag.
+{\it pt} is the position in client coordinates (relative to the window specified in BeginDrag).
You can move the image either when the image is hidden or shown, but in general dragging
will be smoother if you move the image when it is shown.
Shows the image. Call this at least once when dragging.
+\membersection{wxDragImage::UpdateBackingFromWindow}\label{wxdragimageupdatebackingfromwindow}
+
+\constfunc{bool}{UpdateBackingFromWindow}{\param{wxDC\&}{ windowDC}, \param{wxMemoryDC\&}{ destDC},
+ \param{const wxRect\&}{ sourceRect}, \param{const wxRect\&}{ destRect}}
+
+Override this if you wish to draw the window contents to the backing bitmap
+yourself. This can be desirable if you wish to avoid flicker by not having to
+redraw the updated window itself just before dragging, which can cause a flicker just
+as the drag starts. Instead, paint the drag image's backing bitmap to show the appropriate
+graphic {\it minus the objects to be dragged}, and leave the window itself to be updated
+by the drag image. This can provide eerily smooth, flicker-free drag behaviour.
+
+The default implementation copies the window contents to the backing bitmap. A new
+implementation will normally copy information from another source, such as from its
+own backing bitmap if it has one, or directly from internal data structures.
+
+This function is available in wxGenericDragImage only.
+