Medical Imaging Interaction Toolkit  2016.11.0
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,
6  Division of Medical and Biological Informatics.
7  All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without
10  even the implied warranty of MERCHANTABILITY or FITNESS FOR
11  A PARTICULAR PURPOSE.
12 
13  See LICENSE.txt or http://www.mitk.org for details.
14 
15  ===================================================================*/
16 
17 #include "mitkMouseWheelEvent.h"
18 
20  const Point2D &mousePosition,
21  MouseButtons buttonStates,
22  ModifierKeys modifiers,
23  int wheelDelta)
24  : InteractionPositionEvent(baseRenderer, mousePosition),
25  m_WheelDelta(wheelDelta),
26  m_ButtonStates(buttonStates),
27  m_Modifiers(modifiers)
28 {
29 }
30 
32 {
33  return m_WheelDelta;
34 }
35 
37 {
38  m_WheelDelta = delta;
39 }
40 
42 {
43  return m_Modifiers;
44 }
45 
47 {
48  return m_ButtonStates;
49 }
50 
51 void mitk::MouseWheelEvent::SetModifiers(ModifierKeys modifiers)
52 {
53  m_Modifiers = modifiers;
54 }
55 
56 void mitk::MouseWheelEvent::SetButtonStates(MouseButtons buttons)
57 {
58  m_ButtonStates = buttons;
59 }
60 
62 {
63 }
64 
65 bool mitk::MouseWheelEvent::IsEqual(const mitk::InteractionEvent &interactionEvent) const
66 {
67  const mitk::MouseWheelEvent &mwe = static_cast<const MouseWheelEvent &>(interactionEvent);
68  return ((this->GetWheelDelta() * mwe.GetWheelDelta() >=
69  0) // Consider WheelEvents to be equal if the scrolling is done in the same direction.
70  &&
71  this->GetModifiers() == mwe.GetModifiers() && this->GetButtonStates() == mwe.GetButtonStates() &&
72  Superclass::IsEqual(interactionEvent));
73 }
74 
76 {
77  return (dynamic_cast<MouseWheelEvent *>(baseClass.GetPointer()) != NULL);
78 }
Super class for all position events.
MouseWheelEvent(BaseRenderer *=NULL, const Point2D &mousePosition=Point2D(), MouseButtons buttonStates=NoButton, ModifierKeys modifiers=NoKey, int wheelDelta=0)
virtual bool IsSuperClassOf(const InteractionEvent::Pointer &baseClass) const override
void SetModifiers(ModifierKeys modifiers)
Organizes the rendering process.
ModifierKeys GetModifiers() const
void SetButtonStates(MouseButtons buttons)
virtual bool IsEqual(const InteractionEvent &) const override
MouseButtons GetButtonStates() const