24 observableBroadcastPtr->RemoveObserver(tag);
26 m_ObserverTags.clear();
45 observableBroadcastPtr->RemoveObserver(tag);
47 m_ObserverTags.clear();
60 mitkThrow() <<
"No display action event broadcast class set to observe. Use 'SetObservableBroadcast' before connecting events.";
65 command->SetCommandAction(actionFunction);
66 command->SetCommandFilter(filterFunction);
67 OberserverTagType tag = observableBroadcast->AddObserver(displayActionEvent, command);
76 mitkThrow() <<
"No display action event broadcast class set to observe. Use 'SetObservableBroadcast' before disconnecting observer.";
83 observableBroadcast->RemoveObserver(observerTag);
92 mitkThrow() <<
"No display action event broadcast class set to observe. Use 'SetObservableBroadcast' before initializing actions.";
98 for (
const auto& tag : allObserverTags)
100 observableBroadcast->RemoveObserver(tag);
std::vector< OberserverTagType > m_ObserverTags
const std::vector< OberserverTagType > & GetAllObserverTags()
virtual void InitActionsImpl()
Sub-classes need to implement this function to define a customized behavior for default action pre-de...
void DisconnectObserver(OberserverTagType observerTag)
Uses the given observer tag to remove the corresponding custom command as an observer of the observed...
std::function< void(const itk::EventObject &)> ActionFunction
WeakPointer< DisplayActionEventBroadcast > m_ObservableBroadcast
This class serves as an event state machine while simultaneously observing interaction events...
void SetObservableBroadcast(DisplayActionEventBroadcast *observableBroadcast)
Sets the display action event broadcast class that should be observed. This class receives events fro...
virtual ~DisplayActionEventHandler()
OberserverTagType ConnectDisplayActionEvent(const DisplayActionEvent &displayActionEvent, const StdFunctionCommand::ActionFunction &actionFunction, const StdFunctionCommand::FilterFunction &filterFunction=[](const itk::EventObject &) { return true;})
Uses the given std::functions to customize a command: The display action event is used to define on w...
void InitActions()
This function can be used by sub-classes to initialize a set of pre-defined DisplayActionEventFunctio...
std::function< bool(const itk::EventObject &)> FilterFunction
unsigned long OberserverTagType