forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QVTKInteractor.h
137 lines (112 loc) · 3.7 KB
/
QVTKInteractor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*=========================================================================
Program: Visualization Toolkit
Module: QVTKInteractor.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*=========================================================================
Copyright 2004 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
license for use of this work by or on behalf of the
U.S. Government. Redistribution and use in source and binary forms, with
or without modification, are permitted provided that this Notice and any
statement of authorship are reproduced on all copies.
=========================================================================*/
#ifndef Q_VTK_INTERACTOR_H
#define Q_VTK_INTERACTOR_H
#include "QVTKWin32Header.h"
#include "vtkGUISupportQtModule.h" // For export macro
#include <QtCore/QObject>
#include <vtkCommand.h>
#include <vtkRenderWindowInteractor.h>
#include "vtkTDxConfigure.h" // defines VTK_USE_TDX
#if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
class vtkTDxWinDevice;
#endif
#if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
class vtkTDxMacDevice;
#endif
#if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
class vtkTDxDevice;
class vtkTDxUnixDevice;
#endif
class QVTKInteractorInternal;
/**
* @class QVTKInteractor
* @brief - an interactor for QVTKOpenGLNativeWidget (and QVTKWiget).
*
* QVTKInteractor handles relaying Qt events to VTK.
* @sa QVTKOpenGLNativeWidget
*/
class VTKGUISUPPORTQT_EXPORT QVTKInteractor : public vtkRenderWindowInteractor
{
public:
static QVTKInteractor* New();
vtkTypeMacro(QVTKInteractor, vtkRenderWindowInteractor);
/**
* Enum for additional event types supported.
* These events can be picked up by command observers on the interactor.
*/
enum vtkCustomEvents
{
ContextMenuEvent = vtkCommand::UserEvent + 100,
DragEnterEvent,
DragMoveEvent,
DragLeaveEvent,
DropEvent
};
/**
* Overloaded terminate app, which does nothing in Qt.
* Use qApp->exit() instead.
*/
void TerminateApp() override;
/**
* Overloaded start method does nothing.
* Use qApp->exec() instead.
*/
void Start() override;
void Initialize() override;
/**
* Start listening events on 3DConnexion device.
*/
virtual void StartListening();
/**
* Stop listening events on 3DConnexion device.
*/
virtual void StopListening();
/**
* timer event slot
*/
virtual void TimerEvent(int timerId);
#if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
virtual vtkTDxUnixDevice* GetDevice();
virtual void SetDevice(vtkTDxDevice* device);
#endif
protected:
// constructor
QVTKInteractor();
// destructor
~QVTKInteractor() override;
// create a Qt Timer
int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
// destroy a Qt Timer
int InternalDestroyTimer(int platformTimerId) override;
#if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
vtkTDxWinDevice* Device;
#endif
#if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
vtkTDxMacDevice* Device;
#endif
#if defined(VTK_USE_TDX) && (defined(Q_WS_X11) || defined(Q_OS_LINUX))
vtkTDxUnixDevice* Device;
#endif
private:
QVTKInteractorInternal* Internal;
QVTKInteractor(const QVTKInteractor&) = delete;
void operator=(const QVTKInteractor&) = delete;
};
#endif