VTK
vtkQtChartInteractor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtChartInteractor.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
20 
23 
24 #ifndef _vtkQtChartInteractor_h
25 #define _vtkQtChartInteractor_h
26 
27 
28 #include "vtkQtChartExport.h"
29 #include <QObject>
30 
31 class vtkQtChartArea;
33 class vtkQtChartInteractorInternal;
34 class vtkQtChartInteractorModeList;
37 class QCursor;
38 class QKeyEvent;
39 class QKeySequence;
40 class QMouseEvent;
41 class QRect;
42 class QWheelEvent;
43 
44 
60 class VTKQTCHART_EXPORT vtkQtChartInteractor : public QObject
61 {
62  Q_OBJECT
63 
64 public:
68  vtkQtChartInteractor(QObject *parent=0);
69  virtual ~vtkQtChartInteractor();
70 
72 
73  vtkQtChartArea *getChartArea() const {return this->ChartArea;}
78 
82  void setChartArea(vtkQtChartArea *area);
84 
86 
87  void setFunction(Qt::MouseButton button, vtkQtChartMouseFunction *function,
98  Qt::KeyboardModifiers modifiers=Qt::NoModifier);
99 
105  void setWheelFunction(vtkQtChartMouseFunction *function,
106  Qt::KeyboardModifiers modifiers=Qt::NoModifier);
107 
119  void addFunction(Qt::MouseButton button, vtkQtChartMouseFunction *function,
120  Qt::KeyboardModifiers modifiers=Qt::NoModifier);
121 
127  void addWheelFunction(vtkQtChartMouseFunction *function,
128  Qt::KeyboardModifiers modifiers=Qt::NoModifier);
129 
133  void removeFunction(vtkQtChartMouseFunction *function);
134 
138  void removeFunctions(Qt::MouseButton button);
139 
141  void removeWheelFunctions();
142 
144  void removeAllFunctions();
145 
151  int getNumberOfModes(Qt::MouseButton button) const;
152 
158  int getMode(Qt::MouseButton button) const;
159 
164  void setMode(Qt::MouseButton button, int index);
165 
170  int getNumberOfWheelModes() const;
171 
176  int getWheelMode() const;
177 
181  void setWheelMode(int index);
183 
185 
186  void addKeyboardFunction(const QKeySequence &sequence,
196  vtkQtChartKeyboardFunction *function);
197 
201  void removeKeyboardFunction(vtkQtChartKeyboardFunction *function);
202 
204  void removeKeyboardFunctions();
206 
208 
209  virtual bool keyPressEvent(QKeyEvent *e);
217 
226  virtual void mousePressEvent(QMouseEvent *e);
227 
231  virtual void mouseMoveEvent(QMouseEvent *e);
232 
236  virtual void mouseReleaseEvent(QMouseEvent *e);
237 
241  virtual void mouseDoubleClickEvent(QMouseEvent *e);
242 
246  virtual void wheelEvent(QWheelEvent *e);
248 
249 signals:
253  void cursorChangeRequested(const QCursor &cursor);
254 
255 private slots:
262  void beginState(vtkQtChartMouseFunction *owner);
263 
270  void endState(vtkQtChartMouseFunction *owner);
271 
272 private:
279  void addFunction(vtkQtChartInteractorModeList *list,
280  vtkQtChartMouseFunction *function, Qt::KeyboardModifiers modifiers);
281 
285  void removeFunctions(vtkQtChartInteractorModeList *list);
286 
287 private:
289  vtkQtChartInteractorInternal *Internal;
290  vtkQtChartArea *ChartArea;
291  Qt::KeyboardModifier XModifier;
292  Qt::KeyboardModifier YModifier;
293 };
294 
295 #endif