VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkQtChartInteractor.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 00019 -------------------------------------------------------------------------*/ 00020 00023 00024 #ifndef _vtkQtChartInteractor_h 00025 #define _vtkQtChartInteractor_h 00026 00027 00028 #include "vtkQtChartExport.h" 00029 #include <QObject> 00030 00031 class vtkQtChartArea; 00032 class vtkQtChartContentsSpace; 00033 class vtkQtChartInteractorInternal; 00034 class vtkQtChartInteractorModeList; 00035 class vtkQtChartKeyboardFunction; 00036 class vtkQtChartMouseFunction; 00037 class QCursor; 00038 class QKeyEvent; 00039 class QKeySequence; 00040 class QMouseEvent; 00041 class QRect; 00042 class QWheelEvent; 00043 00044 00060 class VTKQTCHART_EXPORT vtkQtChartInteractor : public QObject 00061 { 00062 Q_OBJECT 00063 00064 public: 00068 vtkQtChartInteractor(QObject *parent=0); 00069 virtual ~vtkQtChartInteractor(); 00070 00072 00073 00074 00075 00076 00077 vtkQtChartArea *getChartArea() const {return this->ChartArea;} 00078 00082 void setChartArea(vtkQtChartArea *area); 00084 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 void setFunction(Qt::MouseButton button, vtkQtChartMouseFunction *function, 00098 Qt::KeyboardModifiers modifiers=Qt::NoModifier); 00099 00105 void setWheelFunction(vtkQtChartMouseFunction *function, 00106 Qt::KeyboardModifiers modifiers=Qt::NoModifier); 00107 00119 void addFunction(Qt::MouseButton button, vtkQtChartMouseFunction *function, 00120 Qt::KeyboardModifiers modifiers=Qt::NoModifier); 00121 00127 void addWheelFunction(vtkQtChartMouseFunction *function, 00128 Qt::KeyboardModifiers modifiers=Qt::NoModifier); 00129 00133 void removeFunction(vtkQtChartMouseFunction *function); 00134 00138 void removeFunctions(Qt::MouseButton button); 00139 00141 void removeWheelFunctions(); 00142 00144 void removeAllFunctions(); 00145 00151 int getNumberOfModes(Qt::MouseButton button) const; 00152 00158 int getMode(Qt::MouseButton button) const; 00159 00164 void setMode(Qt::MouseButton button, int index); 00165 00170 int getNumberOfWheelModes() const; 00171 00176 int getWheelMode() const; 00177 00181 void setWheelMode(int index); 00183 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 void addKeyboardFunction(const QKeySequence &sequence, 00196 vtkQtChartKeyboardFunction *function); 00197 00201 void removeKeyboardFunction(vtkQtChartKeyboardFunction *function); 00202 00204 void removeKeyboardFunctions(); 00206 00208 00209 00210 00211 00212 00213 00214 00215 00216 virtual bool keyPressEvent(QKeyEvent *e); 00217 00226 virtual void mousePressEvent(QMouseEvent *e); 00227 00231 virtual void mouseMoveEvent(QMouseEvent *e); 00232 00236 virtual void mouseReleaseEvent(QMouseEvent *e); 00237 00241 virtual void mouseDoubleClickEvent(QMouseEvent *e); 00242 00246 virtual void wheelEvent(QWheelEvent *e); 00248 00249 signals: 00253 void cursorChangeRequested(const QCursor &cursor); 00254 00255 private slots: 00262 void beginState(vtkQtChartMouseFunction *owner); 00263 00270 void endState(vtkQtChartMouseFunction *owner); 00271 00272 private: 00279 void addFunction(vtkQtChartInteractorModeList *list, 00280 vtkQtChartMouseFunction *function, Qt::KeyboardModifiers modifiers); 00281 00285 void removeFunctions(vtkQtChartInteractorModeList *list); 00286 00287 private: 00289 vtkQtChartInteractorInternal *Internal; 00290 vtkQtChartArea *ChartArea; 00291 Qt::KeyboardModifier XModifier; 00292 Qt::KeyboardModifier YModifier; 00293 }; 00294 00295 #endif