Medical Imaging Interaction Toolkit  2026.06.00
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 {
45  class MITKCORE_EXPORT InteractionEvent : public itk::LightObject
46  {
47  public:
50 
55  void SetSender(BaseRenderer *sender);
56 
62 
72  virtual bool IsSuperClassOf(const InteractionEvent::Pointer &baseClass) const;
73 
80  {
81  NoButton = 0x0000,
82  LeftMouseButton = 0x0001,
83  RightMouseButton = 0x0002,
84  MiddleMouseButton = 0x0004
85  };
86 
93  {
94  NoKey = 0x0000,
95  ShiftKey = 0x0100,
96  ControlKey = 0x0200,
97  AltKey = 0x0400
98  };
99 
102  static const std::string KeyEsc;
103  static const std::string KeyEnter;
104  static const std::string KeyReturn;
105  static const std::string KeyDelete;
106  static const std::string KeyArrowUp;
107  static const std::string KeyArrowDown;
108  static const std::string KeyArrowLeft;
109  static const std::string KeyArrowRight;
110 
111  static const std::string KeyF1;
112  static const std::string KeyF2;
113  static const std::string KeyF3;
114  static const std::string KeyF4;
115  static const std::string KeyF5;
116  static const std::string KeyF6;
117  static const std::string KeyF7;
118  static const std::string KeyF8;
119  static const std::string KeyF9;
120  static const std::string KeyF10;
121  static const std::string KeyF11;
122  static const std::string KeyF12;
123 
124  static const std::string KeyPos1;
125  static const std::string KeyEnd;
126  static const std::string KeyInsert;
127  static const std::string KeyPageUp;
128  static const std::string KeyPageDown;
129  static const std::string KeySpace;
131 
132  protected:
134  ~InteractionEvent() override;
135 
137  virtual bool IsEqual(const InteractionEvent &other) const;
138 
139  private:
140  BaseRenderer *m_Sender;
141  };
142 
154 
155  /*
156  * Allow bitwise OR operation on enums.
157  */
159  {
160  return static_cast<InteractionEvent::MouseButtons>(static_cast<int>(a) | static_cast<int>(b));
161  }
162 
165  {
166  a = static_cast<InteractionEvent::MouseButtons>(static_cast<int>(a) | static_cast<int>(b));
167  return a;
168  }
169 
171  {
172  return static_cast<InteractionEvent::ModifierKeys>(static_cast<int>(a) | static_cast<int>(b));
173  }
174 
177  {
178  a = static_cast<InteractionEvent::ModifierKeys>(static_cast<int>(a) | static_cast<int>(b));
179  return a;
180  }
181 
182 } /* namespace mitk */
183 
184 #endif
#define MITKCORE_EXPORT
Organizes the rendering process.
Base class for all interaction events in MITK.
static const std::string KeyPageUp
"PageUp" key constant.
static const std::string KeyPos1
"Pos1" (Home) key constant.
static const std::string KeyF5
"F5" key constant.
static const std::string KeyEnd
"End" key constant.
static const std::string KeyPageDown
"PageDown" key constant.
static const std::string KeyF9
"F9" key constant.
friend MITKCORE_EXPORT bool operator==(const InteractionEvent &, const InteractionEvent &)
static const std::string KeyEnter
"Enter" key constant.
static const std::string KeyF3
"F3" key constant.
~InteractionEvent() override
static const std::string KeyReturn
"Return" key constant.
ModifierKeys
Enumeration of keyboard modifier keys.
virtual bool IsEqual(const InteractionEvent &other) const
static const std::string KeyArrowRight
"ArrowRight" key constant.
static const std::string KeyArrowDown
"ArrowDown" key constant.
static const std::string KeyArrowUp
"ArrowUp" key constant.
static const std::string KeyF2
"F2" key constant.
static const std::string KeyArrowLeft
"ArrowLeft" key constant.
void SetSender(BaseRenderer *sender)
Set the BaseRenderer that sent this event.
static const std::string KeyF10
"F10" key constant.
BaseRenderer * GetSender() const
Get the BaseRenderer that sent this event.
mitkNewMacro1Param(Self, BaseRenderer *)
static const std::string KeyF1
"F1" key constant.
static const std::string KeyF12
"F12" key constant.
static const std::string KeyF11
"F11" key constant.
static const std::string KeyDelete
"Delete" key constant.
InteractionEvent(BaseRenderer *)
static const std::string KeySpace
"Space" key constant.
static const std::string KeyEsc
String constants for special keys used in key events and state machine patterns.
static const std::string KeyF8
"F8" key constant.
static const std::string KeyF7
"F7" key constant.
static const std::string KeyF6
"F6" key constant.
static const std::string KeyInsert
"Insert" key constant.
MouseButtons
Enumeration of mouse button states.
static const std::string KeyF4
"F4" key constant.
mitkClassMacroItkParent(InteractionEvent, itk::LightObject)
virtual bool IsSuperClassOf(const InteractionEvent::Pointer &baseClass) const
Check if the provided event is an instance of this class or a derived class.
Find image slices visible on a given plane.
InteractionEvent::MouseButtons & operator|=(InteractionEvent::MouseButtons &a, InteractionEvent::MouseButtons &b)
InteractionEvent::MouseButtons operator|(InteractionEvent::MouseButtons a, InteractionEvent::MouseButtons b)
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)