13 #ifndef mitkEventStateMachine_h
14 #define mitkEventStateMachine_h
16 #include "itkObject.h"
29 #define CONNECT_FUNCTION(a, f) \
30 ::mitk::EventStateMachine::AddActionFunction( \
32 ::mitk::MessageDelegate2<Self, ::mitk::StateMachineAction *, ::mitk::InteractionEvent *, void>(this, &Self::f));
34 #define CONNECT_CONDITION(a, f) \
35 ::mitk::EventStateMachine::AddConditionFunction( \
36 a, ::mitk::MessageDelegate1<Self, const ::mitk::InteractionEvent *, bool>(this, &Self::f));
45 class StateMachineTransition;
46 class StateMachineContainer;
47 class StateMachineAction;
48 class StateMachineCondition;
49 class InteractionEvent;
50 class StateMachineState;
249 typedef std::map<std::string, ActionFunctionDelegate *> ActionDelegatesMapType;
250 typedef std::map<std::string, ConditionFunctionDelegate *> ConditionDelegatesMapType;
253 *m_StateMachineContainer;
254 std::map<std::string, TActionFunctor *> m_ActionFunctionsMap;
255 ActionDelegatesMapType m_ActionDelegatesMap;
256 ConditionDelegatesMapType m_ConditionDelegatesMap;
259 bool m_MouseCursorSet;
Class for nodes of the DataTree.
bool LoadStateMachine(const std::string &filename, const us::Module *module=nullptr)
Loads XML resource.
bool HandleEvent(InteractionEvent *event, DataNode *dataNode)
void ResetToStartState()
ResetToStartState Reset state machine to it initial starting state.
void EnableInteraction(bool enable)
Enables/disables the state machine. In un-enabled state it won't react to any events.
StateMachineState * GetCurrentState() const
void EnableUndo(bool enable)
Enables or disabled Undo.
itk::SmartPointer< StateMachineState > StateMachineStateType
std::map< std::string, TActionFunctor * > ActionFunctionsMapType
virtual void ExecuteAction(StateMachineAction *action, InteractionEvent *interactionEvent)
~EventStateMachine() override
void AddConditionFunction(const std::string &condition, const ConditionFunctionDelegate &delegate)
void AddActionFunction(const std::string &action, const ActionFunctionDelegate &delegate)
virtual bool FilterEvents(InteractionEvent *interactionEvent, DataNode *dataNode)
virtual bool CheckCondition(const StateMachineCondition &condition, const InteractionEvent *interactionEvent)
void ResetMouseCursor()
Resets the mouse cursor to its original state.
StateMachineTransition * GetExecutableTransition(InteractionEvent *event)
Returns the executable transition for the given event.
MessageAbstractDelegate1< const InteractionEvent *, bool > ConditionFunctionDelegate
void SetMouseCursor(const char *xpm[], int hotspotX, int hotspotY)
Sets the specified mouse cursor.
virtual void ConnectActionsAndFunctions()
UndoController * m_UndoController
void AddActionFunction(const std::string &action, TActionFunctor *functor)
MessageAbstractDelegate2< StateMachineAction *, InteractionEvent *, void > ActionFunctionDelegate
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
Represents a condition, that has to be fulfilled in order to execute a state machine transition after...
Connects two states, and holds references to corresponding actions and conditions.
Base class of ActionFunctors, to provide an easy to connect actions with functions.
virtual ~TActionFunctor()
virtual bool DoAction(StateMachineAction *, InteractionEvent *)=0
#define mitkClassMacro(className, SuperClassName)
Find image slices visible on a given plane.