Creates a new <code>DropTarget</code> to allow data to be dropped on the specified <code>Control</code>. Creating an instance of a DropTarget may cause system resources to be allocated depending on the platform. It is therefore mandatory that the DropTarget instance be disposed when no longer required.
Adds the listener to the collection of listeners who will be notified when a drag and drop operation is in progress, by sending it one of the messages defined in the <code>DropTargetListener</code> interface.
Returns the Control which is registered for this DropTarget. This is the control over which the user positions the cursor to drop the data.
Returns an array of listeners who will be notified when a drag and drop operation is in progress, by sending it one of the messages defined in the <code>DropTargetListener</code> interface.
Returns the drop effect for this DropTarget. This drop effect will be used during a drag and drop to display the drag under effect on the target widget.
Returns a list of the data types that can be transferred to this DropTarget.
Removes the listener from the collection of listeners who will be notified when a drag and drop operation is in progress.
Specifies the drop effect for this DropTarget. This drop effect will be used during a drag and drop to display the drag under effect on the target widget.
Specifies the data types that can be transferred to this DropTarget. If data is being dragged that does not match one of these types, the drop target will be notified of the drag and drop operation but the currentDataType will be null and the operation will be DND.NONE.
the handle to the OS resource (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code. </p>
Adds the listener to the collection of listeners who will be notified when an event of the given type occurs. When the event does occur in the widget, the listener is notified by sending it the <code>handleEvent()</code> message. The event type is one of the event constants defined in class <code>SWT</code>.
Adds the listener to the collection of listeners who will be notified when the widget is disposed. When the widget is disposed, the listener is notified by sending it the <code>widgetDisposed()</code> message.
Throws an exception if the specified widget can not be used as a parent for the receiver.
Checks that this class can be subclassed. <p> The SWT class library is intended to be subclassed only at specific, controlled points (most notably, <code>Composite</code> and <code>Canvas</code> when implementing new widgets). This method enforces this rule unless it is overridden. </p><p> <em>IMPORTANT:</em> By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion. </p><p> The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy. </p>
Throws an <code>SWTException</code> if the receiver can not be accessed by the caller. This may include both checks on the state of the receiver and more generally on the entire execution context. This method <em>should</em> be called by widget implementors to enforce the standard SWT invariants. <p> Currently, it is an error to invoke any method (other than <code>isDisposed()</code>) on a widget that has had its <code>dispose()</code> method called. It is also an error to call widget methods from any thread that is different from the thread that created the widget. </p><p> In future releases of SWT, there may be more or fewer error checks and exceptions may be thrown for different reasons. </p>
Disposes of the operating system resources associated with the receiver and all its descendants. After this method has been invoked, the receiver and all descendants will answer <code>true</code> when sent the message <code>isDisposed()</code>. Any internal connections between the widgets in the tree will have been removed to facilitate garbage collection. <p> NOTE: This method is not called recursively on the descendants of the receiver. This means that, widget implementers can not detect when a widget is being disposed of by re-implementing this method, but should instead listen for the <code>Dispose</code> event. </p>
Returns the application defined widget data associated with the receiver, or null if it has not been set. The <em>widget data</em> is a single, unnamed field that is stored with every widget. <p> Applications may put arbitrary objects in this field. If the object stored in the widget data needs to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so. </p>
Returns the application defined property of the receiver with the specified name, or null if it has not been set. <p> Applications may have associated arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so. </p>
Returns the <code>Display</code> that is associated with the receiver. <p> A widget's display is either provided when it is created (for example, top level <code>Shell</code>s) or is the same as its parent's display. </p>
Returns an array of listeners who will be notified when an event of the given type occurs. The event type is one of the event constants defined in class <code>SWT</code>.
Returns the receiver's style information. <p> Note that the value which is returned by this method <em>may not match</em> the value which was provided to the constructor when the receiver was created. This can occur when the underlying operating system does not support a particular combination of requested styles. For example, if the platform widget used to implement a particular SWT widget always has scroll bars, the result of calling this method would always have the <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set. </p>
Returns <code>true</code> if the widget has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the widget. When a widget has been disposed, it is an error to invoke any other method using the widget. </p>
Returns <code>true</code> if there are any listeners for the specified event type associated with the receiver, and <code>false</code> otherwise. The event type is one of the event constants defined in class <code>SWT</code>.
Notifies all of the receiver's listeners for events of the given type that one such event has occurred by invoking their <code>handleEvent()</code> method. The event type is one of the event constants defined in class <code>SWT</code>.
Removes the listener from the collection of listeners who will be notified when an event of the given type occurs. The event type is one of the event constants defined in class <code>SWT</code>.
Removes the listener from the collection of listeners who will be notified when an event of the given type occurs. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It should never be referenced from application code. </p>
Removes the listener from the collection of listeners who will be notified when the widget is disposed.
Sets the application defined widget data associated with the receiver to be the argument. The <em>widget data</em> is a single, unnamed field that is stored with every widget. <p> Applications may put arbitrary objects in this field. If the object stored in the widget data needs to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so. </p>
Sets the application defined property of the receiver with the specified name to the given value. <p> Applications may associate arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so. </p>
Returns a string containing a concise, human-readable description of the receiver.
Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
IMPORTANT: This class is <em>not</em> intended to be subclassed.
<p>This class identifies the <code>Control</code> over which the user must position the cursor in order to drop the data being transferred. It also specifies what data types can be dropped on this control and what operations can be performed. You may have several DropTragets in an application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>. The DropTarget can receive data from within the same application or from other applications (such as text dragged from a text editor like Word).</p>
<code><pre> int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK; Transfer[] types = new Transfer[] {TextTransfer.getInstance()}; DropTarget target = new DropTarget(label, operations); target.setTransfer(types); </code></pre>
<p>The application is notified of data being dragged over this control and of when a drop occurs by implementing the interface <code>DropTargetListener</code> which uses the class <code>DropTargetEvent</code>. The application can modify the type of drag being performed on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of the application to copy this data for its own purposes.
<code><pre> target.addDropListener (new DropTargetListener() { public void dragEnter(DropTargetEvent event) {}; public void dragOver(DropTargetEvent event) {}; public void dragLeave(DropTargetEvent event) {}; public void dragOperationChanged(DropTargetEvent event) {}; public void dropAccept(DropTargetEvent event) {} public void drop(DropTargetEvent event) { // A drop has occurred, copy over the data if (event.data is null) { // no data to copy, indicate failure in event.detail event.detail = DND.DROP_NONE; return; } label.setText ((String) event.data); // data copied to label text } }); </pre></code>
<dl> <dt><b>Styles</b></dt> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK</dd> <dt><b>Events</b></dt> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged, DND.DropAccept, DND.Drop </dd> </dl>
@see <a href="http://www.eclipse.org/swt/snippets/#dnd">Drag and Drop snippets</a> @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: DNDExample</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>