00001 /*========================================================================= 00002 vtkQtRenderWindowInteractor.h - copyright 2000 Matthias Koenig 00003 [email protected] 00004 http://wwwisg.cs.uni-magdeburg.de/~makoenig 00005 =========================================================================*/ 00006 /*========================================================================= 00007 This module is an extension of the "Visualization Toolkit 00008 ( copyright (c) 1993-2000 Ken Martin, Will Schroeder, Bill Lorensen )". 00009 and combines it with "Qt (copyright (C) 1992-2000 Troll Tech AS)". 00010 =========================================================================*/ 00011 /*========================================================================= 00012 00013 Module: $RCSfile: vtkQtRenderWindowInteractor.h,v $ 00014 00015 Redistribution and use in source and binary forms, with or without 00016 modification, are permitted provided that the following conditions are met: 00017 00018 * Redistributions of source code must retain the above copyright notice, 00019 this list of conditions and the following disclaimer. 00020 00021 * Redistributions in binary form must reproduce the above copyright notice, 00022 this list of conditions and the following disclaimer in the documentation 00023 and/or other materials provided with the distribution. 00024 00025 * Modified source versions must be plainly marked as such, and must not be 00026 misrepresented as being the original software. 00027 00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 00029 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00030 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00031 ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR 00032 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00033 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00034 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00035 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00036 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00037 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00038 00039 =========================================================================*/ 00055 #ifndef __vtkQtRenderWindowInteractor_h 00056 #define __vtkQtRenderWindowInteractor_h 00057 00058 #include "vtkRenderWindowInteractor.h" 00059 #include "vtkQtRenderWindow.h" 00060 #include <qobject.h> 00061 #include <qtimer.h> 00062 00063 class VTK_EXPORT vtkQtRenderWindowInteractor : public QObject, public vtkRenderWindowInteractor 00064 { 00065 Q_OBJECT 00066 friend class vtkQtRenderWindow; 00067 public: 00068 vtkQtRenderWindowInteractor(); 00069 ~vtkQtRenderWindowInteractor(); 00070 static vtkQtRenderWindowInteractor *New(); // inline 00071 vtkTypeMacro(vtkQtRenderWindowInteractor,vtkRenderWindowInteractor); 00072 void PrintSelf(ostream& os, vtkIndent indent); 00073 00074 void Start(); 00075 00076 void SetRenderWindow(vtkQtRenderWindow*); 00077 00078 // timer methods 00079 int CreateTimer(int timertype); 00080 int DestroyTimer(void); 00081 00082 // own exit method 00083 void ExitCallback(); // inline 00084 00085 protected slots: 00086 void timer(); 00087 protected: 00088 void mousePressEvent(QMouseEvent*); 00089 void mouseReleaseEvent(QMouseEvent*); 00090 void mouseMoveEvent(QMouseEvent*); 00091 void keyPressEvent(QKeyEvent*); 00092 void keyReleaseEvent(QKeyEvent*); 00093 private: 00094 vtkQtRenderWindow *qtRenWin; 00095 QTimer qTimer; 00096 }; 00097 00098 inline vtkQtRenderWindowInteractor *vtkQtRenderWindowInteractor::New() 00099 { return new vtkQtRenderWindowInteractor; } 00100 inline void vtkQtRenderWindowInteractor::ExitCallback() 00101 { qApp->exit(); } 00102 00103 #endif // __vtkQtRenderWindowInteractor_h 00104