Simplifies connecting display action event observers to a DisplayActionEventBroadcast.
More...
#include <mitkDisplayActionEventHandler.h>
|
| virtual void | InitActionsImpl (const std::string &prefixFilter="") |
| | Override in sub-classes to define default display action connections. More...
|
| |
Simplifies connecting display action event observers to a DisplayActionEventBroadcast.
Use SetObservableBroadcast() to define which broadcast instance to observe, then ConnectDisplayActionEvent() to register event-command pairs. Each observer consists of a DisplayActionEvent (itkEventObject) and a StdFunctionCommand (itkCommand) that is created internally from the supplied std::function objects.
- See also
- DisplayActionEventBroadcast DisplayActionEvents StdFunctionCommand
Definition at line 37 of file mitkDisplayActionEventHandler.h.
◆ OberserverTagType
◆ ~DisplayActionEventHandler()
| virtual mitk::DisplayActionEventHandler::~DisplayActionEventHandler |
( |
| ) |
|
|
virtual |
Destructor. Removes all registered observers.
◆ ConnectDisplayActionEvent()
Register an observer for a specific display action event.
Creates a StdFunctionCommand from the given action and filter functions, adds it as an observer to the broadcast, and stores its tag.
- Precondition
- The observable broadcast must have been set via SetObservableBroadcast().
- Exceptions
-
- Parameters
-
| displayActionEvent | The event type to observe. |
| actionFunction | The function to execute when the event occurs. |
| filterFunction | Optional filter checked before execution (defaults to always true). |
- Returns
- A tag identifying the newly created observer.
◆ DisconnectObserver()
| void mitk::DisplayActionEventHandler::DisconnectObserver |
( |
OberserverTagType |
observerTag | ) |
|
Remove an observer identified by its tag.
If the tag is not found in the internal list, nothing happens.
- Precondition
- The observable broadcast must have been set.
- Exceptions
-
- Parameters
-
| observerTag | The tag identifying the observer to remove. |
◆ GetAllObserverTags()
| const std::vector<OberserverTagType>& mitk::DisplayActionEventHandler::GetAllObserverTags |
( |
| ) |
|
|
inline |
◆ InitActions()
| void mitk::DisplayActionEventHandler::InitActions |
( |
std::string |
prefixFilter = "" | ) |
|
Initialize pre-defined display actions and connect them to the broadcast.
Removes all currently connected observers, then calls InitActionsImpl() to let sub-classes define their specific set of actions.
- Precondition
- The observable broadcast must have been set.
- Exceptions
-
- Parameters
-
| prefixFilter | Only react to / send changes to renderers whose name starts with this prefix. |
◆ InitActionsImpl()
| virtual void mitk::DisplayActionEventHandler::InitActionsImpl |
( |
const std::string & |
prefixFilter = "" | ) |
|
|
protectedvirtual |
◆ SetObservableBroadcast()
Set the DisplayActionEventBroadcast instance to observe.
This class receives events from the given broadcast and triggers the corresponding action functions.
- Postcondition
- If the same broadcast was already set, nothing changes.
-
If a different broadcast was already set, all previously registered observers are removed.
- Parameters
-
| observableBroadcast | The broadcast instance to observe. |
◆ m_ObservableBroadcast
◆ m_ObserverTags
The documentation for this class was generated from the following file: