Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
mitkDisplayActionEventHandler.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 mitkDisplayActionEventHandler_h
14 #define mitkDisplayActionEventHandler_h
15 
16 #include <MitkCoreExports.h>
17 
18 // mitk core
21 #include "mitkStdFunctionCommand.h"
22 
23 namespace mitk
24 {
34  {
35  public:
36 
37  using OberserverTagType = unsigned long;
38 
39  virtual ~DisplayActionEventHandler();
40 
52  void SetObservableBroadcast(DisplayActionEventBroadcast* observableBroadcast);
53 
70  OberserverTagType ConnectDisplayActionEvent(const DisplayActionEvent& displayActionEvent,
71  const StdFunctionCommand::ActionFunction& actionFunction,
72  const StdFunctionCommand::FilterFunction& filterFunction = [](const itk::EventObject&) { return true; });
73 
84  void DisconnectObserver(OberserverTagType observerTag);
85 
86  const std::vector<OberserverTagType>& GetAllObserverTags() { return m_ObserverTags; }
87 
98  void InitActions();
99 
100  protected:
101 
106  virtual void InitActionsImpl() { }
107 
109  std::vector<OberserverTagType> m_ObserverTags;
110 
111  };
112 
113 } // end namespace mitk
114 
115 #endif
mitk::StdFunctionCommand::ActionFunction
std::function< void(const itk::EventObject &)> ActionFunction
Definition: mitkStdFunctionCommand.h:34
mitkDisplayActionEvents.h
mitk::DisplayActionEventHandler::OberserverTagType
unsigned long OberserverTagType
Definition: mitkDisplayActionEventHandler.h:37
mitk::DisplayActionEventHandler::GetAllObserverTags
const std::vector< OberserverTagType > & GetAllObserverTags()
Definition: mitkDisplayActionEventHandler.h:86
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
mitk::DisplayActionEventHandler::InitActionsImpl
virtual void InitActionsImpl()
Sub-classes need to implement this function to define a customized behavior for default action pre-de...
Definition: mitkDisplayActionEventHandler.h:106
mitk::DisplayActionEventBroadcast
This class serves as an event state machine while simultaneously observing interaction events....
Definition: mitkDisplayActionEventBroadcast.h:32
mitk::DisplayActionEventHandler::m_ObserverTags
std::vector< OberserverTagType > m_ObserverTags
Definition: mitkDisplayActionEventHandler.h:109
mitk::StdFunctionCommand::FilterFunction
std::function< bool(const itk::EventObject &)> FilterFunction
Definition: mitkStdFunctionCommand.h:33
MitkCoreExports.h
mitkStdFunctionCommand.h
mitk::DisplayActionEvent
Definition: mitkDisplayActionEvents.h:29
mitk::DisplayActionEventHandler::m_ObservableBroadcast
WeakPointer< DisplayActionEventBroadcast > m_ObservableBroadcast
Definition: mitkDisplayActionEventHandler.h:108
mitk::DisplayActionEventHandler
This class simplifies the process of adding an itkEventObject-itkCommand pair as an observer of a Dis...
Definition: mitkDisplayActionEventHandler.h:33
mitkDisplayActionEventBroadcast.h
mitk::WeakPointer
Definition: mitkWeakPointer.h:22
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15