Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkMouseWheelEvent.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkMouseWheelEvent.h"
14 
16  const Point2D &mousePosition,
17  MouseButtons buttonStates,
18  ModifierKeys modifiers,
19  int wheelDelta)
20  : InteractionPositionEvent(baseRenderer, mousePosition),
21  m_WheelDelta(wheelDelta),
22  m_ButtonStates(buttonStates),
23  m_Modifiers(modifiers)
24 {
25 }
26 
28 {
29  return m_WheelDelta;
30 }
31 
33 {
34  m_WheelDelta = delta;
35 }
36 
38 {
39  return m_Modifiers;
40 }
41 
43 {
44  return m_ButtonStates;
45 }
46 
48 {
49  m_Modifiers = modifiers;
50 }
51 
53 {
54  m_ButtonStates = buttons;
55 }
56 
58 {
59 }
60 
61 bool mitk::MouseWheelEvent::IsEqual(const mitk::InteractionEvent &interactionEvent) const
62 {
63  const auto &mwe = static_cast<const MouseWheelEvent &>(interactionEvent);
64  return ((this->GetWheelDelta() * mwe.GetWheelDelta() >=
65  0) // Consider WheelEvents to be equal if the scrolling is done in the same direction.
66  &&
67  this->GetModifiers() == mwe.GetModifiers() && this->GetButtonStates() == mwe.GetButtonStates() &&
68  Superclass::IsEqual(interactionEvent));
69 }
70 
72 {
73  return (dynamic_cast<MouseWheelEvent *>(baseClass.GetPointer()) != nullptr);
74 }
Super class for all position events.
bool IsSuperClassOf(const InteractionEvent::Pointer &baseClass) const override
void SetModifiers(ModifierKeys modifiers)
Organizes the rendering process.
MouseButtons GetButtonStates() const
MouseWheelEvent(BaseRenderer *=nullptr, const Point2D &mousePosition=Point2D(), MouseButtons buttonStates=NoButton, ModifierKeys modifiers=NoKey, int wheelDelta=0)
void SetButtonStates(MouseButtons buttons)
ModifierKeys GetModifiers() const
bool IsEqual(const InteractionEvent &) const override
bool IsEqual(const InteractionEvent &) const override