You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/doc/html/ntqdragobject.html

221 lines
12 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qdragobject.cpp:571 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQDragObject Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
<a href="index.html">
<font color="#004faf">Home</font></a>
| <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
| <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQDragObject Class Reference</h1>
<p>The TQDragObject class encapsulates MIME-based data
transfer.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qdragobject-h.html">ntqdragobject.h</a>&gt;</tt>
<p>Inherits <a href="ntqobject.html">TQObject</a> and <a href="qmimesource.html">TQMimeSource</a>.
<p>Inherited by <a href="qstoreddrag.html">TQStoredDrag</a>, <a href="qtextdrag.html">TQTextDrag</a>, <a href="qimagedrag.html">TQImageDrag</a>, and <a href="qicondrag.html">TQIconDrag</a>.
<p><a href="qdragobject-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQDragObject"><b>TQDragObject</b></a> ( TQWidget&nbsp;*&nbsp;dragSource = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn>virtual <a href="#~TQDragObject"><b>~TQDragObject</b></a> ()</li>
<li class=fn>bool <a href="#drag"><b>drag</b></a> ()</li>
<li class=fn>bool <a href="#dragMove"><b>dragMove</b></a> ()</li>
<li class=fn>void <a href="#dragCopy"><b>dragCopy</b></a> ()</li>
<li class=fn>void <a href="#dragLink"><b>dragLink</b></a> ()</li>
<li class=fn>virtual void <a href="#setPixmap-2"><b>setPixmap</b></a> ( TQPixmap&nbsp;pm )</li>
<li class=fn>virtual void <a href="#setPixmap"><b>setPixmap</b></a> ( TQPixmap&nbsp;pm, const&nbsp;TQPoint&nbsp;&amp;&nbsp;hotspot )</li>
<li class=fn>TQPixmap <a href="#pixmap"><b>pixmap</b></a> () const</li>
<li class=fn>TQPoint <a href="#pixmapHotSpot"><b>pixmapHotSpot</b></a> () const</li>
<li class=fn>TQWidget * <a href="#source"><b>source</b></a> ()</li>
<li class=fn>enum <a href="#DragMode-enum"><b>DragMode</b></a> { DragDefault, DragCopy, DragMove, DragLink, DragCopyOrMove }</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>TQWidget * <a href="#target"><b>target</b></a> ()</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual bool <a href="#drag-2"><b>drag</b></a> ( DragMode&nbsp;mode )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
<p> The TQDragObject class encapsulates MIME-based data
transfer.
<p>
<p> TQDragObject is the base class for all data that needs to be
transferred between and within applications, both for drag and
drop and for the <a href="ntqclipboard.html">clipboard</a>.
<p> See the <a href="dnd.html">Drag-and-drop documentation</a> for an
overview of how to provide drag and drop in your application.
<p> See the <a href="ntqclipboard.html">TQClipboard</a> documentation for an overview of how to provide
cut-and-paste in your application.
<p> The <a href="#drag">drag</a>() function is used to start a drag operation. You can
specify the <a href="#DragMode-enum">DragMode</a> in the call or use one of the convenience
functions <a href="#dragCopy">dragCopy</a>(), <a href="#dragMove">dragMove</a>() or <a href="#dragLink">dragLink</a>(). The drag source
where the data originated is retrieved with <a href="#source">source</a>(). If the data
was dropped on a widget within the application, <a href="#target">target</a>() will
return a pointer to that widget. Specify the pixmap to display
during the drag with <a href="#setPixmap">setPixmap</a>().
<p>See also <a href="draganddrop.html">Drag And Drop Classes</a>.
<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="DragMode-enum"></a>TQDragObject::DragMode</h3>
<p> This enum describes the possible drag modes.
<ul>
<li><tt>TQDragObject::DragDefault</tt> - The mode is determined heuristically.
<li><tt>TQDragObject::DragCopy</tt> - The data is copied, never moved.
<li><tt>TQDragObject::DragMove</tt> - The data is moved, if dragged at all.
<li><tt>TQDragObject::DragLink</tt> - The data is linked, if dragged at all.
<li><tt>TQDragObject::DragCopyOrMove</tt> - The user chooses the mode by using a
control key to switch from the default.
</ul>
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQDragObject"></a>TQDragObject::TQDragObject ( <a href="ntqwidget.html">TQWidget</a>&nbsp;*&nbsp;dragSource = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a drag object called <em>name</em>, which is a child of <em>dragSource</em>.
<p> Note that the drag object will be deleted when <em>dragSource</em> is
deleted.
<h3 class=fn><a name="~TQDragObject"></a>TQDragObject::~TQDragObject ()<tt> [virtual]</tt>
</h3>
Destroys the drag object, canceling any drag and drop operation in
which it is involved, and frees up the storage used.
<h3 class=fn>bool <a name="drag"></a>TQDragObject::drag ()
</h3>
Starts a drag operation using the contents of this object, using
DragDefault mode.
<p> The function returns TRUE if the caller should delete the original
copy of the dragged data (but see <a href="#target">target</a>()); otherwise returns
FALSE.
<p> If the drag contains <em>references</em> to information (e.g. file names
in a <a href="quridrag.html">TQUriDrag</a> are references) then the return value should always
be ignored, as the target is expected to manipulate the
referred-to content directly. On X11 the return value should
always be correct anyway, but on Windows this is not necessarily
the case (e.g. the file manager starts a background process to
move files, so the source <em>must not</em> delete the files!)
<p> Note that on Windows the drag operation will spin a blocking modal
event loop that will not dispatch any TQTimers.
<p>Example: <a href="dirview-example.html#x1670">dirview/dirview.cpp</a>.
<h3 class=fn>bool <a name="drag-2"></a>TQDragObject::drag ( <a href="ntqdragobject.html#DragMode-enum">DragMode</a>&nbsp;mode )<tt> [virtual protected]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Starts a drag operation using the contents of this object.
<p> At this point, the object becomes owned by TQt, not the
application. You should not delete the drag object or anything it
references. The actual transfer of data to the target application
will be done during future event processing - after that time the
drag object will be deleted.
<p> Returns TRUE if the dragged data was dragged as a <em>move</em>,
indicating that the caller should remove the original source of
the data (the drag object must continue to have a copy); otherwise
returns FALSE.
<p> The <em>mode</em> specifies the drag mode (see
<a href="#DragMode-enum">TQDragObject::DragMode</a>.) Normally one of the simpler <a href="#drag">drag</a>(),
<a href="#dragMove">dragMove</a>(), or <a href="#dragCopy">dragCopy</a>() functions would be used instead.
<h3 class=fn>void <a name="dragCopy"></a>TQDragObject::dragCopy ()
</h3>
Starts a drag operation using the contents of this object, using
<a href="#DragMode-enum">DragCopy</a> mode. Be sure to read the constraints described in
<a href="#drag">drag</a>().
<p> <p>See also <a href="#drag">drag</a>(), <a href="#dragMove">dragMove</a>(), and <a href="#dragLink">dragLink</a>().
<p>Example: <a href="simple_dd-example.html#x2818">iconview/simple_dd/main.cpp</a>.
<h3 class=fn>void <a name="dragLink"></a>TQDragObject::dragLink ()
</h3>
Starts a drag operation using the contents of this object, using
<a href="#DragMode-enum">DragLink</a> mode. Be sure to read the constraints described in
<a href="#drag">drag</a>().
<p> <p>See also <a href="#drag">drag</a>(), <a href="#dragCopy">dragCopy</a>(), and <a href="#dragMove">dragMove</a>().
<h3 class=fn>bool <a name="dragMove"></a>TQDragObject::dragMove ()
</h3>
Starts a drag operation using the contents of this object, using
<a href="#DragMode-enum">DragMove</a> mode. Be sure to read the constraints described in
<a href="#drag">drag</a>().
<p> <p>See also <a href="#drag">drag</a>(), <a href="#dragCopy">dragCopy</a>(), and <a href="#dragLink">dragLink</a>().
<h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> <a name="pixmap"></a>TQDragObject::pixmap () const
</h3>
Returns the currently set pixmap (which <a href="ntqpixmap.html#isNull">isNull()</a> if none is set).
<h3 class=fn><a href="ntqpoint.html">TQPoint</a> <a name="pixmapHotSpot"></a>TQDragObject::pixmapHotSpot () const
</h3>
Returns the currently set pixmap hotspot.
<h3 class=fn>void <a name="setPixmap"></a>TQDragObject::setPixmap ( <a href="ntqpixmap.html">TQPixmap</a>&nbsp;pm, const&nbsp;<a href="ntqpoint.html">TQPoint</a>&nbsp;&amp;&nbsp;hotspot )<tt> [virtual]</tt>
</h3>
Set the pixmap <em>pm</em> to display while dragging the object. The
platform-specific implementation will use this where it can - so
provide a small masked pixmap, and do not assume that the user
will actually see it. For example, cursors on Windows 95 are of
limited size.
<p> The <em>hotspot</em> is the point on (or off) the pixmap that should be
under the cursor as it is dragged. It is relative to the top-left
pixel of the pixmap.
<p> <b>Warning:</b> We have seen problems with drag cursors on different
graphics hardware and driver software on Windows. Setting the
graphics acceleration in the display settings down one tick solved
the problems in all cases.
<p>Example: <a href="fileiconview-example.html#x815">fileiconview/qfileiconview.cpp</a>.
<h3 class=fn>void <a name="setPixmap-2"></a>TQDragObject::setPixmap ( <a href="ntqpixmap.html">TQPixmap</a>&nbsp;pm )<tt> [virtual]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Uses a hotspot that positions the pixmap below and to the right of
the mouse pointer. This allows the user to clearly see the point
on the window which they are dragging the data onto.
<h3 class=fn><a href="ntqwidget.html">TQWidget</a>&nbsp;* <a name="source"></a>TQDragObject::source ()
</h3>
Returns a pointer to the drag source where this object originated.
<h3 class=fn><a href="ntqwidget.html">TQWidget</a>&nbsp;* <a name="target"></a>TQDragObject::target ()<tt> [static]</tt>
</h3>
After the drag completes, this function will return the <a href="ntqwidget.html">TQWidget</a>
which received the drop, or 0 if the data was dropped on another
application.
<p> This can be useful for detecting the case where drag and drop is
to and from the same widget.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>