]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/element/handler/HandleMouseEvent.java
Sync git svn branch with SVN repository r33324.
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / element / handler / HandleMouseEvent.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.element.handler;\r
13 \r
14 import org.simantics.g2d.canvas.ICanvasContext;\r
15 import org.simantics.g2d.diagram.participant.ElementInteractor;\r
16 import org.simantics.g2d.element.IElement;\r
17 import org.simantics.g2d.element.handler.impl.AbstractClickable;\r
18 import org.simantics.g2d.element.handler.impl.AbstractGrabbable;\r
19 import org.simantics.g2d.participant.TransformUtil;\r
20 import org.simantics.scenegraph.g2d.events.MouseEvent;\r
21 \r
22 /**\r
23  * Handler that handles mouse events.\r
24  * Coordinates are in element coordinate system.\r
25  * <p>\r
26  * Handler receives mouse enter and exit events when pointer\r
27  * enters / exits the element area / control area. \r
28  * <p>\r
29  * This handler requires that {@link ElementInteractor} in the canvas. \r
30  * \r
31  * @See {@link AbstractGrabbable} Base implementation for elements with draggable content\r
32  * @See {@link AbstractClickable} Base implementation for elements that are pressable\r
33  * \r
34  * @See {@link TransformUtil} Coordinate modifications\r
35  * @author Toni Kalajainen\r
36  */\r
37 public interface HandleMouseEvent extends ElementHandler {\r
38         \r
39         /** This handler consumes all mouse events sent to element */\r
40         public static final HandleMouseEvent EVENT_CONSUMER = new HandleMouseEvent() {\r
41                 private static final long serialVersionUID = 8575435739682820291L;\r
42                 @Override\r
43                 public boolean handleMouseEvent(IElement e, ICanvasContext ctx, MouseEvent me) {\r
44                         return true;\r
45                 }\r
46         };\r
47         \r
48         /**\r
49          * Handle mouse event. Coordinates are in control coordinates.\r
50          * @param e\r
51          * @return\r
52          */\r
53         boolean handleMouseEvent(IElement e, ICanvasContext ctx, MouseEvent me);\r
54         \r
55 }\r