VTK  9.4.20241221
vtkContextMouseEvent.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
38#ifndef vtkContextMouseEvent_h
39#define vtkContextMouseEvent_h
40
41#include "vtkRenderingContext2DModule.h" // For export macro
42#include "vtkVector.h" // Needed for vtkVector2f and vtkVector2i
43#include "vtkWin32Header.h" // For export macros.
44
45VTK_ABI_NAMESPACE_BEGIN
47
48class VTKRENDERINGCONTEXT2D_EXPORT vtkContextMouseEvent
49{
50public:
54 enum
55 {
56 NO_BUTTON = 0,
57 LEFT_BUTTON = 1,
58 MIDDLE_BUTTON = 2,
59 RIGHT_BUTTON = 4
60 };
61
65 enum
66 {
67 NO_MODIFIER = 0,
68 ALT_MODIFIER = 1,
69 SHIFT_MODIFIER = 2,
70 CONTROL_MODIFIER = 4
71 };
72
74
78 void SetInteractor(vtkRenderWindowInteractor* interactor) { this->Interactor = interactor; }
79
84 vtkRenderWindowInteractor* GetInteractor() const { return this->Interactor; }
85
89 void SetPos(const vtkVector2f& pos) { this->Pos = pos; }
90 vtkVector2f GetPos() const { return this->Pos; }
91
95 void SetScenePos(const vtkVector2f& pos) { this->ScenePos = pos; }
96 vtkVector2f GetScenePos() const { return this->ScenePos; }
97
101 void SetScreenPos(const vtkVector2i& pos) { this->ScreenPos = pos; }
102 vtkVector2i GetScreenPos() const { return this->ScreenPos; }
103
107 void SetLastPos(const vtkVector2f& pos) { this->LastPos = pos; }
108 vtkVector2f GetLastPos() const { return this->LastPos; }
109
113 void SetLastScenePos(const vtkVector2f& pos) { this->LastScenePos = pos; }
114 vtkVector2f GetLastScenePos() const { return this->LastScenePos; }
115
119 void SetLastScreenPos(const vtkVector2i& pos) { this->LastScreenPos = pos; }
120 vtkVector2i GetLastScreenPos() const { return this->LastScreenPos; }
121
126 void SetButton(int button) { this->Button = button; }
127 int GetButton() const { return this->Button; }
128
133 int GetModifiers() const;
134
135protected:
140
145
150
155
160
165
170
172};
173
174VTK_ABI_NAMESPACE_END
175#endif // vtkContextMouseEvent_h
176// VTK-HeaderTest-Exclude: vtkContextMouseEvent.h
data structure to represent mouse events.
vtkVector2f LastPos
‘Pos’ at the previous mouse event.
vtkVector2f GetLastScenePos() const
int Button
Mouse button that caused the event, using the anonymous enumeration.
void SetButton(int button)
Set/get the mouse button that caused the event, with possible values being NO_BUTTON,...
void SetLastPos(const vtkVector2f &pos)
Set/get the position of the mouse in the item's coordinates.
vtkVector2f GetLastPos() const
void SetScenePos(const vtkVector2f &pos)
Set/get the position of the mouse in scene coordinates.
vtkVector2i GetLastScreenPos() const
vtkVector2f Pos
Position of the mouse in item coordinate system.
vtkRenderWindowInteractor * GetInteractor() const
Get the interactor for the mouse event.
vtkRenderWindowInteractor * Interactor
int GetModifiers() const
Return the modifier keys, if any, ORed together.
void SetLastScreenPos(const vtkVector2i &pos)
Set/get the position of the mouse in screen coordinates.
vtkVector2f GetScenePos() const
void SetPos(const vtkVector2f &pos)
Set/get the position of the mouse in the item's coordinates.
void SetLastScenePos(const vtkVector2f &pos)
Set/get the position of the mouse in scene coordinates.
void SetInteractor(vtkRenderWindowInteractor *interactor)
Set the interactor for the mouse event.
vtkVector2f ScenePos
Position of the mouse the scene coordinate system.
vtkContextMouseEvent()=default
void SetScreenPos(const vtkVector2i &pos)
Set/get the position of the mouse in screen coordinates.
vtkVector2i ScreenPos
Position of the mouse in screen coordinates.
vtkVector2i GetScreenPos() const
vtkVector2f GetPos() const
vtkVector2f LastScenePos
`ScenePos'at the previous mouse event.
vtkVector2i LastScreenPos
‘ScreenPos’ at the previous mouse event.
platform-independent render window interaction including picking and frame rate control.
Some derived classes for the different vectors commonly used.
Definition vtkVector.h:440