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
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g2d.element.handler;
\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
23 * Handler that handles mouse events.
\r
24 * Coordinates are in element coordinate system.
\r
26 * Handler receives mouse enter and exit events when pointer
\r
27 * enters / exits the element area / control area.
\r
29 * This handler requires that {@link ElementInteractor} in the canvas.
\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
34 * @See {@link TransformUtil} Coordinate modifications
\r
35 * @author Toni Kalajainen
\r
37 public interface HandleMouseEvent extends ElementHandler {
\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
43 public boolean handleMouseEvent(IElement e, ICanvasContext ctx, MouseEvent me) {
\r
49 * Handle mouse event. Coordinates are in control coordinates.
\r
53 boolean handleMouseEvent(IElement e, ICanvasContext ctx, MouseEvent me);
\r