156 lines
5.8 KiB
TeX
156 lines
5.8 KiB
TeX
|
\section{\class{wxDragImage}}\label{wxdragimage}
|
||
|
|
||
|
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 do achieve smooth dragging. On other platforms,
|
||
|
wxGenericDragImage is used. Applications may also prefer to use
|
||
|
wxGenericDragImage on Windows, too.
|
||
|
|
||
|
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,
|
||
|
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.
|
||
|
|
||
|
Please see {\tt samples/dragimag} for an example.
|
||
|
|
||
|
\wxheading{Derived from}
|
||
|
|
||
|
\helpref{wxObject}{wxobject}
|
||
|
|
||
|
\wxheading{Include files}
|
||
|
|
||
|
<wx/dragimag.h>\\
|
||
|
<wx/generic/dragimgg.h>
|
||
|
|
||
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
||
|
|
||
|
\membersection{wxDragImage::wxDragImage}\label{wxdragimageconstr}
|
||
|
|
||
|
\func{}{wxDragImage}{\void}
|
||
|
|
||
|
Default constructor.
|
||
|
|
||
|
\func{}{wxDragImage}{\param{const wxBitmap\& }{image}, \param{const wxCursor\& }{cursor = wxNullCursor},
|
||
|
\param{const wxPoint& }{hotspot = 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)}}
|
||
|
|
||
|
Constructs a drag image from an icon and optional cursor.
|
||
|
|
||
|
\func{}{wxDragImage}{\param{const wxString\& }{text}, \param{const wxCursor\& }{cursor = wxNullCursor},
|
||
|
\param{const wxPoint& }{hotspot = wxPoint(0, 0)}}
|
||
|
|
||
|
Constructs a drag image from a text string and optional cursor.
|
||
|
|
||
|
\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.
|
||
|
|
||
|
\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.
|
||
|
|
||
|
\wxheading{Parameters}
|
||
|
|
||
|
\docparam{image}{Icon or bitmap to be used as the drag image. The bitmap can
|
||
|
have a mask.}
|
||
|
|
||
|
\docparam{text}{Text used to construct a drag image.}
|
||
|
|
||
|
\docparam{cursor}{Optional cursor to combine with the image.}
|
||
|
|
||
|
\docparam{hotspot}{Position of the hotspot within the new image.}
|
||
|
|
||
|
\docparam{treeCtrl}{Tree control for constructing a tree drag image.}
|
||
|
|
||
|
\docparam{listCtrl}{List control for constructing a list drag image.}
|
||
|
|
||
|
\docparam{id}{Tree or list control item id.}
|
||
|
|
||
|
\membersection{wxDragImage::BeginDrag}\label{wxdragimagebegindrag}
|
||
|
|
||
|
\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.
|
||
|
|
||
|
\func{bool}{BeginDrag}{\param{const wxPoint\& }{hotspot}, \param{wxWindow* }{window}, \param{wxWindow*}{ boundingWindow}}
|
||
|
|
||
|
Start dragging the image, using the first window to capture the mouse and the second
|
||
|
to specify the bounding area. This form is equivalent to using the first form,
|
||
|
but more convenient than working out the bounding rectangle explicitly.
|
||
|
|
||
|
You need to then call \helpref{wxDragImage::Show}{wxdragimageshow}
|
||
|
and \helpref{wxDragImage::Move}{wxdragimagemove} to show the image on the screen.
|
||
|
|
||
|
Call \helpref{wxDragImage::EndDrag}{wxdragimageenddrag} when the drag has finished.
|
||
|
|
||
|
Note that this call automatically calls CaptureMouse.
|
||
|
|
||
|
\wxheading{Parameters}
|
||
|
|
||
|
\docparam{hotspot}{The location of the drag position relative to the upper-left corner
|
||
|
of the image.}
|
||
|
|
||
|
\docparam{window}{The window that captures the mouse, and within which the dragging
|
||
|
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
|
||
|
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}.}
|
||
|
|
||
|
\docparam{rect}{If non-NULL, specifies the rectangle (in screen coordinates) that
|
||
|
bounds the dragging operation. Specifying this can make the operation more efficient
|
||
|
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::EndDrag}\label{wxdragimageenddrag}
|
||
|
|
||
|
\func{bool}{EndDrag}{\void}
|
||
|
|
||
|
Call this when the drag has finished.
|
||
|
|
||
|
Note that this call automatically calls ReleaseMouse.
|
||
|
|
||
|
\membersection{wxDragImage::Hide}\label{wxdragimagehide}
|
||
|
|
||
|
\func{bool}{Hide}{\void}
|
||
|
|
||
|
Hides the image. You may wish to call this before updating the window
|
||
|
contents (perhaps highlighting an item). Then call \helpref{wxDragImage::Move}{wxdragimagemove}
|
||
|
and \helpref{wxDragImage::Show}{wxdragimageshow}.
|
||
|
|
||
|
\membersection{wxDragImage::Move}\label{wxdragimagemove}
|
||
|
|
||
|
\func{bool}{Move}{\param{const wxPoint\& }{pt}}
|
||
|
|
||
|
Call this to move the image to a new position. The image will only be shown if
|
||
|
\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.
|
||
|
|
||
|
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.
|
||
|
|
||
|
\membersection{wxDragImage::Show}\label{wxdragimageshow}
|
||
|
|
||
|
\func{bool}{Show}{\void}
|
||
|
|
||
|
Shows the image. Call this at least once when dragging.
|
||
|
|