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