Medical Imaging Interaction Toolkit  2024.06.99-bf8fb9c0
Medical Imaging Interaction Toolkit
mitkInteractionEvent.h
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 #ifndef mitkInteractionEvent_h
14 #define mitkInteractionEvent_h
15 
16 #include "itkLightObject.h"
17 #include "itkObjectFactory.h"
18 #include "mitkBaseRenderer.h"
19 #include "mitkCommon.h"
20 
21 #include <MitkCoreExports.h>
22 #include <string>
23 
24 namespace mitk
25 {
26  class MITKCORE_EXPORT InteractionEvent : public itk::LightObject
27  {
28  public:
31 
32  void SetSender(BaseRenderer *sender);
33  BaseRenderer *GetSender() const;
34 
39  virtual bool IsSuperClassOf(const InteractionEvent::Pointer &baseClass) const;
40 
45  {
46  NoButton = 0x0000,
47  LeftMouseButton = 0x0001,
48  RightMouseButton = 0x0002,
49  MiddleMouseButton = 0x0004
50  };
51 
53  {
54  NoKey = 0x0000,
55  ShiftKey = 0x0100,
56  ControlKey = 0x0200,
57  AltKey = 0x0400
58  };
59 
63  // Special Keys
64  static const std::string KeyEsc; // = "Escape";
65  static const std::string KeyEnter; // = "Enter";
66  static const std::string KeyReturn; // = "Return";
67  static const std::string KeyDelete; // = "Delete";
68  static const std::string KeyArrowUp; // = "ArrowUp";
69  static const std::string KeyArrowDown; // = "ArrowDown";
70  static const std::string KeyArrowLeft; // = "ArrowLeft";
71  static const std::string KeyArrowRight; // = "ArrowRight";
72 
73  static const std::string KeyF1; // = "F1";
74  static const std::string KeyF2; // = "F2";
75  static const std::string KeyF3; // = "F3";
76  static const std::string KeyF4; // = "F4";
77  static const std::string KeyF5; // = "F5";
78  static const std::string KeyF6; // = "F6";
79  static const std::string KeyF7; // = "F7";
80  static const std::string KeyF8; // = "F8";
81  static const std::string KeyF9; // = "F9";
82  static const std::string KeyF10; // = "F10";
83  static const std::string KeyF11; // = "F11";
84  static const std::string KeyF12; // = "F12";
85 
86  static const std::string KeyPos1; // = "Pos1";
87  static const std::string KeyEnd; // = "End";
88  static const std::string KeyInsert; // = "Insert";
89  static const std::string KeyPageUp; // = "PageUp";
90  static const std::string KeyPageDown; // = "PageDown";
91  static const std::string KeySpace; // = "Space";
92  // End special keys
93 
94  protected:
96  ~InteractionEvent() override;
97 
98  friend MITKCORE_EXPORT bool operator==(const InteractionEvent &, const InteractionEvent &);
99  virtual bool IsEqual(const InteractionEvent &other) const;
100 
101  private:
102  BaseRenderer *m_Sender;
103  };
104 
116 
117  /*
118  * Allow bitwise OR operation on enums.
119  */
121  {
122  return static_cast<InteractionEvent::MouseButtons>(static_cast<int>(a) | static_cast<int>(b));
123  }
124 
127  {
128  a = static_cast<InteractionEvent::MouseButtons>(static_cast<int>(a) | static_cast<int>(b));
129  return a;
130  }
131 
133  {
134  return static_cast<InteractionEvent::ModifierKeys>(static_cast<int>(a) | static_cast<int>(b));
135  }
136 
139  {
140  a = static_cast<InteractionEvent::ModifierKeys>(static_cast<int>(a) | static_cast<int>(b));
141  return a;
142  }
143 
144 } /* namespace mitk */
145 
146 #endif
mitk::operator|
InteractionEvent::MouseButtons operator|(InteractionEvent::MouseButtons a, InteractionEvent::MouseButtons b)
Definition: mitkInteractionEvent.h:120
mitk::InteractionEvent::KeyF1
static const std::string KeyF1
Definition: mitkInteractionEvent.h:73
mitk::InteractionEvent::KeyF5
static const std::string KeyF5
Definition: mitkInteractionEvent.h:77
mitk::InteractionEvent::KeyArrowRight
static const std::string KeyArrowRight
Definition: mitkInteractionEvent.h:71
mitk::InteractionEvent::KeyF2
static const std::string KeyF2
Definition: mitkInteractionEvent.h:74
mitk::InteractionEvent::KeyF12
static const std::string KeyF12
Definition: mitkInteractionEvent.h:84
mitk::InteractionEvent
Definition: mitkInteractionEvent.h:26
mitk::InteractionEvent::KeyPageUp
static const std::string KeyPageUp
Definition: mitkInteractionEvent.h:89
mitk::InteractionEvent::KeyF9
static const std::string KeyF9
Definition: mitkInteractionEvent.h:81
mitk::InteractionEvent::KeyDelete
static const std::string KeyDelete
Definition: mitkInteractionEvent.h:67
mitk::InteractionEvent::KeyEsc
static const std::string KeyEsc
Definition: mitkInteractionEvent.h:64
mitkNewMacro1Param
#define mitkNewMacro1Param(classname, type)
Definition: mitkCommon.h:68
mitk::InteractionEvent::KeyF8
static const std::string KeyF8
Definition: mitkInteractionEvent.h:80
mitk::InteractionEvent::MouseButtons
MouseButtons
Definition: mitkInteractionEvent.h:44
itk::SmartPointer< Self >
mitk::InteractionEvent::KeySpace
static const std::string KeySpace
Definition: mitkInteractionEvent.h:91
mitk::InteractionEvent::KeyReturn
static const std::string KeyReturn
Definition: mitkInteractionEvent.h:66
mitk::InteractionEvent::KeyPageDown
static const std::string KeyPageDown
Definition: mitkInteractionEvent.h:90
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::operator!=
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
mitk::InteractionEvent::KeyEnter
static const std::string KeyEnter
Definition: mitkInteractionEvent.h:65
mitk::InteractionEvent::KeyPos1
static const std::string KeyPos1
Definition: mitkInteractionEvent.h:86
mitk::InteractionEvent::KeyF6
static const std::string KeyF6
Definition: mitkInteractionEvent.h:78
mitk::InteractionEvent::KeyInsert
static const std::string KeyInsert
Definition: mitkInteractionEvent.h:88
mitk::InteractionEvent::KeyArrowLeft
static const std::string KeyArrowLeft
Definition: mitkInteractionEvent.h:70
mitk::operator==
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
MitkCoreExports.h
mitkCommon.h
mitk::InteractionEvent::KeyF11
static const std::string KeyF11
Definition: mitkInteractionEvent.h:83
mitk::InteractionEvent::KeyEnd
static const std::string KeyEnd
Definition: mitkInteractionEvent.h:87
mitk::InteractionEvent::KeyF10
static const std::string KeyF10
Definition: mitkInteractionEvent.h:82
mitk::InteractionEvent::ModifierKeys
ModifierKeys
Definition: mitkInteractionEvent.h:52
mitk::operator|=
InteractionEvent::MouseButtons & operator|=(InteractionEvent::MouseButtons &a, InteractionEvent::MouseButtons &b)
Definition: mitkInteractionEvent.h:125
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:56
mitk::InteractionEvent::KeyF3
static const std::string KeyF3
Definition: mitkInteractionEvent.h:75
mitk::InteractionEvent::KeyF7
static const std::string KeyF7
Definition: mitkInteractionEvent.h:79
mitkBaseRenderer.h
mitk::InteractionEvent::KeyArrowDown
static const std::string KeyArrowDown
Definition: mitkInteractionEvent.h:69
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::InteractionEvent::KeyF4
static const std::string KeyF4
Definition: mitkInteractionEvent.h:76
mitk::InteractionEvent::KeyArrowUp
static const std::string KeyArrowUp
Definition: mitkInteractionEvent.h:68