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 #ifndef Q_VTK_INTERACTOR_H
28 #define Q_VTK_INTERACTOR_H
29 
30 #include "vtkGUISupportQtModule.h" // For export macro
31 #include "QVTKWin32Header.h"
33 #include <vtkCommand.h>
34 #include <QtCore/QObject>
35 
36 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
37 #if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
38 class vtkTDxWinDevice;
39 #endif
40 #if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
41 class vtkTDxMacDevice;
42 #endif
43 #if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
44 class vtkTDxDevice;
45 class vtkTDxUnixDevice;
46 #endif
47 
48 
50 
59 class VTKGUISUPPORTQT_EXPORT QVTKInteractor : public vtkRenderWindowInteractor
60 {
61 public:
62  static QVTKInteractor* New();
64 
70  {
71  ContextMenuEvent = vtkCommand::UserEvent + 100,
75  DropEvent
76  };
77 
82  void TerminateApp() override;
83 
88  void Start() override;
89  void Initialize() override;
90 
94  virtual void StartListening();
95 
99  virtual void StopListening();
100 
104  virtual void TimerEvent(int timerId);
105 
106 #if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
107  virtual vtkTDxUnixDevice *GetDevice();
108  virtual void SetDevice(vtkTDxDevice *device);
109 #endif
110 
111 protected:
112  // constructor
113  QVTKInteractor();
114  // destructor
115  ~QVTKInteractor() override;
116 
117  // create a Qt Timer
118  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
119  // destroy a Qt Timer
120  int InternalDestroyTimer(int platformTimerId) override;
121 #if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
122  vtkTDxWinDevice *Device;
123 #endif
124 #if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
125  vtkTDxMacDevice *Device;
126 #endif
127 #if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
128  vtkTDxUnixDevice *Device;
129 #endif
130 
131 private:
132 
133  QVTKInteractorInternal* Internal;
134 
135  QVTKInteractor(const QVTKInteractor&) = delete;
136  void operator=(const QVTKInteractor&) = delete;
137 
138 };
139 
140 #endif
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.
an interactor for QVTKOpenGLNativeWidget (and QVTKWiget).
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.
vtkCustomEvents
Enum for additional event types supported.
virtual void TerminateApp(void)
This function is called on &#39;q&#39;,&#39;e&#39; keypress if exitmethod is not specified and should be overridden b...