VTK  9.2.5
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 
50 #ifndef vtkContextMouseEvent_h
51 #define vtkContextMouseEvent_h
52 
53 #include "vtkRenderingContext2DModule.h" // For export macro
54 #include "vtkVector.h" // Needed for vtkVector2f and vtkVector2i
55 #include "vtkWin32Header.h" // For export macros.
56 
58 
59 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextMouseEvent
60 {
61 public:
65  enum
66  {
67  NO_BUTTON = 0,
68  LEFT_BUTTON = 1,
69  MIDDLE_BUTTON = 2,
70  RIGHT_BUTTON = 4
71  };
72 
76  enum
77  {
78  NO_MODIFIER = 0,
79  ALT_MODIFIER = 1,
80  SHIFT_MODIFIER = 2,
81  CONTROL_MODIFIER = 4
82  };
83 
84  vtkContextMouseEvent() = default;
85 
89  void SetInteractor(vtkRenderWindowInteractor* interactor) { this->Interactor = interactor; }
90 
95  vtkRenderWindowInteractor* GetInteractor() const { return this->Interactor; }
96 
100  void SetPos(const vtkVector2f& pos) { this->Pos = pos; }
101  vtkVector2f GetPos() const { return this->Pos; }
102 
106  void SetScenePos(const vtkVector2f& pos) { this->ScenePos = pos; }
107  vtkVector2f GetScenePos() const { return this->ScenePos; }
108 
112  void SetScreenPos(const vtkVector2i& pos) { this->ScreenPos = pos; }
113  vtkVector2i GetScreenPos() const { return this->ScreenPos; }
114 
118  void SetLastPos(const vtkVector2f& pos) { this->LastPos = pos; }
119  vtkVector2f GetLastPos() const { return this->LastPos; }
120 
124  void SetLastScenePos(const vtkVector2f& pos) { this->LastScenePos = pos; }
125  vtkVector2f GetLastScenePos() const { return this->LastScenePos; }
126 
130  void SetLastScreenPos(const vtkVector2i& pos) { this->LastScreenPos = pos; }
131  vtkVector2i GetLastScreenPos() const { return this->LastScreenPos; }
132 
137  void SetButton(int button) { this->Button = button; }
138  int GetButton() const { return this->Button; }
139 
144  int GetModifiers() const;
145 
146 protected:
151 
156 
161 
166 
171 
176 
180  int Button;
181 
182 protected:
184 };
185 
186 #endif // vtkContextMouseEvent_h
187 // 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:481