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