comparison dwtx/jface/util/TransferDropTargetListener.d @ 30:913f0fd3b347

util dnd
author Frank Benoit <benoit@tionex.de>
date Thu, 03 Apr 2008 19:20:11 +0200
parents
children
comparison
equal deleted inserted replaced
29:f12d40e7da8f 30:913f0fd3b347
1 /*******************************************************************************
2 * Copyright (c) 2000, 2005 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module dwtx.jface.util.TransferDropTargetListener;
14
15 import dwt.dnd.DropTargetEvent;
16 import dwt.dnd.DropTargetListener;
17 import dwt.dnd.Transfer;
18
19 import dwt.dwthelper.utils;
20
21 /**
22 * A <code>TransferDropTargetListener</code> is a <code>DropTragetListener</code>
23 * that handles one type of DWT {@link Transfer}.
24 * The purpose of a <code>TransferDropTargetListener</code> is to:
25 * <ul>
26 * <li>Determine enablement for a drop operation. A <code>TransferDropTargetListener</code>
27 * will not be used if <code>isEnabled</code> returns false.
28 * <li>When enabled, optionally show feedback on the <code>DropTarget</code>.
29 * <li>Perform the actual drop
30 * </ul>
31 * A <code>DelegatingDropAdapter</code> allows these functions to be implemented
32 * separately for unrelated types of drags. <code>DelegatingDropAdapter</code> then
33 * combines the function of each <code>TransferDropTargetListener</code>, while
34 * allowing them to be implemented as if they were the only <code>DragSourceListener</code>.
35 * @since 3.0
36 */
37 public interface TransferDropTargetListener : DropTargetListener {
38 /**
39 * Returns the <code>Transfer</code> type that this listener can
40 * accept a drop operation for.
41 *
42 * @return the <code>Transfer</code> for this listener
43 */
44 Transfer getTransfer();
45
46 /**
47 * Returns <code>true</code> if this listener can handle the drop
48 * based on the given <code>DropTargetEvent</code>.
49 * <p>
50 * This method is called by the <code>DelegatingDropAdapter</code> only
51 * if the <code>DropTargetEvent</code> contains a transfer data type
52 * supported by this listener. The <code>Transfer</code> returned by the
53 * <code>#getTransfer()</code> method is used for this purpose.
54 * </p>
55 *
56 * @param event the drop target event
57 * @return <code>true</code> if the listener is enabled for the given
58 * drop target event.
59 */
60 bool isEnabled(DropTargetEvent event);
61 }