VTK  9.2.6
vtkContextMouseEvent.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkContextMouseEvent.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 
40 #ifndef vtkContextMouseEvent_h
41 #define vtkContextMouseEvent_h
42 
43 #include "vtkRenderingContext2DModule.h" // For export macro
44 #include "vtkVector.h" // Needed for vtkVector2f and vtkVector2i
45 #include "vtkWin32Header.h" // For export macros.
46 
48 
49 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextMouseEvent
50 {
51 public:
55  enum
56  {
57  NO_BUTTON = 0,
58  LEFT_BUTTON = 1,
59  MIDDLE_BUTTON = 2,
60  RIGHT_BUTTON = 4
61  };
62 
66  enum
67  {
68  NO_MODIFIER = 0,
69  ALT_MODIFIER = 1,
70  SHIFT_MODIFIER = 2,
71  CONTROL_MODIFIER = 4
72  };
73 
74  vtkContextMouseEvent() = default;
75 
79  void SetInteractor(vtkRenderWindowInteractor* interactor) { this->Interactor = interactor; }
80 
85  vtkRenderWindowInteractor* GetInteractor() const { return this->Interactor; }
86 
90  void SetPos(const vtkVector2f& pos) { this->Pos = pos; }
91  vtkVector2f GetPos() const { return this->Pos; }
92 
96  void SetScenePos(const vtkVector2f& pos) { this->ScenePos = pos; }
97  vtkVector2f GetScenePos() const { return this->ScenePos; }
98 
102  void SetScreenPos(const vtkVector2i& pos) { this->ScreenPos = pos; }
103  vtkVector2i GetScreenPos() const { return this->ScreenPos; }
104 
108  void SetLastPos(const vtkVector2f& pos) { this->LastPos = pos; }
109  vtkVector2f GetLastPos() const { return this->LastPos; }
110 
114  void SetLastScenePos(const vtkVector2f& pos) { this->LastScenePos = pos; }
115  vtkVector2f GetLastScenePos() const { return this->LastScenePos; }
116 
120  void SetLastScreenPos(const vtkVector2i& pos) { this->LastScreenPos = pos; }
121  vtkVector2i GetLastScreenPos() const { return this->LastScreenPos; }
122 
127  void SetButton(int button) { this->Button = button; }
128  int GetButton() const { return this->Button; }
129 
134  int GetModifiers() const;
135 
136 protected:
141 
146 
151 
156 
161 
166 
170  int Button;
171 
172 protected:
174 };
175 
176 #endif // vtkContextMouseEvent_h
177 // VTK-HeaderTest-Exclude: vtkContextMouseEvent.h
data structure to represent mouse events.
vtkVector2f LastPos
‘Pos’ at the previous mouse event.
vtkVector2f GetLastScenePos() const
vtkRenderWindowInteractor * GetInteractor() const
Get the interactor for the mouse event.
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 * 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:431