1 /*******************************************************************************
\r
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
\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.g3d.vtk.action;
\r
14 import java.awt.event.KeyEvent;
\r
15 import java.awt.event.KeyListener;
\r
16 import java.awt.event.MouseEvent;
\r
17 import java.awt.event.MouseListener;
\r
18 import java.awt.event.MouseMotionListener;
\r
20 import org.eclipse.jface.action.Action;
\r
21 import org.simantics.g3d.vtk.common.InteractiveVtkPanel;
\r
23 public abstract class vtkAction extends Action implements KeyListener, MouseListener, MouseMotionListener {
\r
25 protected InteractiveVtkPanel panel;
\r
27 public vtkAction(InteractiveVtkPanel panel) {
\r
33 panel.setActiveAction(this);
\r
37 public void attach() {
\r
39 panel.addKeyListener(this);
\r
40 panel.addMouseListener(this);
\r
41 panel.addMouseMotionListener(this);
\r
45 public void deattach() {
\r
46 panel.removeKeyListener(this);
\r
47 panel.removeMouseListener(this);
\r
48 panel.removeMouseMotionListener(this);
\r
52 public void keyPressed(KeyEvent e) {
\r
57 public void keyReleased(KeyEvent e) {
\r
62 public void keyTyped(KeyEvent e) {
\r
66 public void mouseClicked(java.awt.event.MouseEvent e) {
\r
71 public void mouseDragged(MouseEvent e) {
\r
76 public void mouseEntered(MouseEvent e) {
\r
81 public void mouseExited(MouseEvent e) {
\r
86 public void mouseMoved(MouseEvent e) {
\r
91 public void mousePressed(MouseEvent e) {
\r
96 public void mouseReleased(MouseEvent e) {
\r