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