]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/dnd/IDragSourceParticipant.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / dnd / IDragSourceParticipant.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.g2d.dnd;\r
13 \r
14 import java.awt.datatransfer.Transferable;\r
15 import java.awt.dnd.DnDConstants;\r
16 import java.awt.dnd.DragGestureEvent;\r
17 import java.awt.dnd.DragSourceListener;\r
18 \r
19 import org.simantics.g2d.canvas.ICanvasParticipant;\r
20 import org.simantics.scenegraph.g2d.events.MouseEvent.MouseDragBegin;\r
21 \r
22 /**\r
23  * This is an interface allows objects to be dragged from the canvas.\r
24  * Implementations produce serializable Transferable object in drag out event.\r
25  * \r
26  * This participant requires {@link DragInteractor} installed in the canvas context.   \r
27  * \r
28  * @author Toni Kalajainen\r
29  */\r
30 public interface IDragSourceParticipant extends ICanvasParticipant, DragSourceListener {\r
31 \r
32     /** \r
33      * Can participant provide draggable content\r
34      * @return 0 for no, others operations, see {@link DnDConstants}\r
35      */\r
36     int canDrag(MouseDragBegin me);\r
37 \r
38     Transferable dragStart(DragGestureEvent e);\r
39 \r
40     /**\r
41      * Get allowed ops (See DnDConstants)\r
42      * @return\r
43      */\r
44     int getAllowedOps();\r
45 \r
46 }\r