VTK
QVTKInteractor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: QVTKInteractor.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 /*=========================================================================
17 
18  Copyright 2004 Sandia Corporation.
19  Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
20  license for use of this work by or on behalf of the
21  U.S. Government. Redistribution and use in source and binary forms, with
22  or without modification, are permitted provided that this Notice and any
23  statement of authorship are reproduced on all copies.
24 
25 =========================================================================*/
26 
27 /*========================================================================
28  For general information about using VTK and Qt, see:
29  http://www.trolltech.com/products/3rdparty/vtksupport.html
30 =========================================================================*/
31 
32 // .NAME QVTKInteractor - Handle Qt events.
33 // .SECTION Description
34 // QVTKInteractor handles relaying Qt events to VTK.
35 
36 #ifndef Q_VTK_INTERACTOR_H
37 #define Q_VTK_INTERACTOR_H
38 
39 #include "vtkGUISupportQtModule.h" // For export macro
40 #include "QVTKWin32Header.h"
42 #include <vtkCommand.h>
43 #include <QtCore/QObject>
44 
45 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
46 #if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
47 class vtkTDxWinDevice;
48 #endif
49 #if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
50 class vtkTDxMacDevice;
51 #endif
52 #if defined(VTK_USE_TDX) && defined(Q_WS_X11)
53 class vtkTDxDevice;
54 class vtkTDxUnixDevice;
55 #endif
56 
57 
59 
60 // .NAME QVTKInteractor - An interactor for the QVTKWidget.
61 // .SECTION Description
62 // QVTKInteractor is an interactor for a QVTKWiget.
63 
64 class VTKGUISUPPORTQT_EXPORT QVTKInteractor : public vtkRenderWindowInteractor
65 {
66 public:
67  static QVTKInteractor* New();
69 
70  // Description:
71  // Enum for additional event types supported.
72  // These events can be picked up by command observers on the interactor
74  {
75  ContextMenuEvent = vtkCommand::UserEvent + 100,
79  DropEvent
80  };
81 
82 
83  // Description:
84  // Overloaded terminiate app, which does nothing in Qt.
85  // Use qApp->exit() instead.
86  virtual void TerminateApp();
87 
88  // Description:
89  // Overloaded start method does nothing.
90  // Use qApp->exec() instead.
91  virtual void Start();
92  virtual void Initialize();
93 
94  // Description:
95  // Start listening events on 3DConnexion device.
96  virtual void StartListening();
97 
98  // Description:
99  // Stop listening events on 3DConnexion device.
100  virtual void StopListening();
101 
102  // timer event slot
103  virtual void TimerEvent(int timerId);
104 
105 #if defined(VTK_USE_TDX) && defined(Q_WS_X11)
106  virtual vtkTDxUnixDevice *GetDevice();
107  virtual void SetDevice(vtkTDxDevice *device);
108 #endif
109 
110 protected:
111  // constructor
112  QVTKInteractor();
113  // destructor
114  ~QVTKInteractor();
115 
116  // create a Qt Timer
117  virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
118  // destroy a Qt Timer
119  virtual int InternalDestroyTimer(int platformTimerId);
120 #if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
121  vtkTDxWinDevice *Device;
122 #endif
123 #if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
124  vtkTDxMacDevice *Device;
125 #endif
126 #if defined(VTK_USE_TDX) && defined(Q_WS_X11)
127  vtkTDxUnixDevice *Device;
128 #endif
129 
130 private:
131 
132  QVTKInteractorInternal* Internal;
133 
134  // unimplemented copy
136  // unimplemented operator=
137  void operator=(const QVTKInteractor&);
138 
139 };
140 
141 #endif
Implementation of vtkTDxDevice on Windows.
Implementation of vtkTDxDevice on Unix.
Implementation of vtkTDxDevice on Mac.
virtual int InternalDestroyTimer(int platformTimerId)
Internal methods for creating and destroying timers that must be implemented by subclasses.
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
static vtkRenderWindowInteractor * New()
platform-independent render window interaction including picking and frame rate control.
virtual void Start()
Start the event loop.
virtual void TerminateApp(void)
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
API to access a 3DConnexion input device.
Definition: vtkTDxDevice.h:37