VTK  9.1.0
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 
44 #ifndef vtkContextMouseEvent_h
45 #define vtkContextMouseEvent_h
46 
47 #include "vtkRenderingContext2DModule.h" // For export macro
48 #include "vtkVector.h" // Needed for vtkVector2f and vtkVector2i
49 #include "vtkWin32Header.h" // For export macros.
50 
52 
53 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextMouseEvent
54 {
55 public:
59  enum
60  {
61  NO_BUTTON = 0,
62  LEFT_BUTTON = 1,
63  MIDDLE_BUTTON = 2,
64  RIGHT_BUTTON = 4
65  };
66 
70  enum
71  {
72  NO_MODIFIER = 0,
73  ALT_MODIFIER = 1,
74  SHIFT_MODIFIER = 2,
75  CONTROL_MODIFIER = 4
76  };
77 
78  vtkContextMouseEvent() = default;
79 
83  void SetInteractor(vtkRenderWindowInteractor* interactor) { this->Interactor = interactor; }
84 
89  vtkRenderWindowInteractor* GetInteractor() const { return this->Interactor; }
90 
94  void SetPos(const vtkVector2f& pos) { this->Pos = pos; }
95  vtkVector2f GetPos() const { return this->Pos; }
96 
100  void SetScenePos(const vtkVector2f& pos) { this->ScenePos = pos; }
101  vtkVector2f GetScenePos() const { return this->ScenePos; }
102 
106  void SetScreenPos(const vtkVector2i& pos) { this->ScreenPos = pos; }
107  vtkVector2i GetScreenPos() const { return this->ScreenPos; }
108 
112  void SetLastPos(const vtkVector2f& pos) { this->LastPos = pos; }
113  vtkVector2f GetLastPos() const { return this->LastPos; }
114 
118  void SetLastScenePos(const vtkVector2f& pos) { this->LastScenePos = pos; }
119  vtkVector2f GetLastScenePos() const { return this->LastScenePos; }
120 
124  void SetLastScreenPos(const vtkVector2i& pos) { this->LastScreenPos = pos; }
125  vtkVector2i GetLastScreenPos() const { return this->LastScreenPos; }
126 
131  void SetButton(int button) { this->Button = button; }
132  int GetButton() const { return this->Button; }
133 
138  int GetModifiers() const;
139 
140 protected:
145 
150 
155 
160 
165 
170 
174  int Button;
175 
176 protected:
178 };
179 
180 #endif // vtkContextMouseEvent_h
181 // VTK-HeaderTest-Exclude: vtkContextMouseEvent.h
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:54
vtkContextMouseEvent::ScreenPos
vtkVector2i ScreenPos
Position of the mouse in screen coordinates.
Definition: vtkContextMouseEvent.h:154
vtkContextMouseEvent::Pos
vtkVector2f Pos
Position of the mouse in item coordinate system.
Definition: vtkContextMouseEvent.h:144
vtkContextMouseEvent::SetLastScenePos
void SetLastScenePos(const vtkVector2f &pos)
Set/get the position of the mouse in scene coordinates.
Definition: vtkContextMouseEvent.h:118
vtkVector.h
vtkContextMouseEvent::SetLastScreenPos
void SetLastScreenPos(const vtkVector2i &pos)
Set/get the position of the mouse in screen coordinates.
Definition: vtkContextMouseEvent.h:124
vtkContextMouseEvent::GetButton
int GetButton() const
Definition: vtkContextMouseEvent.h:132
vtkContextMouseEvent::SetScreenPos
void SetScreenPos(const vtkVector2i &pos)
Set/get the position of the mouse in screen coordinates.
Definition: vtkContextMouseEvent.h:106
vtkContextMouseEvent::LastScreenPos
vtkVector2i LastScreenPos
‘ScreenPos’ at the previous mouse event.
Definition: vtkContextMouseEvent.h:169
vtkContextMouseEvent::GetScreenPos
vtkVector2i GetScreenPos() const
Definition: vtkContextMouseEvent.h:107
vtkContextMouseEvent::LastScenePos
vtkVector2f LastScenePos
`ScenePos'at the previous mouse event.
Definition: vtkContextMouseEvent.h:164
vtkContextMouseEvent::SetLastPos
void SetLastPos(const vtkVector2f &pos)
Set/get the position of the mouse in the item's coordinates.
Definition: vtkContextMouseEvent.h:112
vtkContextMouseEvent::SetPos
void SetPos(const vtkVector2f &pos)
Set/get the position of the mouse in the item's coordinates.
Definition: vtkContextMouseEvent.h:94
vtkContextMouseEvent::GetScenePos
vtkVector2f GetScenePos() const
Definition: vtkContextMouseEvent.h:101
vtkContextMouseEvent::SetInteractor
void SetInteractor(vtkRenderWindowInteractor *interactor)
Set the interactor for the mouse event.
Definition: vtkContextMouseEvent.h:83
vtkContextMouseEvent::GetPos
vtkVector2f GetPos() const
Definition: vtkContextMouseEvent.h:95
vtkContextMouseEvent::SetButton
void SetButton(int button)
Set/get the mouse button that caused the event, with possible values being NO_BUTTON,...
Definition: vtkContextMouseEvent.h:131
vtkContextMouseEvent::GetLastPos
vtkVector2f GetLastPos() const
Definition: vtkContextMouseEvent.h:113
vtkContextMouseEvent::vtkContextMouseEvent
vtkContextMouseEvent()=default
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:192
vtkContextMouseEvent::ScenePos
vtkVector2f ScenePos
Position of the mouse the scene coordinate system.
Definition: vtkContextMouseEvent.h:149
vtkContextMouseEvent::GetModifiers
int GetModifiers() const
Return the modifier keys, if any, ORed together.
vtkContextMouseEvent::GetLastScenePos
vtkVector2f GetLastScenePos() const
Definition: vtkContextMouseEvent.h:119
vtkWin32Header.h
vtkContextMouseEvent::GetInteractor
vtkRenderWindowInteractor * GetInteractor() const
Get the interactor for the mouse event.
Definition: vtkContextMouseEvent.h:89
vtkContextMouseEvent::GetLastScreenPos
vtkVector2i GetLastScreenPos() const
Definition: vtkContextMouseEvent.h:125
vtkContextMouseEvent::Button
int Button
Mouse button that caused the event, using the anonymous enumeration.
Definition: vtkContextMouseEvent.h:174
vtkVector2i
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:478
vtkContextMouseEvent::LastPos
vtkVector2f LastPos
‘Pos’ at the previous mouse event.
Definition: vtkContextMouseEvent.h:159
vtkVector2f
Definition: vtkVector.h:491
vtkContextMouseEvent::SetScenePos
void SetScenePos(const vtkVector2f &pos)
Set/get the position of the mouse in scene coordinates.
Definition: vtkContextMouseEvent.h:100
vtkContextMouseEvent::Interactor
vtkRenderWindowInteractor * Interactor
Definition: vtkContextMouseEvent.h:177